GRE: Refactor GRE tunneling code.
Subsystems (4)
PATCH v2 1/5 GRE: Refactor GRE tunneling code.
Following patch refactors GRE code into ip tunneling code and GRE specific code. Common tunneling code is moved to ip_tunnel module. ip_tunnel module is written as generic library which can be used by different tunneling implementations.
ip_tunnel module contains following components:
- packet xmit and rcv generic code. xmit flow looks like (gre_xmit/ipip_xmit)->ip_tunnel_xmit->ip_local_out.
- hash table of all devices.
- lookup for tunnel devices.
- control plane operations like device create, destroy, ioctl, netlink operations code.
- registration for tunneling modules, like gre, ipip etc.
- define single pcpu_tstats dev->tstats.
- struct tnl_ptk_info added to pass parsed tunnel packet parameters.
ipip.h header is renamed to ip_tunnel.h
--- drivers/net/vxlan.c | 2 +- include/net/gre.h | 51 ++ include/net/ip_tunnels.h | 169 ++++++ include/net/ipip.h | 88 --- net/ipv4/Kconfig | 5 + net/ipv4/Makefile | 1 + net/ipv4/af_inet.c | 1 - net/ipv4/gre.c | 5 - net/ipv4/ip_gre.c | 1501 ++++++++++------------------------------------ net/ipv4/ip_tunnel.c | 1035 ++++++++++++++++++++++++++++++++ net/ipv4/ip_vti.c | 2 +- net/ipv4/ipip.c | 2 +- net/ipv4/ipmr.c | 2 +- net/ipv6/af_inet6.c | 1 - net/ipv6/ip6_gre.c | 1 + net/ipv6/ip6_tunnel.c | 1 + net/ipv6/sit.c | 2 +- 17 files changed, 1580 insertions(+), 1289 deletions(-) create mode 100644 include/net/ip_tunnels.h delete mode 100644 include/net/ipip.h create mode 100644 net/ipv4/ip_tunnel.c
drivers/net/vxlan.c +1 -1
@@ -33,7 +33,7 @@#include <net/arp.h> #include <net/ndisc.h> #include <net/ip.h> -#include <net/ipip.h> +#include <net/ip_tunnels.h> #include <net/icmp.h> #include <net/udp.h> #include <net/rtnetlink.h>
include/net/gre.h +51 -0
64 lines not on this page · raw message
include/net/ip_tunnels.h new file +169 -0
169 lines not on this page · raw message
include/net/ipip.h deleted +0 -88
88 lines not on this page · raw message
net/ipv4/Kconfig +5 -0
@@ -186,9 +186,14 @@ config NET_IPGRE_DEMUX This is helper module to demultiplex GRE packets on GRE version field criteria. Required by ip_gre and pptp modules. +config NET_IP_TUNNEL + tristate + default n + config NET_IPGRE tristate "IP: GRE tunnels over IP" depends on (IPV6 || IPV6=n) && NET_IPGRE_DEMUX + select NET_IP_TUNNEL help Tunneling means encapsulating data of one protocol type within another protocol and sending it over a channel that understands the
net/ipv4/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-y := route.o inetpeer.o protocol.o \ fib_frontend.o fib_semantics.o fib_trie.o \ inet_fragment.o ping.o +obj-$(CONFIG_NET_IP_TUNNEL) += ip_tunnel.o obj-$(CONFIG_SYSCTL) += sysctl_net_ipv4.o obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o
net/ipv4/af_inet.c +0 -1
@@ -111,7 +111,6 @@#include <net/sock.h> #include <net/raw.h> #include <net/icmp.h> -#include <net/ipip.h> #include <net/inet_common.h> #include <net/xfrm.h> #include <net/net_namespace.h>
net/ipv4/gre.c +0 -5
@@ -27,11 +27,6 @@static const struct gre_protocol __rcu *gre_proto[GREPROTO_MAX ]__read_mostly ;static DEFINE_SPINLOCK (gre_proto_lock); -struct gre_base_hdr { -__be16 flags; -__be16 protocol; -}; -#define GRE_HEADER_SECTION 4int gre_add_protocol (const struct gre_protocol *proto,u8 version) {
net/ipv4/ip_gre.c +312 -1189
1,805 lines not on this page · raw message
net/ipv4/ip_tunnel.c new file +1035 -0
827 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.1
Part of the diff is not shown here. View the raw message.
David Miller
maintainerFrom: Pravin B Shelar <[email protected]>
Date: Mon, 18 Mar 2013 11:13:25 -0700
Quoted 1 line
+EXPORT_SYMBOL(ip_tunnel_get_stats64);
EXPORT_SYMBOL_GPL() please.
David Miller
maintainerFrom: David Miller <[email protected]>
Date: Mon, 18 Mar 2013 15:23:37 -0400 (EDT)
Quoted 6 lines
From: Pravin B Shelar <[email protected]>
Date: Mon, 18 Mar 2013 11:13:25 -0700Quoted 1 line
+EXPORT_SYMBOL(ip_tunnel_get_stats64);
EXPORT_SYMBOL_GPL()please.
In case it isn't clear, I want you to use GPL exports for all of the symbols exported from the new library.
Thanks.
net/ipv4/Kconfig config NET_IPGRE_DEMUX · line 192
Quoted 12 lines · On Mon, 18 Mar 2013 11:13:25 -0700 Pravin B Shelar <[email protected]> wrote:
net/ipv4/Kconfig +4
-0@@ -186,9 +186,14 @@ config NET_IPGRE_DEMUX This is helper module to demultiplex GRE packets on GRE version field criteria. Required by ip_gre and pptp modules. +config NET_IP_TUNNEL + tristate + default n +
Won't this break existing kernel config's, shouldn't this default y?
David Miller
maintainerFrom: Stephen Hemminger <[email protected]>
Date: Mon, 18 Mar 2013 12:24:09 -0700
Quoted 11 lines
Quoted 8 lines · On Mon, 18 Mar 2013 11:13:25 -0700 Pravin B Shelar <[email protected]> wrote:
net/ipv4/Kconfig +0
-0@@ -186,9 +186,14 @@ config NET_IPGRE_DEMUX This is helper module to demultiplex GRE packets on GRE version field criteria. Required by ip_gre and pptp modules.
Quoted 6 lines
net/ipv4/Kconfig config NET_IPGRE_DEMUX · line 192
Quoted 4 lines
net/ipv4/Kconfig +4
-0+config NET_IP_TUNNEL + tristate + default n +Won't this break existing kernel config's, shouldn't this default y?
Or "m". But indeed, it should be made to automatically work for existing configs.
Quoted 21 lines · David Miller
From: Stephen Hemminger <[email protected]>
Date: Mon, 18 Mar 2013 12:24:09 -0700Quoted 11 lines
Quoted 8 lines · On Mon, 18 Mar 2013 11:13:25 -0700 Pravin B Shelar <[email protected]> wrote:
net/ipv4/Kconfig +0
-0@@ -186,9 +186,14 @@ config NET_IPGRE_DEMUX This is helper module to demultiplex GRE packets on GRE version field criteria. Required by ip_gre and pptp modules.Quoted 6 lines
net/ipv4/Kconfig config NET_IPGRE_DEMUX · line 192
Quoted 4 lines
net/ipv4/Kconfig +4
-0+config NET_IP_TUNNEL + tristate + default n +Won't this break existing kernel config's, shouldn't this default y?
Quoted 2 lines
Or "m". But indeed, it should be made to automatically work for existing configs.
ok,
I will post updated patch.
Thanks.
Quoted 19 lines · David Miller
From: Stephen Hemminger <[email protected]>
Quoted 11 lines
Quoted 8 lines · On Mon, 18 Mar 2013 11:13:25 -0700 Pravin B Shelar <[email protected]> wrote:
net/ipv4/Kconfig +0
-0@@ -186,9 +186,14 @@ config NET_IPGRE_DEMUX This is helper module to demultiplex GRE packets on GRE version field criteria. Required by ip_gre and pptp modules.Quoted 6 lines
net/ipv4/Kconfig config NET_IPGRE_DEMUX · line 192
Quoted 4 lines
net/ipv4/Kconfig +4
-0+config NET_IP_TUNNEL + tristate + default n +Won't this break existing kernel config's, shouldn't this default y?
Quoted 2 lines
Or "m". But indeed, it should be made to automatically work for existing configs.
Won't the "select NET_IP_TUNNEL" statements do just that?
Changing the default to m will enable this module even if all of NET_IPGRE, VXLAN and NET_IPIP are disabled. That's pointless, isn't it?
Bjørn
Quoted 20 lines · On Tue, 19 Mar 2013 11:31:30 +0100 Bjørn Mork <[email protected]> wrote:
Quoted 19 lines · David Miller
From: Stephen Hemminger <[email protected]>
Quoted 17 lines
net/ipv4/Kconfig config NET_IPGRE_DEMUX · line 192
Quoted 12 lines · On Mon, 18 Mar 2013 11:13:25 -0700 Pravin B Shelar <[email protected]> wrote:
net/ipv4/Kconfig +4
-0@@ -186,9 +186,14 @@ config NET_IPGRE_DEMUX This is helper module to demultiplex GRE packets on GRE version field criteria. Required by ip_gre and pptp modules. +config NET_IP_TUNNEL + tristate + default n +Won't this break existing kernel config's, shouldn't this default y?
Quoted 7 lines
Quoted 2 lines
Or "m". But indeed, it should be made to automatically work for existing configs.
Won't the "select
NET_IP_TUNNEL" statements do just that?Changing the default to m will enable this module even if all of
NET_IPGRE, VXLAN andNET_IPIPare disabled. That's pointless, isn't it?
Looks like you are right, just tried a number of different kernel configs with 'make oldconfig' and it picks up the dependency correctly.
Quoted 16 lines · On Mon, 18 Mar 2013 11:13:25 -0700 Pravin B Shelar <[email protected]> wrote:
Following patch refactors GRE code into ip tunneling code and GRE specific code. Common tunneling code is moved to
ip_tunnelmodule.ip_tunnelmodule is written as generic library which can be used by different tunneling implementations.
ip_tunnelmodule contains following components:
- packet xmit and rcv generic code. xmit flow looks like (gre_xmit/ipip_xmit)->ip_tunnel_xmit->ip_local_out.
- hash table of all devices.
- lookup for tunnel devices.
- control plane operations like device create, destroy, ioctl, netlink operations code.
- registration for tunneling modules, like gre, ipip etc.
- define singlepcpu_tstatsdev->tstats.
- structtnl_ptk_infoadded to pass parsed tunnel packet parameters.
Quoted 3 lines
ipip.hheader is renamed toip_tunnel.hSigned-off-by Pravin B Shelar <[email protected]>
Doesn't build with this patch alone (ie. not bisectable).
CC [M] net/ipv6/ip6_gre.onet/ipv6/ip6_gre.c:41:27: fatal error: net/ip_tunnel.h: No such file or directory compilation terminated.
David Miller
maintainerFrom: Stephen Hemminger <[email protected]>
Date: Tue, 19 Mar 2013 14:21:41 -0700
Quoted 5 lines
Doesn't build with this patch alone (ie. not bisectable).
CC [M]
net/ipv6/ip6_gre.onet/ipv6/ip6_gre.c:41:27: fatal error:net/ip_tunnel.h: No such file or directory compilation terminated.
Oh well, too late, it's all already in my tree.
Quoted 10 lines · David Miller
From: Stephen Hemminger <[email protected]>
Date: Tue, 19 Mar 2013 14:21:41 -0700Quoted 5 lines
Doesn't build with this patch alone (ie. not bisectable).
CC [M]
net/ipv6/ip6_gre.onet/ipv6/ip6_gre.c:41:27: fatal error:net/ip_tunnel.h: No such file or directory compilation terminated.Oh well, too late, it's all already in my tree.
sorry about that.
I am sending update patch soon.
David Miller
maintainerFrom: Pravin Shelar <[email protected]>
Date: Tue, 19 Mar 2013 14:38:11 -0700
Quoted 6 lines · David Miller
Quoted 5 lines
From: Stephen Hemminger <[email protected]>
Date: Tue, 19 Mar 2013 14:21:41 -0700Quoted 2 lines
Doesn't build with this patch alone (ie. not bisectable).
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
CC [M]
net/ipv6/ip6_gre.onet/ipv6/ip6_gre.c:41:27: fatal error:net/ip_tunnel.h: No such file or directory compilation terminated.Oh well, too late, it's all already in my tree.
sorry about that.
I am sending update patch soon.
There is nothing for you to send, what's in my tree is not changing.
Quoted 13 lines · David Miller
From: Pravin Shelar <[email protected]>
Date: Tue, 19 Mar 2013 14:38:11 -0700Quoted 10 lines · David Miller
Quoted 9 lines
From: Stephen Hemminger <[email protected]>
Date: Tue, 19 Mar 2013 14:21:41 -0700Quoted 5 lines
Doesn't build with this patch alone (ie. not bisectable).
CC [M]
net/ipv6/ip6_gre.onet/ipv6/ip6_gre.c:41:27: fatal error:net/ip_tunnel.h: No such file or directory compilation terminated.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Oh well, too late, it's all already in my tree.
sorry about that.
I am sending update patch soon.There is nothing for you to send, what's in my tree is not changing.
I do not see these patches in net-next and now there are few conflicts due GRE commits.
Do you want me to send updated patches against latest net-next?
David Miller
maintainerFrom: Pravin Shelar <[email protected]>
Date: Mon, 25 Mar 2013 12:30:46 -0700
Quoted 16 lines · David Miller
Quoted 15 lines
From: Pravin Shelar <[email protected]>
Date: Tue, 19 Mar 2013 14:38:11 -0700Quoted 12 lines · David Miller
Quoted 10 lines
From: Stephen Hemminger <[email protected]>
Date: Tue, 19 Mar 2013 14:21:41 -0700Quoted 5 lines
Doesn't build with this patch alone (ie. not bisectable).
CC [M]
net/ipv6/ip6_gre.onet/ipv6/ip6_gre.c:41:27: fatal error:net/ip_tunnel.h: No such file or directory compilation terminated.Oh well, too late, it's all already in my tree.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
sorry about that.
I am sending update patch soon.There is nothing for you to send, what's in my tree is not changing.
I do not see these patches in net-next and now there are few conflicts due GRE commits.
Do you want me to send updated patches against latest net-next?
You need to send whatever relative fixes are necessary.
David Miller
maintainerFrom: David Miller <[email protected]>
Date: Mon, 25 Mar 2013 15:39:34 -0400 (EDT)
Quoted 22 lines
From: Pravin Shelar <[email protected]>
Date: Mon, 25 Mar 2013 12:30:46 -0700Quoted 19 lines · David Miller
Quoted 18 lines
From: Pravin Shelar <[email protected]>
Date: Tue, 19 Mar 2013 14:38:11 -0700Quoted 14 lines · David Miller
Quoted 10 lines
From: Stephen Hemminger <[email protected]>
Date: Tue, 19 Mar 2013 14:21:41 -0700Quoted 5 lines
Doesn't build with this patch alone (ie. not bisectable).
CC [M]
net/ipv6/ip6_gre.onet/ipv6/ip6_gre.c:41:27: fatal error:net/ip_tunnel.h: No such file or directory compilation terminated.Oh well, too late, it's all already in my tree.
sorry about that.
I am sending update patch soon.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
There is nothing for you to send, what's in my tree is not changing.
I do not see these patches in net-next and now there are few conflicts due GRE commits.
Do you want me to send updated patches against latest net-next?You need to send whatever relative fixes are necessary.
Actually I see where the confusion is.
I thought I had applied v3 of this series, looks like I didn't, so yes you should respin this fixing the build problems Stephen pointed out.
Thanks.