Skip to content

iptables-compat fixes

Thomas Woerner netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2iptables-compat: Allow to insert into rule_count+1 positioniptables/nft.c+10 -00 replies
2/2iptables-compat: Increase rule number only for the selected table and chainiptables/nft.c+7 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [IPTABLES 0/2] iptables-compat fixes

Here are the first patches from my tests with iptables-compat and firewalld:

The first patch is enabling to insert a rule into rule_count+1 position.

# iptables-compat -t filter -S INPUT
-P INPUT ACCEPT
[0:0] -A INPUT -s 1.2.3.4/32 -j DROP
# iptables-compat -t filter -I INPUT 2 -s 1.2.3.5 -j DROP 
# iptables-compat -t filter -S INPUT
-P INPUT ACCEPT
[0:0] -A INPUT -s 1.2.3.4/32 -j DROP
[0:0] -A INPUT -s 1.2.3.5/32 -j DROP
This is possible with iptables, but not possible with iptables-compat.
Maybe it would be good to add nft_rule_list_count or similar and use it here.

The second patch fixes the rule number handling in nft_rule_find and __nft_rule_list. The rule number is only valid in the selected table and chain and therefore may not be increased for other tables or chains. With this patch the correct rule will be removed with -D <name> i and listed with -S <name> i.

Thomas Woerner (2):
iptables-compat: Allow to insert into rule_count+1 position
iptables-compat: Increase rule number only for the selected table and
chain

 iptables/nft.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
Signature · 1 line
2.4.3