ip_tunnel: use a separate struct to store tunnel params in the kernel
authorAlexander Lobakin <aleksander.lobakin@intel.com>
Wed, 27 Mar 2024 15:23:52 +0000 (16:23 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 Apr 2024 09:49:28 +0000 (10:49 +0100)
commit117aef12a7b1b797bce9f66b156c65eab850b5b5
tree8f5186e9ab168c13efd543f98933afa7b4cf26ec
parent7adaf37f7f104a7ee5f150af491674ccbbfc4114
ip_tunnel: use a separate struct to store tunnel params in the kernel

Unlike IPv6 tunnels which use purely-kernel __ip6_tnl_parm structure
to store params inside the kernel, IPv4 tunnel code uses the same
ip_tunnel_parm which is being used to talk with the userspace.
This makes it difficult to alter or add any fields or use a
different format for whatever data.
Define struct ip_tunnel_parm_kern, a 1:1 copy of ip_tunnel_parm for
now, and use it throughout the code. Define the pieces, where the copy
user <-> kernel happens, as standalone functions, and copy the data
there field-by-field, so that the kernel-side structure could be easily
modified later on and the users wouldn't have to care about this.

Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 files changed:
drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c
include/linux/netdevice.h
include/net/ip_tunnels.h
net/ipv4/ip_gre.c
net/ipv4/ip_tunnel.c
net/ipv4/ip_tunnel_core.c
net/ipv4/ip_vti.c
net/ipv4/ipip.c
net/ipv4/ipmr.c
net/ipv6/addrconf.c
net/ipv6/sit.c