netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] net/sched fixes for cls_flower and act_tunnel_key
@ 2016-12-22 12:28 Or Gerlitz
  2016-12-22 12:28 ` [PATCH net 1/2] net/sched: act_tunnel_key: Fix setting UDP dst port in metadata under IPv6 Or Gerlitz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Or Gerlitz @ 2016-12-22 12:28 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Roi Dayan, Hadar Har-Zion, Or Gerlitz

Hi Dave,

This small series contain a fix to the matching flags support 
in flower and to the tunnel key action MD prep for IPv6.

On a non related note, wishing everyone around here a happy new year, 
celebrate and take a rest so we can do lots of good patch work(s) next.

Or.

Or Gerlitz (2):
  net/sched: act_tunnel_key: Fix setting UDP dst port in metadata under IPv6
  net/sched: cls_flower: Mandate mask when matching on flags

 net/sched/act_tunnel_key.c |  4 ++--
 net/sched/cls_flower.c     | 23 ++++++++++++-----------
 2 files changed, 14 insertions(+), 13 deletions(-)

-- 
2.3.7

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

* [PATCH net 1/2] net/sched: act_tunnel_key: Fix setting UDP dst port in metadata under IPv6
  2016-12-22 12:28 [PATCH net 0/2] net/sched fixes for cls_flower and act_tunnel_key Or Gerlitz
@ 2016-12-22 12:28 ` Or Gerlitz
  2016-12-22 12:28 ` [PATCH net 2/2] net/sched: cls_flower: Mandate mask when matching on flags Or Gerlitz
  2016-12-23 17:00 ` [PATCH net 0/2] net/sched fixes for cls_flower and act_tunnel_key David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Or Gerlitz @ 2016-12-22 12:28 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Roi Dayan, Hadar Har-Zion, Or Gerlitz

The UDP dst port was provided to the helper function which sets the
IPv6 IP tunnel meta-data under a wrong param order, fix that.

Fixes: 75bfbca01e48 ('net/sched: act_tunnel_key: Add UDP dst port option')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Hadar Hen Zion <hadarh@mellanox.com>
---
 net/sched/act_tunnel_key.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index 7af7125..e3a58e0 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -134,8 +134,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
 			saddr = nla_get_in6_addr(tb[TCA_TUNNEL_KEY_ENC_IPV6_SRC]);
 			daddr = nla_get_in6_addr(tb[TCA_TUNNEL_KEY_ENC_IPV6_DST]);
 
-			metadata = __ipv6_tun_set_dst(&saddr, &daddr, 0, 0, 0,
-						      dst_port, TUNNEL_KEY,
+			metadata = __ipv6_tun_set_dst(&saddr, &daddr, 0, 0, dst_port,
+						      0, TUNNEL_KEY,
 						      key_id, 0);
 		}
 
-- 
2.3.7

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

