netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] ipv6/addrconf: call addrconf_ifdown with consistent values
@ 2020-07-31 13:32 Florent Fourcot
  2020-07-31 13:32 ` [PATCH net-next 2/2] ipv6/addrconf: use a boolean to choose between UNREGISTER/DOWN Florent Fourcot
  2020-08-03 22:24 ` [PATCH net-next 1/2] ipv6/addrconf: call addrconf_ifdown with consistent values David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Florent Fourcot @ 2020-07-31 13:32 UTC (permalink / raw)
  To: netdev; +Cc: Florent Fourcot

Second parameter of addrconf_ifdown "how" is used as a boolean
internally. It does not make sense to call it with something different
of 0 or 1.

This value is set to 2 in all git history.

Signed-off-by: Florent Fourcot <florent.fourcot@wifirst.fr>
---
 net/ipv6/addrconf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 840bfdb3d7bd..861265fa9d6d 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -7189,7 +7189,7 @@ void addrconf_cleanup(void)
 			continue;
 		addrconf_ifdown(dev, 1);
 	}
-	addrconf_ifdown(init_net.loopback_dev, 2);
+	addrconf_ifdown(init_net.loopback_dev, 1);
 
 	/*
 	 *	Check hash table.
-- 
2.20.1


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

* [PATCH net-next 2/2] ipv6/addrconf: use a boolean to choose between UNREGISTER/DOWN
  2020-07-31 13:32 [PATCH net-next 1/2] ipv6/addrconf: call addrconf_ifdown with consistent values Florent Fourcot
@ 2020-07-31 13:32 ` Florent Fourcot
  2020-08-03 22:25   ` David Miller
  2020-08-03 22:24 ` [PATCH net-next 1/2] ipv6/addrconf: call addrconf_ifdown with consistent values David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Florent Fourcot @ 2020-07-31 13:32 UTC (permalink / raw)
  To: netdev; +Cc: Florent Fourcot

"how" was used as a boolean. Change the type to bool, and improve
variable name

Signed-off-by: Florent Fourcot <florent.fourcot@wifirst.fr>
---
 net/ipv6/addrconf.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 861265fa9d6d..0acf6a9796ca 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -163,7 +163,7 @@ static void addrconf_leave_anycast(struct inet6_ifaddr *ifp);
 
 static void addrconf_type_change(struct net_device *dev,
 				 unsigned long event);
-static int addrconf_ifdown(struct net_device *dev, int how);
+static int addrconf_ifdown(struct net_device *dev, bool unregister);
 
 static struct fib6_info *addrconf_get_prefix_route(const struct in6_addr *pfx,
 						  int plen,
@@ -3630,7 +3630,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
 		 * an L3 master device (e.g., VRF)
 		 */
 		if (info->upper_dev && netif_is_l3_master(info->upper_dev))
-			addrconf_ifdown(dev, 0);
+			addrconf_ifdown(dev, false);
 	}
 
 	return NOTIFY_OK;
@@ -3663,9 +3663,9 @@ static bool addr_is_local(const struct in6_addr *addr)
 		(IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
 }
 
