Netfilter-Devel Archive on lore.kernel.org
 help / color / Atom feed
* Rearranging expressions in the rule
@ 2019-10-30 14:26 Serguei Bezverkhi (sbezverk)
  0 siblings, 0 replies; only message in thread
From: Serguei Bezverkhi (sbezverk) @ 2019-10-30 14:26 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Pablo Neira Ayuso, Michael Stapelberg

Hello,

I came across an anomaly (at least I think it is anomaly), but wanted to confirm my observation.  

The following sequence of expressions:
[
{"DestRegister":1,"Base":"expr.PayloadBaseNetworkHeader","Len":1,"Offset":9}, 
{"Op":"expr.CmpOpEq","Register":1,"Data":["0x1"]},
{"DestRegister":1,"Base":"expr.PayloadBaseNetworkHeader","Len":4,"Offset":16},
{"SourceRegister":1,"DestRegister":1,"Len":4,"Mask":["0xff","0xff","0x0","0x0"],"Xor":["0x0","0x0","0x0","0x0"]},
{"Op":"expr.CmpOpEq","Register":1,"Data":["0x1","0x1","0x0","0x0"]},
{"Kind":"0x0"}
]

correctly generates nft like rule:

ip protocol icmp ip daddr 1.1.0.0/16 drop

Then I request netlink to get me the same rule back (I am testing functionality to read and absorb already existing nft rules), I get different set of expressions for the same rule. Here is what I get:
[
{"DestRegister":1,"Base":"expr.PayloadBaseNetworkHeader","Len":1,"Offset":9},
{"Op":"expr.CmpOpEq","Register":1,"Data":["0x1"]},
{"DestRegister":1,"Base":"expr.PayloadBaseNetworkHeader","Len":4,"Offset":16},
{"Op":"expr.CmpOpEq","Register":1,"Data":["0x1","0x1","0x0","0x0"]},
{"Kind":"0x0"}
]

It does not look correct because it loses subnet length information.  I would appreciate if somebody could confirm if it is not expected behavior and if anybody observed something similar.

Thank you
Serguei


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30 14:26 Rearranging expressions in the rule Serguei Bezverkhi (sbezverk)

Netfilter-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netfilter-devel/0 netfilter-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netfilter-devel netfilter-devel/ https://lore.kernel.org/netfilter-devel \
		netfilter-devel@vger.kernel.org
	public-inbox-index netfilter-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netfilter-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git