]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: Make invflags 16bit wide
authorPhil Sutter <phil@nwl.cc>
Mon, 2 Nov 2020 11:05:44 +0000 (12:05 +0100)
committerPhil Sutter <phil@nwl.cc>
Mon, 17 May 2021 13:06:40 +0000 (15:06 +0200)
This is needed to merge with xtables-arp which has more builtin
options and hence needs more bits in invflags.

The only adjustment needed is the set_option() call for option '-j'
which passed a pointer to cs->fw.ip.invflags. That field can't be
changed, it belongs to uAPI. Though using args->invflags instead works
fine, aside from that '-j' doesn't support inverting so this is merely a
sanity check and no real invflag value assignment will happen.

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

index da4ba9d2ba8de91496c703d5967fb02fb2b0bafc..cc8f3a79b369ef1feb3f4b459c804e100742b921 100644 (file)
@@ -190,7 +190,7 @@ struct xtables_args {
        int             family;
        uint16_t        proto;
        uint8_t         flags;
-       uint8_t         invflags;
+       uint16_t        invflags;
        char            iniface[IFNAMSIZ], outiface[IFNAMSIZ];
        unsigned char   iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
        bool            goto_set;
index 9779bd83d53b3f293ba6d7869e6e825dafc6f8bb..c3d82014778b23ba12380cec352fb0d6d431a4da 100644 (file)
@@ -239,7 +239,7 @@ xtables_exit_error(enum xtables_exittype status, const char *msg, ...)
 /* Christophe Burki wants `-p 6' to imply `-m tcp'.  */
 
 static void
-set_option(unsigned int *options, unsigned int option, uint8_t *invflg,
+set_option(unsigned int *options, unsigned int option, u_int16_t *invflg,
           int invert)
 {
        if (*options & option)
@@ -692,7 +692,7 @@ void do_parse(struct nft_handle *h, int argc, char *argv[],
 #endif
 
                case 'j':
-                       set_option(&cs->options, OPT_JUMP, &cs->fw.ip.invflags,
+                       set_option(&cs->options, OPT_JUMP, &args->invflags,
                                   cs->invert);
                        command_jump(cs, optarg);
                        break;