-static int addrconf_ifdown(struct net_device *dev, int how)
+static int addrconf_ifdown(struct net_device *dev, bool unregister)
 {
-	unsigned long event = how ? NETDEV_UNREGISTER : NETDEV_DOWN;
+	unsigned long event = unregister ? NETDEV_UNREGISTER : NETDEV_DOWN;
 	struct net *net = dev_net(dev);
 	struct inet6_dev *idev;
 	struct inet6_ifaddr *ifa, *tmp;
@@ -3684,7 +3684,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
 	 * Step 1: remove reference to ipv6 device from parent device.
 	 *	   Do not dev_put!
 	 */
-	if (how) {
+	if (unregister) {
 		idev->dead = 1;
 
 		/* protected by rtnl_lock */
@@ -3698,7 +3698,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
 	/* combine the user config with event to determine if permanent
 	 * addresses are to be removed from address hash table
 	 */
-	if (!how && !idev->cnf.disable_ipv6) {
+	if (!unregister && !idev->cnf.disable_ipv6) {
 		/* aggregate the system setting and interface setting */
 		int _keep_addr = net->ipv6.devconf_all->keep_addr_on_down;
 
@@ -3736,7 +3736,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
 	addrconf_del_rs_timer(idev);
 
 	/* Step 2: clear flags for stateless addrconf */
-	if (!how)
+	if (!unregister)
 		idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY);
 
 	/* Step 3: clear tempaddr list */
@@ -3806,7 +3806,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
 	write_unlock_bh(&idev->lock);
 
 	/* Step 5: Discard anycast and multicast list */
-	if (how) {
+	if (unregister) {
 		ipv6_ac_destroy_dev(idev);
 		ipv6_mc_destroy_dev(idev);
 	} else {
@@ -3816,7 +3816,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
 	idev->tstamp = jiffies;
 
 	/* Last: Shot the device (if unregistered) */
-	if (how) {
+	if (unregister) {
 		addrconf_sysctl_unregister(idev);
 		neigh_parms_release(&nd_tbl, idev->nd_parms);
 		neigh_ifdown(&nd_tbl, dev);
@@ -4038,7 +4038,7 @@ static void addrconf_dad_work(struct work_struct *w)
 		in6_ifa_hold(ifp);
 		addrconf_dad_stop(ifp, 1);
 		if (disable_ipv6)
-			addrconf_ifdown(idev->dev, 0);
+			addrconf_ifdown(idev->dev, false);
 		goto out;
 	}
 
@@ -7187,9 +7187,9 @@ void addrconf_cleanup(void)
 	for_each_netdev(&init_net, dev) {
 		if (__in6_dev_get(dev) == NULL)
 			continue;
-		addrconf_ifdown(dev, 1);
+		addrconf_ifdown(dev, true);
 	}
-	addrconf_ifdown(init_net.loopback_dev, 1);
+	addrconf_ifdown(init_net.loopback_dev, true);
 
 	/*
 	 *	Check hash table.
-- 
2.20.1


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

* Re: [PATCH net-next 1/2] ipv6/addrconf: call addrconf_ifdown with consistent values
  2020-07-31 13:32 [PATCH net-next 1/2] ipv6/addrconf: call addrconf_ifdown with consistent values Florent Fourcot
  2020-07-31 13:32 ` [PATCH net-next 2/2] ipv6/addrconf: use a boolean to choose between UNREGISTER/DOWN Florent Fourcot
@ 2020-08-03 22:24 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2020-08-03 22:24 UTC (permalink / raw)
  To: florent.fourcot; +Cc: netdev

From: Florent Fourcot <florent.fourcot@wifirst.fr>
Date: Fri, 31 Jul 2020 15:32:06 +0200

> Second parameter of addrconf_ifdown "how" is used as a boolean
> internally. It does not make sense to call it with something different
> of 0 or 1.
> 
> This value is set to 2 in all git history.
> 
> Signed-off-by: Florent Fourcot <florent.fourcot@wifirst.fr>

The value '2' had a special meaning a very long time ago.

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

* Re: [PATCH net-next 2/2] ipv6/addrconf: use a boolean to choose between UNREGISTER/DOWN
  2020-07-31 13:32 ` [PATCH net-next 2/2] ipv6/addrconf: use a boolean to choose between UNREGISTER/DOWN Florent Fourcot
@ 2020-08-03 22:25   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-08-03 22:25 UTC (permalink / raw)
  To: florent.fourcot; +Cc: netdev

From: Florent Fourcot <florent.fourcot@wifirst.fr>
Date: Fri, 31 Jul 2020 15:32:07 +0200

> "how" was used as a boolean. Change the type to bool, and improve
> variable name
> 
> Signed-off-by: Florent Fourcot <florent.fourcot@wifirst.fr>

Applied.

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

end of thread, other threads:[~2020-08-03 22:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-31 13:32 [PATCH net-next 1/2] ipv6/addrconf: call addrconf_ifdown with consistent values Florent Fourcot
2020-07-31 13:32 ` [PATCH net-next 2/2] ipv6/addrconf: use a boolean to choose between UNREGISTER/DOWN Florent Fourcot
2020-08-03 22:25   ` David Miller
2020-08-03 22:24 ` [PATCH net-next 1/2] ipv6/addrconf: call addrconf_ifdown with consistent values David Miller

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