From d0446ab11182f6ca2adc486a124895f09a220c6e Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Fri, 21 Feb 2020 14:55:52 +0100 Subject: 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 --- iptables/xtables.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'iptables/xtables.c') diff --git a/iptables/xtables.c b/iptables/xtables.c index 3d75a1dd..8c2d21d4 100644 --- a/iptables/xtables.c +++ b/iptables/xtables.c @@ -571,10 +571,6 @@ void do_parse(struct nft_handle *h, int argc, char *argv[], demand-load a protocol. */ opterr = 0; - h->ops = nft_family_ops_lookup(h->family); - if (h->ops == NULL) - xtables_error(PARAMETER_PROBLEM, "Unknown family"); - opts = xt_params->orig_opts; while ((cs->c = getopt_long(argc, argv, "-:A:C:D:R:I:L::S::M:F::Z::N:X::E:P:Vh::o:p:s:d:j:i:fbvw::W::nt:m:xc:g:46", -- cgit v1.2.3