All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch net] ipv6: restore the behavior of ipv6_sock_ac_drop()
@ 2014-09-05 21:33 Cong Wang
  2014-09-05 22:26 ` Hannes Frederic Sowa
  2014-09-07 23:10 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Cong Wang @ 2014-09-05 21:33 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang, Sabrina Dubroca, David S. Miller

It is possible that the interface is already gone after joining
the list of anycast on this interface as we don't hold a refcount
for the device, in this case we are safe to ignore the error.

What's more important, for API compatibility we should not
change this behavior for applications even if it were correct.

Fixes: commit a9ed4a2986e13011 ("ipv6: fix rtnl locking in setsockopt for anycast and multicast")
Cc: Sabrina Dubroca <sd@queasysnail.net>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 net/ipv6/anycast.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 45b9d81..ff2de7d 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -182,8 +182,6 @@ int ipv6_sock_ac_drop(struct sock *sk, int ifindex, const struct in6_addr *addr)
 	rtnl_unlock();
 
 	sock_kfree_s(sk, pac, sizeof(*pac));
-	if (!dev)
-		return -ENODEV;
 	return 0;
 }
 
-- 
1.8.3.1

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

* Re: [Patch net] ipv6: restore the behavior of ipv6_sock_ac_drop()
  2014-09-05 21:33 [Patch net] ipv6: restore the behavior of ipv6_sock_ac_drop() Cong Wang
@ 2014-09-05 22:26 ` Hannes Frederic Sowa
  2014-09-05 22:41   ` Cong Wang
  2014-09-07 23:10 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Hannes Frederic Sowa @ 2014-09-05 22:26 UTC (permalink / raw)
  To: Cong Wang, netdev; +Cc: Sabrina Dubroca, David S. Miller

Hi Cong,

Just doing normal review, really no bad intentions, just technical
follow-up. ;)

On Fri, Sep 5, 2014, at 23:33, Cong Wang wrote:
> It is possible that the interface is already gone after joining
> the list of anycast on this interface as we don't hold a refcount
> for the device, in this case we are safe to ignore the error.

anycast code actually inserts routes into the routing table and holds a
reference on the interface while that route is active.

> What's more important, for API compatibility we should not
> change this behavior for applications even if it were correct.

IMHO adding new error codes never breaks existing applications because
there is no way they can explore all possible errno variables. Also we
already report ENODEV from multicast setsockopts. So I think it would be
ok to leave it as is, but I have no strong opinion on that and it would
be ok by me if the patch got accepted (maybe update the changelog).

Thanks,
Hannes

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

* Re: [Patch net] ipv6: restore the behavior of ipv6_sock_ac_drop()
  2014-09-05 22:26 ` Hannes Frederic Sowa
@ 2014-09-05 22:41   ` Cong Wang
  2014-09-05 23:07     ` Hannes Frederic Sowa
  0 siblings, 1 reply; 5+ messages in thread
From: Cong Wang @ 2014-09-05 22:41 UTC (permalink / raw)
  To: Hannes Frederic Sowa; +Cc: Cong Wang, netdev, Sabrina Dubroca, David S. Miller

On Fri, Sep 5, 2014 at 3:26 PM, Hannes Frederic Sowa
<hannes@stressinduktion.org> wrote:
> Hi Cong,
>
> Just doing normal review, really no bad intentions, just technical
> follow-up. ;)

I believe you are not supposed to do it since definitely you
said you don't want to work with me. You said it, not me,
I respect any of your choice. :)

>
> On Fri, Sep 5, 2014, at 23:33, Cong Wang wrote:
>> It is possible that the interface is already gone after joining
>> the list of anycast on this interface as we don't hold a refcount
>> for the device, in this case we are safe to ignore the error.
>
> anycast code actually inserts routes into the routing table and holds a
> reference on the interface while that route is active.

But route could be deleted.

>
>> What's more important, for API compatibility we should not
>> change this behavior for applications even if it were correct.
>
> IMHO adding new error codes never breaks existing applications because
> there is no way they can explore all possible errno variables. Also we
> already report ENODEV from multicast setsockopts. So I think it would be
> ok to leave it as is, but I have no strong opinion on that and it would
> be ok by me if the patch got accepted (maybe update the changelog).
>