* [PATCH net 2/2] net/sched: cls_flower: Mandate mask when matching on flags
  2016-12-22 12:28 [PATCH net 0/2] net/sched fixes for cls_flower and act_tunnel_key Or Gerlitz
  2016-12-22 12:28 ` [PATCH net 1/2] net/sched: act_tunnel_key: Fix setting UDP dst port in metadata under IPv6 Or Gerlitz
@ 2016-12-22 12:28 ` Or Gerlitz
  2016-12-23 17:00 ` [PATCH net 0/2] net/sched fixes for cls_flower and act_tunnel_key David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Or Gerlitz @ 2016-12-22 12:28 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Roi Dayan, Hadar Har-Zion, Or Gerlitz

When matching on flags, we should require the user to provide the
mask and avoid using an all-ones mask. Not doing so causes matching
on flags provided w.o mask to hit on the value being unset for all
flags, which may not what the user wanted to happen.

Fixes: faa3ffce7829 ('net/sched: cls_flower: Add support for matching on flags')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reported-by: Paul Blakey <paulb@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 net/sched/cls_flower.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 35ac28d..333f8e2 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -442,32 +442,32 @@ static void fl_set_key_flag(u32 flower_key, u32 flower_mask,
 	}
 }
 
-static void fl_set_key_flags(struct nlattr **tb,
-			     u32 *flags_key, u32 *flags_mask)
+static int fl_set_key_flags(struct nlattr **tb,
+			    u32 *flags_key, u32 *flags_mask)
 {
 	u32 key, mask;
 
-	if (!tb[TCA_FLOWER_KEY_FLAGS])
-		return;
+	/* mask is mandatory for flags */
+	if (!tb[TCA_FLOWER_KEY_FLAGS_MASK])
+		return -EINVAL;
 
 	key = be32_to_cpu(nla_get_u32(tb[TCA_FLOWER_KEY_FLAGS]));
-
-	if (!tb[TCA_FLOWER_KEY_FLAGS_MASK])
-		mask = ~0;
-	else
-		mask = be32_to_cpu(nla_get_u32(tb[TCA_FLOWER_KEY_FLAGS_MASK]));
+	mask = be32_to_cpu(nla_get_u32(tb[TCA_FLOWER_KEY_FLAGS_MASK]));
 
 	*flags_key  = 0;
 	*flags_mask = 0;
 
 	fl_set_key_flag(key, mask, flags_key, flags_mask,
 			TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT, FLOW_DIS_IS_FRAGMENT);
+
+	return 0;
 }
 
 static int fl_set_key(struct net *net, struct nlattr **tb,
 		      struct fl_flow_key *key, struct fl_flow_key *mask)
 {
 	__be16 ethertype;
+	int ret = 0;
 #ifdef CONFIG_NET_CLS_IND
 	if (tb[TCA_FLOWER_INDEV]) {
 		int err = tcf_change_indev(net, tb[TCA_FLOWER_INDEV]);
@@ -614,9 +614,10 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
 		       &mask->enc_tp.dst, TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK,
 		       sizeof(key->enc_tp.dst));
 
-	fl_set_key_flags(tb, &key->control.flags, &mask->control.flags);
+	if (tb[TCA_FLOWER_KEY_FLAGS])
+		ret = fl_set_key_flags(tb, &key->control.flags, &mask->control.flags);
 
-	return 0;
+	return ret;
 }
 
 static bool fl_mask_eq(struct fl_flow_mask *mask1,
-- 
2.3.7

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

* Re: [PATCH net 0/2] net/sched fixes for cls_flower and act_tunnel_key
  2016-12-22 12:28 [PATCH net 0/2] net/sched fixes for cls_flower and act_tunnel_key Or Gerlitz
  2016-12-22 12:28 ` [PATCH net 1/2] net/sched: act_tunnel_key: Fix setting UDP dst port in metadata under IPv6 Or Gerlitz
  2016-12-22 12:28 ` [PATCH net 2/2] net/sched: cls_flower: Mandate mask when matching on flags Or Gerlitz
@ 2016-12-23 17:00 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-12-23 17:00 UTC (permalink / raw)
  To: ogerlitz; +Cc: netdev, roid, hadarh

From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Thu, 22 Dec 2016 14:28:13 +0200

> This small series contain a fix to the matching flags support 
> in flower and to the tunnel key action MD prep for IPv6.

Series applied, thanks.

> On a non related note, wishing everyone around here a happy new year, 
> celebrate and take a rest so we can do lots of good patch work(s) next.

Happy new year to you as well.

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

end of thread, other threads:[~2016-12-23 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-22 12:28 [PATCH net 0/2] net/sched fixes for cls_flower and act_tunnel_key Or Gerlitz
2016-12-22 12:28 ` [PATCH net 1/2] net/sched: act_tunnel_key: Fix setting UDP dst port in metadata under IPv6 Or Gerlitz
2016-12-22 12:28 ` [PATCH net 2/2] net/sched: cls_flower: Mandate mask when matching on flags Or Gerlitz
2016-12-23 17:00 ` [PATCH net 0/2] net/sched fixes for cls_flower and act_tunnel_key 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).