All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] netpoll: fix netconsole IPv6 setup
@ 2014-02-06 17:34 Sabrina Dubroca
  2014-02-06 20:34 ` Cong Wang
  2014-02-07  6:29 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Sabrina Dubroca @ 2014-02-06 17:34 UTC (permalink / raw)
  To: davem; +Cc: netdev, Sabrina Dubroca

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: Sabrina Dubroca <sd@queasysnail.net>
---
 net/core/netpoll.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index c03f3de..a664f78 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -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;
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] netpoll: fix netconsole IPv6 setup
  2014-02-06 17:34 [PATCH net] netpoll: fix netconsole IPv6 setup Sabrina Dubroca
@ 2014-02-06 20:34 ` Cong Wang
  2014-02-06 20:58   ` Sabrina Dubroca
  2014-02-07  6:29 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Cong Wang @ 2014-02-06 20:34 UTC (permalink / raw)
  To: Sabrina Dubroca; +Cc: David Miller, netdev

On Thu, Feb 6, 2014 at 9:34 AM, Sabrina Dubroca <sd@queasysnail.net> wrote:
>  net/core/netpoll.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> index c03f3de..a664f78 100644
> --- a/net/core/netpoll.c
> +++ b/net/core/netpoll.c
> @@ -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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] netpoll: fix netconsole IPv6 setup
  2014-02-06 20:34 ` Cong Wang
@ 2014-02-06 20:58   ` Sabrina Dubroca
  2014-02-06 22:09     ` Cong Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Sabrina Dubroca @ 2014-02-06 20:58 UTC (permalink / raw)
  To: Cong Wang; +Cc: David Miller, netdev

2014-02-06, 12:34:10 -0800, Cong Wang wrote:
> On Thu, Feb 6, 2014 at 9:34 AM, Sabrina Dubroca <sd@queasysnail.net> wrote:
> >  net/core/netpoll.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> > index c03f3de..a664f78 100644
> > --- a/net/core/netpoll.c
> > +++ b/net/core/netpoll.c
> > @@ -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.

-- 
Sabrina

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] netpoll: fix netconsole IPv6 setup
  2014-02-06 20:58   ` Sabrina Dubroca
@ 2014-02-06 22:09     ` Cong Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Cong Wang @ 2014-02-06 22:09 UTC (permalink / raw)
  To: Sabrina Dubroca; +Cc: David Miller, netdev

On Thu, Feb 6, 2014 at 12:58 PM, Sabrina Dubroca <sd@queasysnail.net> wrote:
> 2014-02-06, 12:34:10 -0800, Cong Wang wrote:
>> On Thu, Feb 6, 2014 at 9:34 AM, Sabrina Dubroca <sd@queasysnail.net> wrote:
>> >  net/core/netpoll.c | 4 +++-
>> >  1 file changed, 3 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/net/core/netpoll.c b/net/core/netpoll.c
>> > index c03f3de..a664f78 100644
>> > --- a/net/core/netpoll.c
>> > +++ b/net/core/netpoll.c
>> > @@ -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.
>


Yeah, I misunderstood the problem. Your fix looks good.

Acked-by: Cong Wang <cwang@twopensource.com>

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!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] netpoll: fix netconsole IPv6 setup
  2014-02-06 17:34 [PATCH net] netpoll: fix netconsole IPv6 setup Sabrina Dubroca
  2014-02-06 20:34 ` Cong Wang
@ 2014-02-07  6:29 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2014-02-07  6:29 UTC (permalink / raw)
  To: sd; +Cc: netdev

From: Sabrina Dubroca <sd@queasysnail.net>
Date: Thu,  6 Feb 2014 18:34:12 +0100

> 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: Sabrina Dubroca <sd@queasysnail.net>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-07  6:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-06 17:34 [PATCH net] netpoll: fix netconsole IPv6 setup Sabrina Dubroca
2014-02-06 20:34 ` Cong Wang
2014-02-06 20:58   ` Sabrina Dubroca
2014-02-06 22:09     ` Cong Wang
2014-02-07  6:29 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.