]> asedeno.scripts.mit.edu Git - linux.git/commit
net: ip_gre: always reports o_key to userspace
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Mon, 28 Jan 2019 21:23:48 +0000 (22:23 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 30 Jan 2019 22:00:02 +0000 (14:00 -0800)
commitfeaf5c796b3f0240f10d0d6d0b686715fd58a05b
treee8868e00fc33050a9a4e7a7cc6d4548dc1a3dda0
parente15aa3b2b1388c399c1a2ce08550d2cc4f7e3e14
net: ip_gre: always reports o_key to userspace

Erspan protocol (version 1 and 2) relies on o_key to configure
session id header field. However TUNNEL_KEY bit is cleared in
erspan_xmit since ERSPAN protocol does not set the key field
of the external GRE header and so the configured o_key is not reported
to userspace. The issue can be triggered with the following reproducer:

$ip link add erspan1 type erspan local 192.168.0.1 remote 192.168.0.2 \
    key 1 seq erspan_ver 1
$ip link set erspan1 up
$ip -d link sh erspan1

erspan1@NONE: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc pfifo_fast state UNKNOWN mode DEFAULT
  link/ether 52:aa:99:95:9a:b5 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 1500
  erspan remote 192.168.0.2 local 192.168.0.1 ttl inherit ikey 0.0.0.1 iseq oseq erspan_index 0

Fix the issue adding TUNNEL_KEY bit to the o_flags parameter in
ipgre_fill_info

Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_gre.c