netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: flow_dissector: Wrap unionized VLAN fields in a struct
@ 2019-11-22 15:47 Petr Machata
  2019-11-22 16:29 ` Jiri Pirko
  2019-11-22 17:44 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Petr Machata @ 2019-11-22 15:47 UTC (permalink / raw)
  To: netdev; +Cc: Petr Machata, davem, Pablo Neira Ayuso

In commit a82055af5959 ("netfilter: nft_payload: add VLAN offload
support"), VLAN fields in struct flow_dissector_key_vlan were unionized
with the intention of introducing another field that covered the whole TCI
header. However without a wrapping struct the subfields end up sharing the
same bits. As a result, "tc filter add ... flower vlan_id 14" specifies not
only vlan_id, but also vlan_priority.

Fix by wrapping the individual VLAN fields in a struct.

Fixes: a82055af5959 ("netfilter: nft_payload: add VLAN offload support")
Signed-off-by: Petr Machata <petrm@mellanox.com>
---
 include/net/flow_dissector.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
index f06b0239c32b..b8c20e9f343e 100644
--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -49,9 +49,11 @@ struct flow_dissector_key_tags {
 
 struct flow_dissector_key_vlan {
 	union {
-		u16	vlan_id:12,
-			vlan_dei:1,
-			vlan_priority:3;
+		struct {
+			u16	vlan_id:12,
+				vlan_dei:1,
+				vlan_priority:3;
+		};
 		__be16	vlan_tci;
 	};
 	__be16	vlan_tpid;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: flow_dissector: Wrap unionized VLAN fields in a struct
  2019-11-22 15:47 [PATCH net-next] net: flow_dissector: Wrap unionized VLAN fields in a struct Petr Machata
@ 2019-11-22 16:29 ` Jiri Pirko
  2019-11-22 17:44 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2019-11-22 16:29 UTC (permalink / raw)
  To: Petr Machata; +Cc: netdev, davem, Pablo Neira Ayuso

Fri, Nov 22, 2019 at 04:47:21PM CET, petrm@mellanox.com wrote:
>In commit a82055af5959 ("netfilter: nft_payload: add VLAN offload
>support"), VLAN fields in struct flow_dissector_key_vlan were unionized
>with the intention of introducing another field that covered the whole TCI
>header. However without a wrapping struct the subfields end up sharing the
>same bits. As a result, "tc filter add ... flower vlan_id 14" specifies not
>only vlan_id, but also vlan_priority.
>
>Fix by wrapping the individual VLAN fields in a struct.
>
>Fixes: a82055af5959 ("netfilter: nft_payload: add VLAN offload support")
>Signed-off-by: Petr Machata <petrm@mellanox.com>

Reviewed-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: flow_dissector: Wrap unionized VLAN fields in a struct
  2019-11-22 15:47 [PATCH net-next] net: flow_dissector: Wrap unionized VLAN fields in a struct Petr Machata
  2019-11-22 16:29 ` Jiri Pirko
@ 2019-11-22 17:44 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-11-22 17:44 UTC (permalink / raw)
  To: petrm; +Cc: netdev, pablo

From: Petr Machata <petrm@mellanox.com>
Date: Fri, 22 Nov 2019 15:47:21 +0000

> In commit a82055af5959 ("netfilter: nft_payload: add VLAN offload
> support"), VLAN fields in struct flow_dissector_key_vlan were unionized
> with the intention of introducing another field that covered the whole TCI
> header. However without a wrapping struct the subfields end up sharing the
> same bits. As a result, "tc filter add ... flower vlan_id 14" specifies not
> only vlan_id, but also vlan_priority.
> 
> Fix by wrapping the individual VLAN fields in a struct.
> 
> Fixes: a82055af5959 ("netfilter: nft_payload: add VLAN offload support")
> Signed-off-by: Petr Machata <petrm@mellanox.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-22 17:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 15:47 [PATCH net-next] net: flow_dissector: Wrap unionized VLAN fields in a struct Petr Machata
2019-11-22 16:29 ` Jiri Pirko
2019-11-22 17:44 ` David Miller

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).