* [PATCH net-next] ipv6: addrconf: don't evaluate keep_addr_on_down twice
@ 2018-04-24 7:31 Ivan Vecera
2018-04-24 17:44 ` David Ahern
0 siblings, 1 reply; 2+ messages in thread
From: Ivan Vecera @ 2018-04-24 7:31 UTC (permalink / raw)
To: netdev; +Cc: David Ahern
The addrconf_ifdown() evaluates keep_addr_on_down state twice. There
is no need to do it.
Cc: David Ahern <dsahern@gmail.com>
Signed-off-by: Ivan Vecera <cera@cera.cz>
---
net/ipv6/addrconf.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 78cef00c9596..f40e25fd15ee 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3612,8 +3612,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
struct net *net = dev_net(dev);
struct inet6_dev *idev;
struct inet6_ifaddr *ifa, *tmp;
- int _keep_addr;
- bool keep_addr;
+ bool keep_addr = false;
int state, i;
ASSERT_RTNL();
@@ -3639,15 +3638,18 @@ static int addrconf_ifdown(struct net_device *dev, int how)
}
- /* aggregate the system setting and interface setting */
- _keep_addr = net->ipv6.devconf_all->keep_addr_on_down;
- if (!_keep_addr)
- _keep_addr = idev->cnf.keep_addr_on_down;
-
/* combine the user config with event to determine if permanent
* addresses are to be removed from address hash table
*/
- keep_addr = !(how || _keep_addr <= 0 || idev->cnf.disable_ipv6);
+ if (!how && !idev->cnf.disable_ipv6) {
+ /* aggregate the system setting and interface setting */
+ int _keep_addr = net->ipv6.devconf_all->keep_addr_on_down;
+
+ if (!_keep_addr)
+ _keep_addr = idev->cnf.keep_addr_on_down;
+
+ keep_addr = (_keep_addr > 0);
+ }
/* Step 2: clear hash table */
for (i = 0; i < IN6_ADDR_HSIZE; i++) {
@@ -3697,11 +3699,6 @@ static int addrconf_ifdown(struct net_device *dev, int how)
write_lock_bh(&idev->lock);
}
- /* re-combine the user config with event to determine if permanent
- * addresses are to be removed from the interface list
- */
- keep_addr = (!how && _keep_addr > 0 && !idev->cnf.disable_ipv6);
-
list_for_each_entry_safe(ifa, tmp, &idev->addr_list, if_list) {
struct rt6_info *rt = NULL;
bool keep;
--
2.16.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] ipv6: addrconf: don't evaluate keep_addr_on_down twice
2018-04-24 7:31 [PATCH net-next] ipv6: addrconf: don't evaluate keep_addr_on_down twice Ivan Vecera
@ 2018-04-24 17:44 ` David Ahern
0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2018-04-24 17:44 UTC (permalink / raw)
To: Ivan Vecera, netdev
On 4/24/18 1:31 AM, Ivan Vecera wrote:
> The addrconf_ifdown() evaluates keep_addr_on_down state twice. There
> is no need to do it.
>
> Cc: David Ahern <dsahern@gmail.com>
> Signed-off-by: Ivan Vecera <cera@cera.cz>
> ---
> net/ipv6/addrconf.c | 23 ++++++++++-------------
> 1 file changed, 10 insertions(+), 13 deletions(-)
Looks right to me.
Acked-by: David Ahern <dsahern@gmail.com>
But ...
> @@ -3697,11 +3699,6 @@ static int addrconf_ifdown(struct net_device *dev, int how)
> write_lock_bh(&idev->lock);
> }
>
> - /* re-combine the user config with event to determine if permanent
> - * addresses are to be removed from the interface list
> - */
> - keep_addr = (!how && _keep_addr > 0 && !idev->cnf.disable_ipv6);
> -
> list_for_each_entry_safe(ifa, tmp, &idev->addr_list, if_list) {
> struct rt6_info *rt = NULL;
> bool keep;
>
you need to rebase to top of tree. That is 'struct fib6_info *rt' now so
the patch does not apply cleanly using git am.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-24 17:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-24 7:31 [PATCH net-next] ipv6: addrconf: don't evaluate keep_addr_on_down twice Ivan Vecera
2018-04-24 17:44 ` David Ahern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).