]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
meta: fix pkttype name and add 'other' symbol
authorFlorian Westphal <fw@strlen.de>
Thu, 27 Oct 2016 12:31:34 +0000 (14:31 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 27 Oct 2016 17:32:58 +0000 (19:32 +0200)
'unicast' doesn't check for unicast packets; it checks for PACKET_HOST,
i.e. a packet coming in for this host.

A unicast address to some other machine (e.g. because nic is
in promisc mode) will have PACKET_OTHER.

So at best this is misleading, so this patch changes it
to 'host'.  The unicast entry is retained for compat purpose.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/meta.c
tests/py/any/meta.t
tests/py/any/meta.t.payload

index 34f9ee8e36e24699117a0350cde60c5ebcc019a6..bd1e4f283823532f332fcd381899fb1e132550fc 100644 (file)
@@ -327,9 +327,11 @@ static const struct datatype gid_type = {
 
 static const struct symbol_table pkttype_type_tbl = {
        .symbols        = {
-               SYMBOL("unicast", PACKET_HOST),
+               SYMBOL("host", PACKET_HOST),
+               SYMBOL("unicast", PACKET_HOST), /* backwards compat */
                SYMBOL("broadcast", PACKET_BROADCAST),
                SYMBOL("multicast", PACKET_MULTICAST),
+               SYMBOL("other", PACKET_OTHERHOST),
                SYMBOL_LIST_END,
        },
 };
index a1249e8b23e8274f447257c85a60332fe01d7d4b..76ce06be1e3669c5238dfe93b1f0be142b3c22e4 100644 (file)
@@ -152,10 +152,10 @@ meta skgid 3000;ok;skgid 3000
 meta rtclassid "cosmos";ok;rtclassid "cosmos"
 
 meta pkttype broadcast;ok;pkttype broadcast
-meta pkttype unicast;ok;pkttype unicast
+meta pkttype host;ok;pkttype host
 meta pkttype multicast;ok;pkttype multicast
 meta pkttype != broadcast;ok;pkttype != broadcast
-meta pkttype != unicast;ok;pkttype != unicast
+meta pkttype != host;ok;pkttype != host
 meta pkttype != multicast;ok;pkttype != multicast
 meta pkttype broadcastttt;fail
 meta pkttype { broadcast, multicast} accept;ok
index 65d1cd42ec8c34782d1b31e769f8730a15661cc0..f000bc8018f19a17040b8fa002a5c7ffaf7d5e0e 100644 (file)
@@ -530,7 +530,7 @@ ip test-ip4 input
   [ meta load pkttype => reg 1 ]
   [ cmp eq reg 1 0x00000001 ]
 
-# meta pkttype unicast
+# meta pkttype host
 ip test-ip4 input
   [ meta load pkttype => reg 1 ]
   [ cmp eq reg 1 0x00000000 ]
@@ -545,7 +545,7 @@ ip test-ip4 input
   [ meta load pkttype => reg 1 ]
   [ cmp neq reg 1 0x00000001 ]
 
-# meta pkttype != unicast
+# meta pkttype != host
 ip test-ip4 input
   [ meta load pkttype => reg 1 ]
   [ cmp neq reg 1 0x00000000 ]