Re: [PATCH V2 iptables] extensions: libxt_connlabel: Add translation to nft

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> wrote:
> On Sat, Jul 16, 2016 at 06:42:24PM +0800, Liping Zhang wrote:
> >   # iptables-translate -A INPUT -m connlabel ! --label bit40 --set
> >   nft add rule ip filter INPUT ct label set bit40 ct label and bit40 != bit40 counter
> 
> I think this logic is inverted, I mean:
> 
> nft add rule ip filter INPUT ct label and bit40 != bit40 ct label set bit40 counter
>                              ---------------------------
> 
> test should happen before set.

xt_connlabel does:

if (info->options & XT_CONNLABEL_OP_SET)
	return (nf_connlabel_set(ct, info->bit) == 0) ^ invert;

So if info->bit is/got set (either it was already set or ct has connlabel
area where we could toggle the desired bit) then the match returns false
if invert was requested.

And to do that the "ct label set" operation needs to happen first.
To achive the same as the xt match in one op we'd need to alter the
"set" operation to also fill a dreg to perform a test; I don't think
its good idea.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux