Commit 5fc05f87 authored by Amerigo Wang's avatar Amerigo Wang Committed by David S. Miller

netpoll: warn when there are spaces in parameters

v2: update according to Frans' comments.

Currently, if we leave spaces before dst port,
netconsole will silently accept it as 0. Warn about this.

Also, when spaces appear in other places, make them
visible in error messages.
Signed-off-by: default avatarWANG Cong <amwang@redhat.com>
Cc: David Miller <davem@davemloft.net>
Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 21afc27c
...@@ -614,7 +614,7 @@ void netpoll_print_options(struct netpoll *np) ...@@ -614,7 +614,7 @@ void netpoll_print_options(struct netpoll *np)
np->name, np->local_port); np->name, np->local_port);
printk(KERN_INFO "%s: local IP %pI4\n", printk(KERN_INFO "%s: local IP %pI4\n",
np->name, &np->local_ip); np->name, &np->local_ip);
printk(KERN_INFO "%s: interface %s\n", printk(KERN_INFO "%s: interface '%s'\n",
np->name, np->dev_name); np->name, np->dev_name);
printk(KERN_INFO "%s: remote port %d\n", printk(KERN_INFO "%s: remote port %d\n",
np->name, np->remote_port); np->name, np->remote_port);
...@@ -661,6 +661,9 @@ int netpoll_parse_options(struct netpoll *np, char *opt) ...@@ -661,6 +661,9 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
if ((delim = strchr(cur, '@')) == NULL) if ((delim = strchr(cur, '@')) == NULL)
goto parse_failed; goto parse_failed;
*delim = 0; *delim = 0;
if (*cur == ' ' || *cur == '\t')
printk(KERN_INFO "%s: warning: whitespace"
"is not allowed\n", np->name);
np->remote_port = simple_strtol(cur, NULL, 10); np->remote_port = simple_strtol(cur, NULL, 10);
cur = delim; cur = delim;
} }
...@@ -708,7 +711,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) ...@@ -708,7 +711,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
return 0; return 0;
parse_failed: parse_failed:
printk(KERN_INFO "%s: couldn't parse config at %s!\n", printk(KERN_INFO "%s: couldn't parse config at '%s'!\n",
np->name, cur); np->name, cur);
return -1; return -1;
} }
......
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