Rearranging expressions in the rule

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

 



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





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux