From 148131f20421046fea028e638581e938ec985783 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 4 Feb 2019 21:52:53 +0100 Subject: xtables: Fix for false-positive rule matching When comparing two rules with non-standard targets, differences in targets' payloads wasn't respected. The cause is a rather hideous one: Unlike xtables_find_match(), xtables_find_target() did not care whether the found target was already in use or not, so the same target instance was assigned to both rules and therefore payload comparison happened over the same memory location. With legacy iptables it is not possible to reuse a target: The only case where two rules (i.e., iptables_command_state instances) could exist at the same time is when comparing rules, but that's handled using libiptc. The above change clashes with ebtables-nft's reuse of target objects: While input parsing still just assigns the object from xtables_targets list, rule conversion from nftnl to iptables_command_state allocates new data. To fix this, make ebtables-nft input parsing use the common command_jump() routine instead of its own simplified copy. In turn, this also eliminates the ebtables-nft-specific variants of parse_target(), though with a slight change of behaviour: Names of user-defined chains are no longer allowed to contain up to 31 but merely 28 characters. Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal --- iptables/nft-bridge.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'iptables/nft-bridge.h') diff --git a/iptables/nft-bridge.h b/iptables/nft-bridge.h index de52cd71..d90066f1 100644 --- a/iptables/nft-bridge.h +++ b/iptables/nft-bridge.h @@ -32,7 +32,6 @@ int ebt_get_mac_and_mask(const char *from, unsigned char *to, unsigned char *mas */ #define EBT_TABLE_MAXNAMELEN 32 -#define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN #define EBT_FUNCTION_MAXNAMELEN EBT_TABLE_MAXNAMELEN /* verdicts >0 are "branches" */ @@ -122,6 +121,5 @@ void ebt_add_match(struct xtables_match *m, void ebt_add_watcher(struct xtables_target *watcher, struct iptables_command_state *cs); int ebt_command_default(struct iptables_command_state *cs); -struct xtables_target *ebt_command_jump(const char *jumpto); #endif -- cgit v1.2.3