From 0ae81d09c93a6c27573ae561f2af09153a5f3e51 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Tue, 8 May 2018 09:41:47 +0200 Subject: xtables-compat: ebtables: kill ebtables_command_state Use iptables_command_state instead. This allows to re-use code from the ip(6)tables layer and reduces cop&pasted code. Signed-off-by: Florian Westphal --- iptables/xshared.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'iptables/xshared.h') diff --git a/iptables/xshared.h b/iptables/xshared.h index 7e6d0859..cec5a08a 100644 --- a/iptables/xshared.h +++ b/iptables/xshared.h @@ -48,8 +48,42 @@ struct xtables_afinfo { int so_rev_target; }; +/* trick for ebtables-compat, since watchers are targets */ +struct ebt_match { + struct ebt_match *next; + union { + struct xtables_match *match; + struct xtables_target *watcher; + } u; + bool ismatch; +}; + +/* Fake ebt_entry */ +struct ebt_entry { + /* this needs to be the first field */ + unsigned int bitmask; + unsigned int invflags; + uint16_t ethproto; + /* the physical in-dev */ + char in[IFNAMSIZ]; + /* the logical in-dev */ + char logical_in[IFNAMSIZ]; + /* the physical out-dev */ + char out[IFNAMSIZ]; + /* the logical out-dev */ + char logical_out[IFNAMSIZ]; + unsigned char sourcemac[6]; + unsigned char sourcemsk[6]; + unsigned char destmac[6]; + unsigned char destmsk[6]; + + unsigned char in_mask[IFNAMSIZ]; + unsigned char out_mask[IFNAMSIZ]; +}; + struct iptables_command_state { union { + struct ebt_entry eb; struct ipt_entry fw; struct ip6t_entry fw6; }; @@ -57,6 +91,7 @@ struct iptables_command_state { int c; unsigned int options; struct xtables_rule_match *matches; + struct ebt_match *match_list; struct xtables_target *target; struct xt_counters counters; char *protocol; -- cgit v1.2.3