Skip to contentSkip to conversation

iptables: cleanup FIXME

PATCH In review Michael Estner 2 participants 3 messages May 24, 2024 – May 26, 2024 1 message not in the archive netfilter

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): Zk9yrd8Ji1xAcblw

#1 lore raw

PATCH 1/1 iptables: cleanup FIXME

I checked bitmask in the ebt_entry struct in iptables/xshared.h Should be compared here since bitmask needs to be the first field in the struct ebt_entry.

#2 lore raw

PATCH 1/1 iptables: cleanup FIXME

Rework FIXME since struct ebt_entry has no flags var. Use variable bitmask instead.
Update the debug output.

---
 iptables/nft-bridge.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
iptables/nft-bridge.c +2 -2
index 922ce983..f4a3c69a 100644
@@ -373,9 +373,9 @@ static bool nft_bridge_is_same(const struct iptables_command_state *cs_a,
 	int i;
 
 	if (a->ethproto != b->ethproto ||
-	    /* FIXME: a->flags != b->flags || */
+	    a->bitmask != b->bitmask ||
 	    a->invflags != b->invflags) {
-		DEBUGP("different proto/flags/invflags\n");
+		DEBUGP("different proto/bitmask/invflags\n");
 		return false;
 	}
 

--
2.25.1

reviewer
#3 lore raw
In reply to Michael Estner

Hi Michael,

Quoted 3 lines · Michael Estner

I checked bitmask in the ebt_entry struct in iptables/xshared.h Should be compared here since bitmask needs to be the first field in the struct ebt_entry.

The reason why 'bitmask' has to be the first field is that in kernel space, the first bit in it is used to distinguish list element types between 'struct ebt_entries' and 'struct ebt_entry'. See EBT_ENTRY_OR_ENTRIES define and the related comment in include/uapi/linux/netfilter_bridge/ebtables.h for reference.

While it seems sensible to do, I wonder why things seem to work fine even without it. Do we find a corner-case which makes it necessary to compare 'bitmask'? Or the other way round, is there a case which breaks if we do?

Cheers, Phil