netpoll: fix netconsole IPv6 setup
Subsystems (2)
PATCH 1/1 netpoll: fix netconsole IPv6 setup
Currently, to make netconsole start over IPv6, the source address needs to be specified. Without a source address, netpoll_parse_options assumes we're setting up over IPv4 and the destination IPv6 address is rejected.
Check if the IP version has been forced by a source address before checking for a version mismatch when parsing the destination address.
--- net/core/netpoll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/netpoll.c +3 -1
@@ -948,6 +948,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) {char *cur=opt, *delim;int ipv6; +bool ipversion_set = false;if (*cur !='@' ) {if ((delim =strchr (cur,'@' )) ==NULL )
@@ -960,6 +961,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) cur++;if (*cur !='/' ) { + ipversion_set = true;if ((delim =strchr (cur,'/' )) ==NULL ) goto parse_failed; *delim =0 ;
@@ -1002,7 +1004,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) ipv6 =netpoll_parse_ip_addr (cur, &np->remote_ip);if (ipv6 <0 ) goto parse_failed; -else if (np->ipv6 != (bool )ipv6) +else if (ipversion_set && np->ipv6 != (bool )ipv6) goto parse_failed;else np->ipv6 = (bool )ipv6;
Signature · 1 line
1.8.5.3
net/core/netpoll.c int netpoll_parse_options(struct netpoll *np, char *opt) · line 952
Quoted 13 lines · Sabrina Dubroca
net/core/netpoll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)net/core/netpoll.c +1
-0@@ -948,6 +948,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) {char *cur=opt, *delim;int ipv6; +bool ipversion_set = false;
Or initialize 'ipv6' to -1 and then check if it is -1?
Quoted 4 lines · Cong Wang
Quoted 3 lines · Sabrina Dubroca
net/core/netpoll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 12 lines
net/core/netpoll.c int netpoll_parse_options(struct netpoll *np, char *opt) · line 952
Quoted 10 lines
net/core/netpoll.c +1
-0@@ -948,6 +948,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) {char *cur=opt, *delim;int ipv6; +bool ipversion_set = false;Or initialize 'ipv6' to -1 and then check if it is -1?
It's overwritten when we parse the remote address. And np->ipv6 is a bool, so we can't store it there either.
Signature · 1 line
Sabrina
Cong Wang
Acked-byQuoted 18 lines · Sabrina Dubroca
Quoted 4 lines · Cong Wang
Quoted 3 lines · Sabrina Dubroca
net/core/netpoll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 12 lines
net/core/netpoll.c int netpoll_parse_options(struct netpoll *np, char *opt) · line 952
Quoted 10 lines
net/core/netpoll.c +1
-0@@ -948,6 +948,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) {char *cur=opt, *delim;int ipv6; +bool ipversion_set = false;Or initialize 'ipv6' to -1 and then check if it is -1?
Quoted 3 lines
It's overwritten when we parse the remote address. And
np->ipv6is a bool, so we can't store it there either.
Yeah, I misunderstood the problem. Your fix looks good.
For net-next, I think we should change bool np->ipv6 to int np->ip_version, so that we can tell if it is set or not.
Thanks!
David Miller
maintainerFrom: Sabrina Dubroca <[email protected]>
Date: Thu, 6 Feb 2014 18:34:12 +0100
Quoted 9 lines
Currently, to make netconsole start over IPv6, the source address needs to be specified. Without a source address,
netpoll_parse_optionsassumes we're setting up over IPv4 and the destination IPv6 address is rejected.Check if the IP version has been forced by a source address before checking for a version mismatch when parsing the destination address.
Signed-off-by Sabrina Dubroca <[email protected]>
Applied and queued up for -stable.