2014-10-10 14:09:51

by Lubomir Rintel

[permalink] [raw]
Subject: [PATCH] ipv6: notify userspace when we added or changed an ipv6 token

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

Signed-off-by: Lubomir Rintel <[email protected]>
Cc: Hannes Frederic Sowa <[email protected]>
Cc: Daniel Borkmann <[email protected]>
---
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


2014-10-13 09:46:14

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH] ipv6: notify userspace when we added or changed an ipv6 token

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 <[email protected]>
> Cc: Hannes Frederic Sowa <[email protected]>
> Cc: Daniel Borkmann <[email protected]>
> ---
> 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;
> }
>

2014-10-26 22:35:24

by Lubomir Rintel

[permalink] [raw]
Subject: Re: [PATCH] ipv6: notify userspace when we added or changed an ipv6 token

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 <[email protected]>
> > Cc: Hannes Frederic Sowa <[email protected]>
> > Cc: Daniel Borkmann <[email protected]>
> > ---
> > 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;
> > }
> >