path: root/iptables/xtables-eb.c
diff options
authorPhil Sutter <>2020-02-21 14:55:52 +0100
committerPhil Sutter <>2020-02-24 12:04:30 +0100
commitd0446ab11182f6ca2adc486a124895f09a220c6e (patch)
tree4ef308fcb3c979fb672db1182c39ac838223dae8 /iptables/xtables-eb.c
parent0f40a8bc49d3f7b815336199931a82f919f37c4e (diff)
xtables: Review nft_init()
Move common code into nft_init(), such as: * initial zeroing nft_handle fields * family ops lookup and assignment to 'ops' field * setting of 'family' field This requires minor adjustments in xtables_restore_main() so extra field initialization doesn't happen before nft_init() call. As a side-effect, this fixes segfaulting xtables-monitor binary when printing rules for trace event as in that code-path 'ops' field wasn't initialized. Signed-off-by: Phil Sutter <>
Diffstat (limited to 'iptables/xtables-eb.c')
1 files changed, 1 insertions, 8 deletions
diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c
index 15b971da..c006bc95 100644
--- a/iptables/xtables-eb.c
+++ b/iptables/xtables-eb.c
@@ -739,16 +739,9 @@ int nft_init_eb(struct nft_handle *h, const char *pname)
- memset(h, 0, sizeof(*h));
- h->family = NFPROTO_BRIDGE;
- if (nft_init(h, xtables_bridge) < 0)
+ if (nft_init(h, NFPROTO_BRIDGE, xtables_bridge) < 0)
"Could not initialize nftables layer.");
- h->ops = nft_family_ops_lookup(h->family);
- if (!h->ops)
- xtables_error(PARAMETER_PROBLEM, "Unknown family");
/* manually registering ebt matches, given the original ebtables parser
* don't use '-m matchname' and the match can't be loaded dynamically when