netpoll: add IPv6 support
Subsystems (5)
v3 cover netpoll: add IPv6 support
(Resend with a cover letter)
v3: fix CONFIG_IPV6=m case
v2: use bool for ipv6 flag
fix !CONFIG_IPV6 case
This patchset implements netpoll over IPv6.
Cong Wang (3)
netconsole: add IPv6 example in doc
netpoll: add IPv6 support
netpoll: prepare for ipv6
Documentation/networking/netconsole.txt | 7 +- drivers/net/Kconfig | 5 + drivers/net/netconsole.c | 44 ++- include/linux/netpoll.h | 13 +- include/net/udp.h | 2 + net/core/netpoll.c | 629 ++++++++++++++++++++++--------- net/ipv6/udp.c | 3 +- 7 files changed, 518 insertions(+), 185 deletions(-)
PATCH v3 1/3 netpoll: prepare for ipv6
From: Cong Wang <[email protected]>
This patch adjusts some struct and functions, to prepare for supporting IPv6.
--- drivers/net/netconsole.c | 12 +- include/linux/netpoll.h | 13 ++- net/core/netpoll.c | 402 ++++++++++++++++++++++++++-------------------- 3 files changed, 243 insertions(+), 184 deletions(-)
drivers/net/netconsole.c +8 -4
@@ -269,12 +269,14 @@ static ssize_t show_remote_port(struct netconsole_target *nt, char *buf)static ssize_t show_local_ip (struct netconsole_target *nt,char *buf) { -return snprintf (buf,PAGE_SIZE ,"%pI4\n" , &nt->np.local_ip); +if (!nt->np.ipv6) +return snprintf (buf,PAGE_SIZE ,"%pI4\n" , &nt->np.local_ip); }static ssize_t show_remote_ip (struct netconsole_target *nt,char *buf) { -return snprintf (buf,PAGE_SIZE ,"%pI4\n" , &nt->np.remote_ip); +if (!nt->np.ipv6) +return snprintf (buf,PAGE_SIZE ,"%pI4\n" , &nt->np.remote_ip); }static ssize_t show_local_mac (struct netconsole_target *nt,char *buf)
@@ -410,7 +412,8 @@ static ssize_t store_local_ip(struct netconsole_target *nt,return -EINVAL ; } - nt->np.local_ip =in_aton (buf); +if (!strnchr (buf, count,':' )) + nt->np.local_ip.ip =in_aton (buf);return strnlen (buf, count); }
@@ -426,7 +429,8 @@ static ssize_t store_remote_ip(struct netconsole_target *nt,return -EINVAL ; } - nt->np.remote_ip =in_aton (buf); +if (!strnchr (buf, count,':' )) + nt->np.remote_ip.ip =in_aton (buf);return strnlen (buf, count); }
include/linux/netpoll.h +11 -2
@@ -12,13 +12,22 @@#include <linux/rcupdate.h> #include <linux/list.h> +union inet_addr { +__u32 all[4 ]; +__be32 ip; +__be32 ip6[4 ]; +struct in_addr in; +struct in6_addr in6; +}; +struct netpoll {struct net_device *dev;char dev_name[IFNAMSIZ ];const char *name;void (*rx_hook)(struct netpoll *,int ,char *,int ); -__be32 local_ip, remote_ip; +union inet_addr local_ip, remote_ip; +bool ipv6;u16 local_port, remote_port;u8 remote_mac[ETH_ALEN ];
@@ -33,7 +42,7 @@ struct netpoll_info {spinlock_t rx_lock;struct list_head rx_np;/* netpolls that registered an rx_hook */ -struct sk_buff_head arp_tx;/* list of arp requests to reply to */ +struct sk_buff_head neigh_tx;/* list of neigh requests to reply to */ struct sk_buff_head txq;struct delayed_work tx_work;
net/core/netpoll.c +224 -178
540 lines not on this page · raw message
Signature · 1 line
1.7.7.6
PATCH v3 2/3 netpoll: add IPv6 support
In reply to Cong WangFrom: Cong Wang <[email protected]>
Currently, netpoll only supports IPv4. This patch adds IPv6 support to netpoll so that we can run netconsole over IPv6 network.
--- drivers/net/Kconfig | 5 + drivers/net/netconsole.c | 44 +++++++- include/net/udp.h | 2 + net/core/netpoll.c | 253 ++++++++++++++++++++++++++++++++++++++++++++-- net/ipv6/udp.c | 3 +- 5 files changed, 288 insertions(+), 19 deletions(-)
drivers/net/Kconfig +5 -0
@@ -181,6 +181,11 @@ config NETCONSOLE_DYNAMIC config NETPOLL def_bool NETCONSOLE +config NETPOLL_IPV6 + bool "Netpoll over IPv6 support" + depends on IPV6=y + depends on NETPOLL + config NETPOLL_TRAP bool "Netpoll traffic trapping" default n
drivers/net/netconsole.c +38 -6
67 lines not on this page · raw message
include/net/udp.h +2 -0
@@ -156,6 +156,8 @@ static inline __wsum udp_csum(struct sk_buff *skb)return csum; } +extern int udp6_csum_init (struct sk_buff *skb,struct udphdr *uh,int proto); +/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ static inline void udp_lib_hash (struct sock *sk) {
net/core/netpoll.c +242 -11
333 lines not on this page · raw message
net/ipv6/udp.c +1 -2
@@ -752,8 +752,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,return 0 ; } -static inline int udp6_csum_init (struct sk_buff *skb,struct udphdr *uh, -int proto) +int udp6_csum_init (struct sk_buff *skb,struct udphdr *uh,int proto) {int err;
Signature · 1 line
1.7.7.6
PATCH v3 3/3 netconsole: add IPv6 example in doc
In reply to Cong WangFrom: Cong Wang <[email protected]>
Update the netconsole document as well.
--- Documentation/networking/netconsole.txt | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
Documentation/networking/netconsole.txt +6 -1
@@ -1,9 +1,10 @@ started by Ingo Molnar <[email protected]>, 2001.09.17 2.6 port and netpoll api by Matt Mackall <[email protected]>, Sep 9 2003 +IPv6 support by Cong Wang <[email protected]>, Jan 1 2013 Please send bug reports to Matt Mackall <[email protected]> -and Satyam Sharma <[email protected]> +Satyam Sharma <[email protected]>, and Cong Wang <[email protected]> Introduction: =============
@@ -41,6 +42,10 @@ Examples: insmod netconsole netconsole=@/,@10.0.0.2/ + or using IPv6 + + insmod netconsole netconsole=@/,@fd00:1:2:3::1/ + It also supports logging to multiple remote agents by specifying parameters for the multiple agents separated by semicolons and the complete string enclosed in "quotes", thusly:
Signature · 1 line
1.7.7.6
David Miller
maintainerFrom: Cong Wang <[email protected]>
Date: Fri, 4 Jan 2013 11:14:30 +0800
Quoted 8 lines
(Resend with a cover letter)
v3: fix
CONFIG_IPV6=mcasev2: use bool for ipv6 flag
fix !CONFIG_IPV6 caseThis patchset implements netpoll over IPv6.
Thanks for submitting this properly.
But disallowing ipv6 netpoll support when IPV6=m is an unacceptable limitation, compiling IPV6 as a module is common and in fact recommended.
We've solved problems like this before, by putting the needed ipv6 routines into a seperate library that is built statically into the kernel when necessary.
You should use a similar approach here.
Thanks.
Quoted 18 lines · David Miller
From: Cong Wang <[email protected]>
Date: Fri, 4 Jan 2013 11:14:30 +0800Quoted 8 lines
(Resend with a cover letter)
v3: fix
CONFIG_IPV6=mcasev2: use bool for ipv6 flag
fix !CONFIG_IPV6 caseThis patchset implements netpoll over IPv6.
Thanks for submitting this properly.
But disallowing ipv6 netpoll support when IPV6=m is an unacceptable limitation, compiling IPV6 as a module is common and in fact recommended.
Quoted 5 lines
We've solved problems like this before, by putting the needed ipv6 routines into a seperate library that is built statically into the kernel when necessary.
You should use a similar approach here.
Hmm, here we need ndisc_parse_options() and udp6_csum_init(). Not sure if both can be inlined?
Thanks!
David Miller
maintainerFrom: Cong Wang <[email protected]>
Date: Mon, 07 Jan 2013 10:58:05 +0800
Quoted 19 lines · David Miller
Quoted 18 lines
From: Cong Wang <[email protected]>
Date: Fri, 4 Jan 2013 11:14:30 +0800Quoted 8 lines
(Resend with a cover letter)
v3: fix
CONFIG_IPV6=mcasev2: use bool for ipv6 flag
fix !CONFIG_IPV6 caseThis patchset implements netpoll over IPv6.
Thanks for submitting this properly.
But disallowing ipv6 netpoll support when IPV6=m is an unacceptable limitation, compiling IPV6 as a module is common and in fact recommended.
Quoted 8 lines
Quoted 5 lines
We've solved problems like this before, by putting the needed ipv6 routines into a seperate library that is built statically into the kernel when necessary.
You should use a similar approach here.
Hmm, here we need
ndisc_parse_options()andudp6_csum_init(). Not sure if both can be inlined?
I didn't say "inline", read my email again.
We put such routines into a static library of ipv6 routines that gets statically built into vmlinux even if ipv6 is modular.
I'm not explaining this agin.