Skip to content

Commit f41fe3c

Browse files
tomratbertdavem330
authored andcommitted
gre6: Fix flag translations
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent db2ec95 commit f41fe3c

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

net/ipv6/ip6_gre.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -795,8 +795,8 @@ static void ip6gre_tnl_parm_from_user(struct __ip6_tnl_parm *p,
795795
p->link = u->link;
796796
p->i_key = u->i_key;
797797
p->o_key = u->o_key;
798-
p->i_flags = u->i_flags;
799-
p->o_flags = u->o_flags;
798+
p->i_flags = gre_flags_to_tnl_flags(u->i_flags);
799+
p->o_flags = gre_flags_to_tnl_flags(u->o_flags);
800800
memcpy(p->name, u->name, sizeof(u->name));
801801
}
802802

@@ -813,8 +813,8 @@ static void ip6gre_tnl_parm_to_user(struct ip6_tnl_parm2 *u,
813813
u->link = p->link;
814814
u->i_key = p->i_key;
815815
u->o_key = p->o_key;
816-
u->i_flags = p->i_flags;
817-
u->o_flags = p->o_flags;
816+
u->i_flags = gre_tnl_flags_to_gre_flags(p->i_flags);
817+
u->o_flags = gre_tnl_flags_to_gre_flags(p->o_flags);
818818
memcpy(u->name, p->name, sizeof(u->name));
819819
}
820820

@@ -1214,10 +1214,12 @@ static void ip6gre_netlink_parms(struct nlattr *data[],
12141214
parms->link = nla_get_u32(data[IFLA_GRE_LINK]);
12151215

12161216
if (data[IFLA_GRE_IFLAGS])
1217-
parms->i_flags = nla_get_be16(data[IFLA_GRE_IFLAGS]);
1217+
parms->i_flags = gre_flags_to_tnl_flags(
1218+
nla_get_be16(data[IFLA_GRE_IFLAGS]));
12181219

12191220
if (data[IFLA_GRE_OFLAGS])
1220-
parms->o_flags = nla_get_be16(data[IFLA_GRE_OFLAGS]);
1221+
parms->o_flags = gre_flags_to_tnl_flags(
1222+
nla_get_be16(data[IFLA_GRE_OFLAGS]));
12211223

12221224
if (data[IFLA_GRE_IKEY])
12231225
parms->i_key = nla_get_be32(data[IFLA_GRE_IKEY]);
@@ -1409,8 +1411,10 @@ static int ip6gre_fill_info(struct sk_buff *skb, const struct net_device *dev)
14091411
struct __ip6_tnl_parm *p = &t->parms;
14101412

14111413
if (nla_put_u32(skb, IFLA_GRE_LINK, p->link) ||
1412-
nla_put_be16(skb, IFLA_GRE_IFLAGS, p->i_flags) ||
1413-
nla_put_be16(skb, IFLA_GRE_OFLAGS, p->o_flags) ||
1414+
nla_put_be16(skb, IFLA_GRE_IFLAGS,
1415+
gre_tnl_flags_to_gre_flags(p->i_flags)) ||
1416+
nla_put_be16(skb, IFLA_GRE_OFLAGS,
1417+
gre_tnl_flags_to_gre_flags(p->o_flags)) ||
14141418
nla_put_be32(skb, IFLA_GRE_IKEY, p->i_key) ||
14151419
nla_put_be32(skb, IFLA_GRE_OKEY, p->o_key) ||
14161420
nla_put_in6_addr(skb, IFLA_GRE_LOCAL, &p->laddr) ||

0 commit comments

Comments
 (0)