All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipv6: notify userspace when we added or changed an ipv6 token
@ 2014-10-10 14:08 Lubomir Rintel
  2014-10-13  9:46 ` Daniel Borkmann
  2014-10-26 22:41 ` [PATCH v2] " Lubomir Rintel
  0 siblings, 2 replies; 8+ messages in thread
From: Lubomir Rintel @ 2014-10-10 14:08 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, David S. Miller, Lubomir Rintel,
	Hannes Frederic Sowa, Daniel Borkmann

NetworkManager might want to know that it changed when the router advertisement
arrives.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Daniel Borkmann <dborkman@redhat.com>
---
 net/ipv6/addrconf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 3e118df..3d11390 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4528,6 +4528,7 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
 	}
 
 	write_unlock_bh(&idev->lock);
+	netdev_state_change(dev);
 	addrconf_verify_rtnl();
 	return 0;
 }
-- 
1.9.3


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

* Re: [PATCH] ipv6: notify userspace when we added or changed an ipv6 token
  2014-10-10 14:08 [PATCH] ipv6: notify userspace when we added or changed an ipv6 token Lubomir Rintel
@ 2014-10-13  9:46 ` Daniel Borkmann
  2014-10-26 22:28   ` Lubomir Rintel
  2014-10-26 22:41 ` [PATCH v2] " Lubomir Rintel
  1 sibling, 1 reply; 8+ messages in thread
From: Daniel Borkmann @ 2014-10-13  9:46 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: netdev, linux-kernel, David S. Miller, Hannes Frederic Sowa

On 10/10/2014 04:08 PM, Lubomir Rintel wrote:
> NetworkManager might want to know that it changed when the router advertisement
> arrives.
>
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Cc: Daniel Borkmann <dborkman@redhat.com>
> ---
>   net/ipv6/addrconf.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 3e118df..3d11390 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -4528,6 +4528,7 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
>   	}
>
>   	write_unlock_bh(&idev->lock);
> +	netdev_state_change(dev);

I'm wondering why netdev_state_change()? You are probably
only after the netlink notification that is being invoked,
i.e. rtmsg_ifinfo(RTM_NEWLINK, ...), and don't strictly want
to call the device notifier chain.

Perhaps it might be better to define a new RTM_SETTOKEN, and
just call inet6_ifinfo_notify(RTM_SETTOKEN, idev) as this is
only idev specific anyway?

>   	addrconf_verify_rtnl();
>   	return 0;
>   }
>

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

* Re: [PATCH] ipv6: notify userspace when we added or changed an ipv6 token
  2014-10-13  9:46 ` Daniel Borkmann
@ 2014-10-26 22:28   ` Lubomir Rintel
  0 siblings, 0 replies; 8+ messages in thread
From: Lubomir Rintel @ 2014-10-26 22:28 UTC (permalink / raw)
  To: Daniel Borkmann
  Cc: netdev, linux-kernel, David S. Miller, Hannes Frederic Sowa

On Mon, 2014-10-13 at 11:46 +0200, Daniel Borkmann wrote:
> On 10/10/2014 04:08 PM, Lubomir Rintel wrote:
> > NetworkManager might want to know that it changed when the router advertisement
> > arrives.
> >
> > Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> > Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
> > Cc: Daniel Borkmann <dborkman@redhat.com>
> > ---
> >   net/ipv6/addrconf.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> > index 3e118df..3d11390 100644
> > --- a/net/ipv6/addrconf.c
> > +++ b/net/ipv6/addrconf.c
> > @@ -4528,6 +4528,7 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
> >   	}
> >
> >   	write_unlock_bh(&idev->lock);
> > +	netdev_state_change(dev);
> 
> I'm wondering why netdev_state_change()? You are probably
> only after the netlink notification that is being invoked,
> i.e. rtmsg_ifinfo(RTM_NEWLINK, ...), and don't strictly want
> to call the device notifier chain.

Correct. I'll change it to just rtmsg_ifinfo().

> Perhaps it might be better to define a new RTM_SETTOKEN, and
> just call inet6_ifinfo_notify(RTM_SETTOKEN, idev) as this is
> only idev specific anyway?

I'm not really sure as that would require more userspace changes than
necessary.

> >   	addrconf_verify_rtnl();
> >   	return 0;
> >   }
> >



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

* [PATCH v2] ipv6: notify userspace when we added or changed an ipv6 token
  2014-10-10 14:08 [PATCH] ipv6: notify userspace when we added or changed an ipv6 token Lubomir Rintel
  2014-10-13  9:46 ` Daniel Borkmann
@ 2014-10-26 22:41 ` Lubomir Rintel
  2014-10-26 23:22   ` Daniel Borkmann
  1 sibling, 1 reply; 8+ messages in thread
From: Lubomir Rintel @ 2014-10-26 22:41 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Lubomir Rintel, Hannes Frederic Sowa, Daniel Borkmann

NetworkManager might want to know that it changed when the router advertisement
arrives.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Daniel Borkmann <dborkman@redhat.com>
---
Changes since v1:
    - Do not call device notifier chain with netdev_state_change()

 net/ipv6/addrconf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 3e118df..f6f92f5 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4528,6 +4528,7 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
 	}
 
 	write_unlock_bh(&idev->lock);
+	rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL);
 	addrconf_verify_rtnl();
 	return 0;
 }
-- 
1.9.3

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

