Hi Sriram, On Fri, Mar 08, 2024 at 02:49:38PM +0530, Sriram Rajagopalan wrote: > iptables-nft based on nftables has an issue with the way the rule > filter - "! --sport xx ! --dport xx" is wrongly merged and rendered. I agree with your analysis and the patches look fine. Could you please submit them formally? [...] > % export IPTABLES=/usr/local/sbin/iptables-legacy; sudo $IPTABLES -A > INPUT -p tcp ! --sport 22 ! --dport 22 -i vm2; echo -e "\n---- Before > data ----\n"; sudo $IPTABLES -L INPUT -vvvn; sudo python -c "from > scapy.all import *; > sendp(Ether(dst='9e:00:fa:a3:c9:48')/IP(src='1.1.1.1', > dst='2.2.2.2')/TCP(sport=23, dport=22), iface='vm1')"; echo -e "\n---- > After data with either one of tcp sport/dport being 22 ----\n"; sudo > $IPTABLES -L INPUT -vn; sudo python -c "from scapy.all import *; > sendp(Ether(dst='9e:00:fa:a3:c9:48')/IP(src='1.1.1.1', > dst='2.2.2.2')/TCP(sport=23, dport=23), iface='vm1')"; echo -e "\n---- > After data with neither one of tcp sport/dport being 22 ----\n"; sudo > $IPTABLES -L INPUT -vn; sudo $IPTABLES -D INPUT -p tcp ! --sport 22 ! > --dport 22 -i vm2 > > > ---- Before data ---- > > ip filter INPUT 41 > [ meta load iifname => reg 1 ] > [ cmp eq reg 1 0x00326d76 ] > [ payload load 1b @ network header + 9 => reg 1 ] > [ cmp eq reg 1 0x00000006 ] > [ payload load 2b @ transport header + 0 => reg 1 ] > [ cmp neq reg 1 0x00001600 ] > [ payload load 2b @ transport header + 2 => reg 1 ] > [ cmp neq reg 1 0x00001600 ] > [ counter pkts 0 bytes 0 ] You're fibbing here: That netlink debug output can't come from iptables-legacy. I suspect it actually comes from your patched iptables-nft or nft too. :) [...] > Author: Sriram Rajagopalan <bglsriram@xxxxxxxxx> > Date: Fri Mar 07 20:09:38 2024 -0800 > > iptables: Fixed the issue with combining the payload in case of invert > filter for tcp src and dst ports > > Signed-off-by: Sriram Rajagopalan <bglsriram@xxxxxxxxx> > Signed-off-by: Sriram Rajagopalan <sriramr@xxxxxxxxxx> Maybe avoid the double SoB? Apart from that: Acked-by: Phil Sutter <phil@xxxxxx> Thanks, Phil