All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Jack Ma <Jack.Ma@alliedtelesis.co.nz>
Cc: Florian Westphal <fw@strlen.de>,
	"netfilter-devel@vger.kernel.org"
	<netfilter-devel@vger.kernel.org>
Subject: Re: shift by n bits while performing '--restore-mark'
Date: Wed, 7 Feb 2018 00:53:57 +0100	[thread overview]
Message-ID: <20180206235357.GB14261@breakpoint.cc> (raw)
In-Reply-To: <1517960766867.47573@alliedtelesis.co.nz>

Jack Ma <Jack.Ma@alliedtelesis.co.nz> wrote:
> Our current condition is:
> 
> 1) only 0xfff00000 (three F available in skb->mark), but 0xfffff000 (five F available in ct->mark)
> 
> We wish to copy either 0xfff00000 or 0x00fff000 from ct->mark into skb->mark,
> 
> 
> What about '-j CONNMARK  --restore-mark --mask 0xfffff000 << 8 ( left shift 2 F)'
> 
> This will result in skb->mark = ct->mark << 8
> 
> if ct->mark = 0xabcde000, now skb->mark is changed to:  skb->mark = 0xcde00000.
> 
> Does this make sense :) ?

Yes it does.

AFAICS with nftables you could already do this but I can understand if
you need to use iptables for this.

So feel free to send a patch from xt_connmark.

Thanks for explaining this.

  reply	other threads:[~2018-02-06 23:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16  2:26 conntrack enhancement Jack Ma
2018-01-16 14:17 ` Florian Westphal
2018-01-23  1:16   ` Jack Ma
2018-01-25  2:34   ` Jack Ma
     [not found]     ` <20180125062211.GE14192@breakpoint.cc>
2018-01-25 21:31       ` Jack Ma
2018-02-06 23:46       ` shift by n bits while performing '--restore-mark' Jack Ma
2018-02-06 23:53         ` Florian Westphal [this message]
2018-02-15  4:13           ` Jack Ma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180206235357.GB14261@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=Jack.Ma@alliedtelesis.co.nz \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.