]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: ip_gre: Separate ERSPAN newlink / changelink callbacks
authorPetr Machata <petrm@mellanox.com>
Fri, 13 Mar 2020 11:39:36 +0000 (13:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2020 08:59:52 +0000 (10:59 +0200)
commit8df09014b062b8f2c3ef4c601d798c9980798790
treee07b14c1217f1ecf0afed4b7ad09d9dea2492cb1
parent5d10e0ef0090885ad5850f09d87addf61b377e11
net: ip_gre: Separate ERSPAN newlink / changelink callbacks

[ Upstream commit e1f8f78ffe9854308b9e12a73ebe4e909074fc33 ]

ERSPAN shares most of the code path with GRE and gretap code. While that
helps keep the code compact, it is also error prone. Currently a broken
userspace can turn a gretap tunnel into a de facto ERSPAN one by passing
IFLA_GRE_ERSPAN_VER. There has been a similar issue in ip6gretap in the
past.

To prevent these problems in future, split the newlink and changelink code
paths. Split the ERSPAN code out of ipgre_netlink_parms() into a new
function erspan_netlink_parms(). Extract a piece of common logic from
ipgre_newlink() and ipgre_changelink() into ipgre_newlink_encap_setup().
Add erspan_newlink() and erspan_changelink().

Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/ip_gre.c