Skip to contentSkip to conversation

netpoll: allow spaces in its parameter

PATCH In review Amerigo Wang 2 participants 7 messages Mar 17, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netpoll: allow spaces in its parameter

It would be nice if we allow spaces in netconsole parameters, otherwise we get weird results if there are spaces in it.

After this patch, we will allow things like:
"netconsole= @192.168.0.1/eth0 , [email protected]/".

Cc David Miller <[email protected]>

---

net/core/netpoll.c +3 -0
index 7aa6972..bf3b2f0 100644
@@ -629,6 +629,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
 	char *cur=opt, *delim;
 
 	if (*cur != '@') {
+		cur = skip_spaces(cur);
 		if ((delim = strchr(cur, '@')) == NULL)
 			goto parse_failed;
 		*delim = 0;
@@ -651,12 +652,14 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
 		if ((delim = strchr(cur, ',')) == NULL)
 			goto parse_failed;
 		*delim = 0;
+		strim(cur);
 		strlcpy(np->dev_name, cur, sizeof(np->dev_name));
 		cur = delim;
 	}
 	cur++;
 
 	if (*cur != '@') {
+		cur = skip_spaces(cur);
 		/* dst port */
 		if ((delim = strchr(cur, '@')) == NULL)
 			goto parse_failed;
maintainer
#1 lore raw

From: Amerigo Wang <[email protected]>
Date: Wed, 17 Mar 2010 01:53:26 -0400

Quoted 9 lines

It would be nice if we allow spaces in netconsole parameters, otherwise we get weird results if there are spaces in it.

After this patch, we will allow things like:
"netconsole= @192.168.0.1/eth0 , [email protected]/".

Cc David Miller <[email protected]>

That kernel command line looks absolutely awful, not better.

Sorry I'm not applying this.

author
#2 lore raw
Quoted 9 lines · David Miller

From: Amerigo Wang <[email protected]>
Date: Wed, 17 Mar 2010 01:53:26 -0400

Quoted 6 lines

It would be nice if we allow spaces in netconsole parameters, otherwise we get weird results if there are spaces in it.

After this patch, we will allow things like:
"netconsole= @192.168.0.1/eth0 , [email protected]/".

Quoted 7 lines
Quoted 2 lines
Cc David Miller <[email protected]>

That kernel command line looks absolutely awful, not better.

Sorry I'm not applying this.

The problem is that the dst port is 0 when I even use:

"[email protected]/eth0, [email protected]/"

This is awful too? I don't think so...

maintainer
#3 lore raw

From: Cong Wang <[email protected]>
Date: Wed, 17 Mar 2010 14:01:06 +0800

Quoted 5 lines

The problem is that the dst port is 0 when I even use:

"[email protected]/eth0, [email protected]/"

This is awful too? I don't think so...

It's very simple, don't use spaces. Is it so difficult to follow this rule?

"ipconfig" does it as do a host of other kernel command line options.

There is no real reason to make netconsle= special in this regard, really.

author
#4 lore raw
Quoted 12 lines · David Miller

From: Cong Wang <[email protected]>
Date: Wed, 17 Mar 2010 14:01:06 +0800

Quoted 5 lines

The problem is that the dst port is 0 when I even use:

"[email protected]/eth0, [email protected]/"

This is awful too? I don't think so...

It's very simple, don't use spaces. Is it so difficult to follow this rule?

No, but silently accepting it as 0 is not correct, why don't reject it if it is not allowed?

maintainer
#5 lore raw

From: Cong Wang <[email protected]>
Date: Wed, 17 Mar 2010 14:07:57 +0800

Quoted 2 lines

No, but silently accepting it as 0 is not correct, why don't reject it if it is not allowed?

You have to be careful even with that. For example, if two netconsoles are specified, seeing the space shouldn't kill the first netconsole specification we parsed.

A warning perhaps, but outright rejection of all specifications is really bad behavior.

author
#6 lore raw
Quoted 6 lines · David Miller

From: Cong Wang <[email protected]>
Date: Wed, 17 Mar 2010 14:07:57 +0800

Quoted 2 lines

No, but silently accepting it as 0 is not correct, why don't reject it if it is not allowed?

Quoted 6 lines

You have to be careful even with that. For example, if two netconsoles are specified, seeing the space shouldn't kill the first netconsole specification we parsed.

A warning perhaps, but outright rejection of all specifications is really bad behavior.

OK, I will put a warning there instead.

Thanks, David!