diff options
| author | Lorenzo Bianconi <lorenzo.bianconi@redhat.com> | 2019-02-19 11:42:05 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2019-02-21 19:02:10 -0500 |
| commit | 2bdf700e538828d6456150b9319e5f689b062d54 (patch) | |
| tree | d01cbeb542782c1b30d14eb0f25800c04f06e656 /net/ipv4/ip_gre.c | |
| parent | 9e8db5913264d3967b93c765a6a9e464d9c473db (diff) | |
net: ip_gre: do not report erspan_ver for gre or gretap
Report erspan version field to userspace in ipgre_fill_info just for
erspan tunnels. The issue can be triggered with the following reproducer:
$ip link add name gre1 type gre local 192.168.0.1 remote 192.168.1.1
$ip link set dev gre1 up
$ip -d link sh gre1
13: gre1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1476 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/gre 192.168.0.1 peer 192.168.1.1 promiscuity 0 minmtu 0 maxmtu 0
gre remote 192.168.1.1 local 192.168.0.1 ttl inherit erspan_ver 0 addrgenmode eui64 numtxqueues 1 numrxqueues 1
Fixes: f551c91de262 ("net: erspan: introduce erspan v2 for ip_gre")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_gre.c')
| -rw-r--r-- | net/ipv4/ip_gre.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 3978f807fa8b..6ae89f2b541b 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
| @@ -1457,9 +1457,23 @@ static int ipgre_fill_info(struct sk_buff *skb, const struct net_device *dev) | |||
| 1457 | struct ip_tunnel_parm *p = &t->parms; | 1457 | struct ip_tunnel_parm *p = &t->parms; |
| 1458 | __be16 o_flags = p->o_flags; | 1458 | __be16 o_flags = p->o_flags; |
| 1459 | 1459 | ||
| 1460 | if ((t->erspan_ver == 1 || t->erspan_ver == 2) && | 1460 | if (t->erspan_ver == 1 || t->erspan_ver == 2) { |
| 1461 | !t->collect_md) | 1461 | if (!t->collect_md) |
| 1462 | o_flags |= TUNNEL_KEY; | 1462 | o_flags |= TUNNEL_KEY; |
| 1463 | |||
| 1464 | if (nla_put_u8(skb, IFLA_GRE_ERSPAN_VER, t->erspan_ver)) | ||
| 1465 | goto nla_put_failure; | ||
| 1466 | |||
| 1467 | if (t->erspan_ver == 1) { | ||
| 1468 | if (nla_put_u32(skb, IFLA_GRE_ERSPAN_INDEX, t->index)) | ||
| 1469 | goto nla_put_failure; | ||
| 1470 | } else { | ||
| 1471 | if (nla_put_u8(skb, IFLA_GRE_ERSPAN_DIR, t->dir)) | ||
| 1472 | goto nla_put_failure; | ||
| 1473 | if (nla_put_u16(skb, IFLA_GRE_ERSPAN_HWID, t->hwid)) | ||
| 1474 | goto nla_put_failure; | ||
| 1475 | } | ||
| 1476 | } | ||
| 1463 | 1477 | ||
| 1464 | if (nla_put_u32(skb, IFLA_GRE_LINK, p->link) || | 1478 | if (nla_put_u32(skb, IFLA_GRE_LINK, p->link) || |
| 1465 | nla_put_be16(skb, IFLA_GRE_IFLAGS, | 1479 | nla_put_be16(skb, IFLA_GRE_IFLAGS, |
| @@ -1495,19 +1509,6 @@ static int ipgre_fill_info(struct sk_buff *skb, const struct net_device *dev) | |||
| 1495 | goto nla_put_failure; | 1509 | goto nla_put_failure; |
| 1496 | } | 1510 | } |
| 1497 | 1511 | ||
| 1498 | if (nla_put_u8(skb, IFLA_GRE_ERSPAN_VER, t->erspan_ver)) | ||
| 1499 | goto nla_put_failure; | ||
| 1500 | |||
| 1501 | if (t->erspan_ver == 1) { | ||
| 1502 | if (nla_put_u32(skb, IFLA_GRE_ERSPAN_INDEX, t->index)) | ||
| 1503 | goto nla_put_failure; | ||
| 1504 | } else if (t->erspan_ver == 2) { | ||
| 1505 | if (nla_put_u8(skb, IFLA_GRE_ERSPAN_DIR, t->dir)) | ||
| 1506 | goto nla_put_failure; | ||
| 1507 | if (nla_put_u16(skb, IFLA_GRE_ERSPAN_HWID, t->hwid)) | ||
| 1508 | goto nla_put_failure; | ||
| 1509 | } | ||
| 1510 | |||
| 1511 | return 0; | 1512 | return 0; |
| 1512 | 1513 | ||
| 1513 | nla_put_failure: | 1514 | nla_put_failure: |
