]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
proto: use bitmask_type for comp flags
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 5 Jun 2015 15:02:05 +0000 (17:02 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 5 Jun 2015 15:34:35 +0000 (17:34 +0200)
I think flags should be displayed in hexadecimal and should be handled as a
bitmask.

inet/comp.t: WARNING: line: 15: 'nft add rule ip test-ip4 input comp flags 0x00': 'comp flags 0x00' mismatches 'comp flags 0'
inet/comp.t: WARNING: line: 16: 'nft add rule ip test-ip4 input comp flags != 0x23': 'comp flags != 0x23' mismatches 'comp flags != 35'
inet/comp.t: WARNING: line: 17: 'nft add rule ip test-ip4 input comp flags 0x33-0x45': 'comp flags 0x33-0x45' mismatches 'comp flags 51-69'
inet/comp.t: WARNING: line: 18: 'nft add rule ip test-ip4 input comp flags != 0x33-0x45': 'comp flags != 0x33-0x45' mismatches 'comp flags != 51-69'
inet/comp.t: WARNING: line: 19: 'nft add rule ip test-ip4 input comp flags {0x33, 0x55, 0x67, 0x88}': 'comp flags {0x33, 0x55, 0x67, 0x88}' mismatches 'comp flags { 103, 85, 51, 136}'
inet/comp.t: WARNING: line: 21: 'nft add rule ip test-ip4 input comp flags { 0x33-0x55}': 'comp flags { 0x33-0x55}' mismatches 'comp flags { 51-85}'

rfc3173 says that this is unused for future use though.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/proto.c
tests/regression/inet/comp.t

index 7dc7b3e247f622588795ad4a00008a0ae26c1a2f..6302016c2f2be4937f61fd625e7774b1fb7f053e 100644 (file)
@@ -272,7 +272,7 @@ const struct proto_desc proto_comp = {
        },
        .templates      = {
                [COMPHDR_NEXTHDR]       = INET_PROTOCOL("nexthdr", struct ip_comp_hdr, nexthdr),
-               [COMPHDR_FLAGS]         = COMPHDR_FIELD("flags", flags),
+               [COMPHDR_FLAGS]         = HDR_TEMPLATE("flags", &bitmask_type, struct ip_comp_hdr, flags),
                [COMPHDR_CPI]           = COMPHDR_FIELD("cpi", cpi),
        },
 };
index afdc63f3393286315eedc6dc98874323d4ce70d4..f4753bbc4253a16856b1af03830a3e63c15df37a 100644 (file)
@@ -12,7 +12,7 @@ comp nexthdr != esp;ok;comp nexthdr != 50
 # comp flags ## 8-bit field.  Reserved for future use.  MUST be set to zero.
 
 # Bug comp flags: to list. List the decimal value.
-comp flags 0x00;ok
+comp flags 0x0;ok
 comp flags != 0x23;ok
 comp flags 0x33-0x45;ok
 comp flags != 0x33-0x45;ok