Skip to content

net: add support for ip_tun_info options setting

Xin Long netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 5 repliesIn review
  2. v16 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- no change, net-next reopened.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6lwtunnel: add options process for arp requestnet/ipv4/ip_tunnel_core.c+4 -30 replies
2/6lwtunnel: add LWTUNNEL_IP_OPTS support for lwtunnel_ipinclude/uapi/linux/lwtunnel.h net/ipv4/ip_tunnel_core.c+25 -65 replies
3/6lwtunnel: add LWTUNNEL_IP6_OPTS support for lwtunnel_ip6include/uapi/linux/lwtunnel.h net/ipv4/ip_tunnel_core.c+19 -40 replies
4/6vxlan: check tun_info options_len properlydrivers/net/vxlan.c+4 -20 replies
5/6erspan: fix the tun_info options_len checknet/ipv4/ip_gre.c net/ipv6/ip6_gre.c+4 -40 replies
6/6erspan: make md work without TUNNEL_ERSPAN_OPT setnet/ipv4/ip_gre.c net/ipv6/ip6_gre.c+32 -340 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCHv2 net-next 0/6] net: add support for ip_tun_info options setting

With this patchset, users can configure options with LWTUNNEL_IP(6)_OPTS by ip route encap for ersapn or vxlan lwtunnel. Note that in kernel part it won't parse the option details but do some check and memcpy only, and the options will be parsed by iproute in userspace.

We also improve the vxlan and erspan options processing in this patchset.

As an example I also wrote a patch for iproute2 (see v1), with it we can add options for erspan lwtunnel like:

   # ip net a a; ip net a b
   # ip -n a l a eth0 type veth peer name eth0 netns b
   # ip -n a l s eth0 up; ip -n b link set eth0 up
   # ip -n a a a 10.1.0.1/24 dev eth0; ip -n b a a 10.1.0.2/24 dev eth0
   # ip -n b l a erspan1 type erspan key 1 seq erspan 123 \
        local 10.1.0.2 remote 10.1.0.1
   # ip -n b a a 1.1.1.1/24 dev erspan1; ip -n b l s erspan1 up
   # ip -n b r a 2.1.1.0/24 dev erspan1
   # ip -n a l a erspan1 type erspan key 1 seq local 10.1.0.1 external
   # ip -n a a a 2.1.1.1/24 dev erspan1; ip -n a l s erspan1 up
   # ip -n a r a 1.1.1.0/24 encap ip id 1 erspan ver 1 idx 123 \
        dst 10.1.0.2 dev erspan1
   # ip -n a r s; ip net exec a ping 1.1.1.1 -c 1

v1->v2:
- no change, net-next reopened.

Xin Long (6):
lwtunnel: add options process for arp request
lwtunnel: add LWTUNNEL_IP_OPTS support for lwtunnel_ip
lwtunnel: add LWTUNNEL_IP6_OPTS support for lwtunnel_ip6
vxlan: check tun_info options_len properly
erspan: fix the tun_info options_len check
erspan: make md work without TUNNEL_ERSPAN_OPT set

 drivers/net/vxlan.c           |  6 +++--
 include/uapi/linux/lwtunnel.h |  2 ++
 net/ipv4/ip_gre.c             | 31 ++++++++++-------------
 net/ipv4/ip_tunnel_core.c     | 59 +++++++++++++++++++++++++++++++++----------
 net/ipv6/ip6_gre.c            | 35 +++++++++++++------------
 5 files changed, 84 insertions(+), 49 deletions(-)
Signature · 1 line
2.1.0