Commit 00fe11b3 authored by Sabrina Dubroca's avatar Sabrina Dubroca Committed by David S. Miller

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.
Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
Acked-by: default avatarCong Wang <cwang@twopensource.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 440b87ea
...@@ -948,6 +948,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) ...@@ -948,6 +948,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
{ {
char *cur=opt, *delim; char *cur=opt, *delim;
int ipv6; int ipv6;
bool ipversion_set = false;
if (*cur != '@') { if (*cur != '@') {
if ((delim = strchr(cur, '@')) == NULL) if ((delim = strchr(cur, '@')) == NULL)
...@@ -960,6 +961,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) ...@@ -960,6 +961,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
cur++; cur++;
if (*cur != '/') { if (*cur != '/') {
ipversion_set = true;
if ((delim = strchr(cur, '/')) == NULL) if ((delim = strchr(cur, '/')) == NULL)
goto parse_failed; goto parse_failed;
*delim = 0; *delim = 0;
...@@ -1002,7 +1004,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) ...@@ -1002,7 +1004,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
ipv6 = netpoll_parse_ip_addr(cur, &np->remote_ip); ipv6 = netpoll_parse_ip_addr(cur, &np->remote_ip);
if (ipv6 < 0) if (ipv6 < 0)
goto parse_failed; goto parse_failed;
else if (np->ipv6 != (bool)ipv6) else if (ipversion_set && np->ipv6 != (bool)ipv6)
goto parse_failed; goto parse_failed;
else else
np->ipv6 = (bool)ipv6; np->ipv6 = (bool)ipv6;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment