Skip to contentSkip to conversation

ipv6: restore the behavior of ipv6_sock_ac_drop()

PATCH Applied Cong Wang 4 participants 5 messages Sep 5, 2014 – Sep 7, 2014

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 ipv6: restore the behavior of ipv6_sock_ac_drop()

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 <[email protected]>
Cc David S. Miller <[email protected]>
---
 net/ipv6/anycast.c | 2 --
 1 file changed, 2 deletions(-)
net/ipv6/anycast.c +0 -2
index 45b9d81..ff2de7d 100644
@@ -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;
 }
 
Signature · 1 line
1.8.3.1
#1 lore raw

Hi Cong,

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

Quoted 3 lines · Cong Wang

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.

Quoted 2 lines

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

#2 lore raw
Quoted 4 lines · Hannes Frederic Sowa

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. :)

Quoted 8 lines · Cong Wang
Quoted 3 lines

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.

Quoted 10 lines
Quoted 3 lines

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.

#3 lore raw
Quoted 10 lines · Cong Wang
Quoted 4 lines · Hannes Frederic Sowa

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.

Quoted 9 lines
Quoted 7 lines · Cong Wang
Quoted 3 lines

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).

Quoted 10 lines
Quoted 9 lines
Quoted 2 lines

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).

Quoted 6 lines

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:

Bye,
Hannes

maintainer Applied
#4 lore raw
In reply to Cong Wang

From: Cong Wang <[email protected]>
Date: Fri, 5 Sep 2014 14:33:00 -0700

Quoted 11 lines

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 <[email protected]>
Cc David S. Miller <[email protected]>

Applied, thanks.