* Re: [PATCH v2] ipv6: notify userspace when we added or changed an ipv6 token
  2014-10-26 22:41 ` [PATCH v2] " Lubomir Rintel
@ 2014-10-26 23:22   ` Daniel Borkmann
  2014-10-27 16:39     ` [PATCH v3] " Lubomir Rintel
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Borkmann @ 2014-10-26 23:22 UTC (permalink / raw)
  To: Lubomir Rintel; +Cc: netdev, David S. Miller, Hannes Frederic Sowa

On 10/26/2014 11:41 PM, Lubomir Rintel wrote:
> NetworkManager might want to know that it changed when the router advertisement
> arrives.
>
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Cc: Daniel Borkmann <dborkman@redhat.com>

The reason why I asked regarding the rtmsg_ifinfo() vs inet6_ifinfo_notify()
in v1 is actually that this is an idev-only specific action. By using
inet6_ifinfo_notify() for notification, the kernel would actually need to do
much less work: the notification only needs inet6_fill_ifinfo() as that would
contain the new token, while the rtmsg_ifinfo() is rather dev-centric and
fills out attributes about the _whole_ device (which surely includes the IPv6
idev attributes, but also a lot more, which might actually be unnecessary
here), see also:

$ git grep -n rtmsg_ifinfo net/ipv6/
$ git grep -n inet6_ifinfo_notify net/ipv6/
net/ipv6/addrconf.c:2919:                       inet6_ifinfo_notify(RTM_NEWLINK, idev);
net/ipv6/addrconf.c:4650:void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
net/ipv6/ndisc.c:1239:                  inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
net/ipv6/ndisc.c:1256:                          inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
net/ipv6/ndisc.c:1712:          inet6_ifinfo_notify(RTM_NEWLINK, idev);

Maybe I'm missing something, so can you elaborate why it's _absolutely not_
possible to use inet6_ifinfo_notify()?

> ---
> Changes since v1:
>      - Do not call device notifier chain with netdev_state_change()
>
>   net/ipv6/addrconf.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 3e118df..f6f92f5 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -4528,6 +4528,7 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
>   	}
>
>   	write_unlock_bh(&idev->lock);
> +	rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL);
>   	addrconf_verify_rtnl();
>   	return 0;
>   }
>

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

* [PATCH v3] ipv6: notify userspace when we added or changed an ipv6 token
  2014-10-26 23:22   ` Daniel Borkmann
@ 2014-10-27 16:39     ` Lubomir Rintel
  2014-10-27 22:25       ` Daniel Borkmann
  2014-10-29 18:35       ` David Miller
  0 siblings, 2 replies; 8+ messages in thread
From: Lubomir Rintel @ 2014-10-27 16:39 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Lubomir Rintel, Hannes Frederic Sowa, Daniel Borkmann

NetworkManager might want to know that it changed when the router advertisement
arrives.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Daniel Borkmann <dborkman@redhat.com>
---
Changes since v1:
    - Do not call device notifier chain with netdev_state_change()
Changes since v2:
    - inet6_ifinfo_notify() instead of rtmsg_ifinfo()

 net/ipv6/addrconf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 3e118df..d9269ef 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4528,6 +4528,7 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
 	}
 
 	write_unlock_bh(&idev->lock);
+	inet6_ifinfo_notify(RTM_NEWLINK, idev);
 	addrconf_verify_rtnl();
 	return 0;
 }
-- 
1.9.3

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

* Re: [PATCH v3] ipv6: notify userspace when we added or changed an ipv6 token
  2014-10-27 16:39     ` [PATCH v3] " Lubomir Rintel
@ 2014-10-27 22:25       ` Daniel Borkmann
  2014-10-29 18:35       ` David Miller
  1 sibling, 0 replies; 8+ messages in thread
From: Daniel Borkmann @ 2014-10-27 22:25 UTC (permalink / raw)
  To: Lubomir Rintel; +Cc: netdev, David S. Miller, Hannes Frederic Sowa

On 10/27/2014 05:39 PM, Lubomir Rintel wrote:
> NetworkManager might want to know that it changed when the router advertisement
> arrives.
>
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Cc: Daniel Borkmann <dborkman@redhat.com>

Looks better, thanks!

Acked-by: Daniel Borkmann <dborkman@redhat.com>

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

* Re: [PATCH v3] ipv6: notify userspace when we added or changed an ipv6 token
  2014-10-27 16:39     ` [PATCH v3] " Lubomir Rintel
  2014-10-27 22:25       ` Daniel Borkmann
@ 2014-10-29 18:35       ` David Miller
  1 sibling, 0 replies; 8+ messages in thread
From: David Miller @ 2014-10-29 18:35 UTC (permalink / raw)
  To: lkundrak; +Cc: netdev, hannes, dborkman

From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 27 Oct 2014 17:39:16 +0100

> NetworkManager might want to know that it changed when the router advertisement
> arrives.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

Applied, thanks.

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

end of thread, other threads:[~2014-10-29 18:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-10 14:08 [PATCH] ipv6: notify userspace when we added or changed an ipv6 token Lubomir Rintel
2014-10-13  9:46 ` Daniel Borkmann
2014-10-26 22:28   ` Lubomir Rintel
2014-10-26 22:41 ` [PATCH v2] " Lubomir Rintel
2014-10-26 23:22   ` Daniel Borkmann
2014-10-27 16:39     ` [PATCH v3] " Lubomir Rintel
2014-10-27 22:25       ` Daniel Borkmann
2014-10-29 18:35       ` 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.