* [PATCH nft] meta: fix pkttype name and add 'other' symbol
@ 2016-10-27 16:33 Florian Westphal
2016-10-27 17:23 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2016-10-27 16:33 UTC (permalink / raw)
To: netfilter-devel; +Cc: Florian Westphal
'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>
---
src/meta.c | 4 +++-
tests/py/any/meta.t | 4 ++--
tests/py/any/meta.t.payload | 4 ++--
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/meta.c b/src/meta.c
index 63ec452e7900..fb38a21bfd1b 100644
--- a/src/meta.c
+++ b/src/meta.c
@@ -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,
},
};
diff --git a/tests/py/any/meta.t b/tests/py/any/meta.t
index a1249e8b23e8..76ce06be1e36 100644
--- a/tests/py/any/meta.t
+++ b/tests/py/any/meta.t
@@ -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
diff --git a/tests/py/any/meta.t.payload b/tests/py/any/meta.t.payload
index 65d1cd42ec8c..f000bc8018f1 100644
--- a/tests/py/any/meta.t.payload
+++ b/tests/py/any/meta.t.payload
@@ -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 ]
--
2.7.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH nft] meta: fix pkttype name and add 'other' symbol
2016-10-27 16:33 [PATCH nft] meta: fix pkttype name and add 'other' symbol Florian Westphal
@ 2016-10-27 17:23 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2016-10-27 17:23 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel
On Thu, Oct 27, 2016 at 06:33:14PM +0200, Florian Westphal wrote:
> '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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-27 17:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-27 16:33 [PATCH nft] meta: fix pkttype name and add 'other' symbol Florian Westphal
2016-10-27 17:23 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).