]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: Pass xtables_args to check_empty_interface()
authorPhil Sutter <phil@nwl.cc>
Thu, 23 Dec 2021 17:27:31 +0000 (18:27 +0100)
committerPhil Sutter <phil@nwl.cc>
Wed, 12 Jan 2022 13:04:52 +0000 (14:04 +0100)
It holds the accessed family field as well and is more generic than
nft_handle.

Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/xtables.c

index 837b399aba5b3c209f191d79562991d6d0e58a6f..db0cec24617416a40c4b6a7ef68d9c1e6f745440 100644 (file)
@@ -145,14 +145,14 @@ list_rules(struct nft_handle *h, const char *chain, const char *table,
        return nft_cmd_rule_list_save(h, chain, table, rulenum, counters);
 }
 
-static void check_empty_interface(struct nft_handle *h, const char *arg)
+static void check_empty_interface(struct xtables_args *args, const char *arg)
 {
        const char *msg = "Empty interface is likely to be undesired";
 
        if (*arg != '\0')
                return;
 
-       if (h->family != NFPROTO_ARP)
+       if (args->family != NFPROTO_ARP)
                xtables_error(PARAMETER_PROBLEM, msg);
 
        fprintf(stderr, "%s", msg);
@@ -460,7 +460,7 @@ void do_parse(struct nft_handle *h, int argc, char *argv[],
                        break;
 
                case 'i':
-                       check_empty_interface(h, optarg);
+                       check_empty_interface(args, optarg);
                        check_inverse(h, optarg, &invert, &optind, argc);
                        set_option(&cs->options, OPT_VIANAMEIN,
                                   &args->invflags, invert);
@@ -470,7 +470,7 @@ void do_parse(struct nft_handle *h, int argc, char *argv[],
                        break;
 
                case 'o':
-                       check_empty_interface(h, optarg);
+                       check_empty_interface(args, optarg);
                        check_inverse(h, optarg, &invert, &optind, argc);
                        set_option(&cs->options, OPT_VIANAMEOUT,
                                   &args->invflags, invert);