Again, too late to change, the code has been there since the beginning
of git history. You should have a strong argument if you want to change it,
otherwise restore old behavior, that is all. Obviously you don't even mention
this when you accept that patch.

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

* Re: [Patch net] ipv6: restore the behavior of ipv6_sock_ac_drop()
  2014-09-05 22:41   ` Cong Wang
@ 2014-09-05 23:07     ` Hannes Frederic Sowa
  0 siblings, 0 replies; 5+ messages in thread
From: Hannes Frederic Sowa @ 2014-09-05 23:07 UTC (permalink / raw)
  To: Cong Wang; +Cc: Cong Wang, netdev, Sabrina Dubroca, David S. Miller

On Sat, Sep 6, 2014, at 00:41, Cong Wang wrote:
> On Fri, Sep 5, 2014 at 3:26 PM, Hannes Frederic Sowa
> <hannes@stressinduktion.org> wrote:
> > Hi Cong,
> >
> > Just doing normal review, really no bad intentions, just technical
> > follow-up. ;)
> 
> I believe you are not supposed to do it since definitely you
> said you don't want to work with me. You said it, not me,
> I respect any of your choice. :)

Oh no, you misunderstood me (maybe my bad). My only critique was that
you could have stated that you also saw a problem with the ENODEV return
before the patch was looked at by David.
Sure, let's forget that and work together.

> > On Fri, Sep 5, 2014, at 23:33, Cong Wang wrote:
> >> It is possible that the interface is already gone after joining
> >> the list of anycast on this interface as we don't hold a refcount
> >> for the device, in this case we are safe to ignore the error.
> >
> > anycast code actually inserts routes into the routing table and holds a
> > reference on the interface while that route is active.
> 
> But route could be deleted.

The routes are managed by the inet6_dev and it will drop the routes on
interface shutdown, correct. There is no strong reference from socket to
the routing entry. Only deleting a route should not work as it will
still be referenced by the anycast list in inet6_dev (though it won't
get used anymore).

> >> What's more important, for API compatibility we should not
> >> change this behavior for applications even if it were correct.
> >
> > IMHO adding new error codes never breaks existing applications because
> > there is no way they can explore all possible errno variables. Also we
> > already report ENODEV from multicast setsockopts. So I think it would be
> > ok to leave it as is, but I have no strong opinion on that and it would
> > be ok by me if the patch got accepted (maybe update the changelog).
> >
> 
> Again, too late to change, the code has been there since the beginning
> of git history. You should have a strong argument if you want to change
> it,
> otherwise restore old behavior, that is all. Obviously you don't even
> mention
> this when you accept that patch.

Let's settle this:
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

Bye,
Hannes

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

* Re: [Patch net] ipv6: restore the behavior of ipv6_sock_ac_drop()
  2014-09-05 21:33 [Patch net] ipv6: restore the behavior of ipv6_sock_ac_drop() Cong Wang
  2014-09-05 22:26 ` Hannes Frederic Sowa
@ 2014-09-07 23:10 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2014-09-07 23:10 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, sd

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Fri,  5 Sep 2014 14:33:00 -0700

> It is possible that the interface is already gone after joining
> the list of anycast on this interface as we don't hold a refcount
> for the device, in this case we are safe to ignore the error.
> 
> What's more important, for API compatibility we should not
> change this behavior for applications even if it were correct.
> 
> Fixes: commit a9ed4a2986e13011 ("ipv6: fix rtnl locking in setsockopt for anycast and multicast")
> Cc: Sabrina Dubroca <sd@queasysnail.net>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied, thanks.

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

end of thread, other threads:[~2014-09-07 23:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-05 21:33 [Patch net] ipv6: restore the behavior of ipv6_sock_ac_drop() Cong Wang
2014-09-05 22:26 ` Hannes Frederic Sowa
2014-09-05 22:41   ` Cong Wang
2014-09-05 23:07     ` Hannes Frederic Sowa
2014-09-07 23:10 ` 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.