All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Herbert <tom@herbertland.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: <kernel-team@fb.com>
Subject: [PATCH v3 net-next 03/11] gre6: Fix flag translations
Date: Fri, 6 May 2016 15:11:58 -0700	[thread overview]
Message-ID: <1462572726-566137-4-git-send-email-tom@herbertland.com> (raw)
In-Reply-To: <1462572726-566137-1-git-send-email-tom@herbertland.com>

GRE for IPv6 does not properly translate for GRE flags to tunnel
flags and vice versa. This patch fixes that.

Signed-off-by: Tom Herbert <tom@herbertland.com>
---
 net/ipv6/ip6_gre.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 47b671a..70a1f72 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -799,8 +799,8 @@ static void ip6gre_tnl_parm_from_user(struct __ip6_tnl_parm *p,
 	p->link = u->link;
 	p->i_key = u->i_key;
 	p->o_key = u->o_key;
-	p->i_flags = u->i_flags;
-	p->o_flags = u->o_flags;
+	p->i_flags = gre_flags_to_tnl_flags(u->i_flags);
+	p->o_flags = gre_flags_to_tnl_flags(u->o_flags);
 	memcpy(p->name, u->name, sizeof(u->name));
 }
 
@@ -817,8 +817,8 @@ static void ip6gre_tnl_parm_to_user(struct ip6_tnl_parm2 *u,
 	u->link = p->link;
 	u->i_key = p->i_key;
 	u->o_key = p->o_key;
-	u->i_flags = p->i_flags;
-	u->o_flags = p->o_flags;
+	u->i_flags = gre_tnl_flags_to_gre_flags(p->i_flags);
+	u->o_flags = gre_tnl_flags_to_gre_flags(p->o_flags);
 	memcpy(u->name, p->name, sizeof(u->name));
 }
 
@@ -1217,10 +1217,12 @@ static void ip6gre_netlink_parms(struct nlattr *data[],
 		parms->link = nla_get_u32(data[IFLA_GRE_LINK]);
 
 	if (data[IFLA_GRE_IFLAGS])
-		parms->i_flags = nla_get_be16(data[IFLA_GRE_IFLAGS]);
+		parms->i_flags = gre_flags_to_tnl_flags(
+				nla_get_be16(data[IFLA_GRE_IFLAGS]));
 
 	if (data[IFLA_GRE_OFLAGS])
-		parms->o_flags = nla_get_be16(data[IFLA_GRE_OFLAGS]);
+		parms->o_flags = gre_flags_to_tnl_flags(
+				nla_get_be16(data[IFLA_GRE_OFLAGS]));
 
 	if (data[IFLA_GRE_IKEY])
 		parms->i_key = nla_get_be32(data[IFLA_GRE_IKEY]);
@@ -1412,8 +1414,10 @@ static int ip6gre_fill_info(struct sk_buff *skb, const struct net_device *dev)
 	struct __ip6_tnl_parm *p = &t->parms;
 
 	if (nla_put_u32(skb, IFLA_GRE_LINK, p->link) ||
-	    nla_put_be16(skb, IFLA_GRE_IFLAGS, p->i_flags) ||
-	    nla_put_be16(skb, IFLA_GRE_OFLAGS, p->o_flags) ||
+	    nla_put_be16(skb, IFLA_GRE_IFLAGS,
+			 gre_tnl_flags_to_gre_flags(p->i_flags)) ||
+	    nla_put_be16(skb, IFLA_GRE_OFLAGS,
+			 gre_tnl_flags_to_gre_flags(p->o_flags)) ||
 	    nla_put_be32(skb, IFLA_GRE_IKEY, p->i_key) ||
 	    nla_put_be32(skb, IFLA_GRE_OKEY, p->o_key) ||
 	    nla_put_in6_addr(skb, IFLA_GRE_LOCAL, &p->laddr) ||
-- 
2.8.0.rc2

  parent reply	other threads:[~2016-05-06 22:12 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 22:11 [PATCH v3 net-next 00/11] ipv6: Enable GUEoIPv6 and more fixes for v6 tunneling Tom Herbert
2016-05-06 22:11 ` [PATCH v3 net-next 01/11] gso: Remove arbitrary checks for unsupported GSO Tom Herbert
2016-05-06 22:34   ` Alexander Duyck
2016-05-07  2:44   ` Alexander Duyck
2016-05-06 22:11 ` [PATCH v3 net-next 02/11] net: define gso types for IPx over IPv4 and IPv6 Tom Herbert
2016-05-06 22:48   ` Alexander Duyck
2016-05-06 22:55     ` Tom Herbert
2016-05-06 22:11 ` Tom Herbert [this message]
2016-05-06 22:11 ` [PATCH v3 net-next 04/11] fou: Call setup_udp_tunnel_sock Tom Herbert
2016-05-06 22:12 ` [PATCH v3 net-next 05/11] fou: Split out {fou,gue}_build_header Tom Herbert
2016-05-06 22:12 ` [PATCH v3 net-next 06/11] fou: Add encap ops for IPv6 tunnels Tom Herbert
2016-05-06 22:12 ` [PATCH v3 net-next 07/11] ipv6: Fix nexthdr for reinjection Tom Herbert
2016-05-06 22:12 ` [PATCH v3 net-next 08/11] ipv6: Change "final" protocol processing for encapsulation Tom Herbert
2016-05-06 22:12 ` [PATCH v3 net-next 09/11] fou: Support IPv6 in fou Tom Herbert
2016-05-06 22:12 ` [PATCH v3 net-next 10/11] ip6_tun: Add infrastructure for doing encapsulation Tom Herbert
2016-05-06 22:12 ` [PATCH v3 net-next 11/11] ip6_gre: Add support for fou/gue encapsulation Tom Herbert
2016-05-07  1:09 ` [PATCH v3 net-next 00/11] ipv6: Enable GUEoIPv6 and more fixes for v6 tunneling Alexander Duyck
2016-05-07  1:57   ` Tom Herbert
2016-05-07  2:03     ` Alexander Duyck
2016-05-07  2:11       ` Tom Herbert
2016-05-07  3:03         ` Alexander Duyck
2016-05-09 16:56           ` Tom Herbert
2016-05-09 17:32             ` Alexander Duyck
2016-05-09 21:35               ` Alexander Duyck
2016-05-09 21:37                 ` Tom Herbert
2016-05-09 22:32                   ` Alexander Duyck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462572726-566137-4-git-send-email-tom@herbertland.com \
    --to=tom@herbertland.com \
    --cc=davem@davemloft.net \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.