public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
* ipv6_chk_acast_addr remove unused loop
@ 2008-02-08 17:23 Daniel Lezcano
  2008-02-08 17:42 ` David Stevens
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Lezcano @ 2008-02-08 17:23 UTC (permalink / raw)
  To: David Miller
  Cc: Linux Netdev List,
	YOSHIFUJI Hideaki / 吉藤英明

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: ipv6_chk_acast_addr-remove-loop.patch --]
[-- Type: text/x-patch, Size: 1757 bytes --]

Subject: ipv6_chk_acast_addr remove unused loop
From: Daniel Lezcano <dlezcano@fr•ibm.com>

The ipv6_chk_acast_addr is called with a netdev pointer parameter which
can be NULL. This value is used as a wildcard to browse the netdev list
and search if a device is owning the address. But when looking closely
to the code, this function is only called one time in ndisc.c and the
netdev parameter is never NULL. The code browsing the netdev list is
pointless in this case.

This patch removes netdev list browsing code.

Signed-off-by: Daniel Lezcano <dlezcano@fr•ibm.com>
---
 net/ipv6/anycast.c |   22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)

Index: net-2.6-fixes/net/ipv6/anycast.c
===================================================================
--- net-2.6-fixes.orig/net/ipv6/anycast.c
+++ net-2.6-fixes/net/ipv6/anycast.c
@@ -401,7 +401,7 @@ static int ipv6_dev_ac_dec(struct net_de
 /*
  *	check if the interface has this anycast address
  */
-static int ipv6_chk_acast_dev(struct net_device *dev, struct in6_addr *addr)
+int ipv6_chk_acast_addr(struct net_device *dev, struct in6_addr *addr)
 {
 	struct inet6_dev *idev;
 	struct ifacaddr6 *aca;
@@ -419,26 +419,6 @@ static int ipv6_chk_acast_dev(struct net
 	return 0;
 }
 
-/*
- *	check if given interface (or any, if dev==0) has this anycast address
- */
-int ipv6_chk_acast_addr(struct net_device *dev, struct in6_addr *addr)
-{
-	int found = 0;
-
-	if (dev)
-		return ipv6_chk_acast_dev(dev, addr);
-	read_lock(&dev_base_lock);
-	for_each_netdev(&init_net, dev)
-		if (ipv6_chk_acast_dev(dev, addr)) {
-			found = 1;
-			break;
-		}
-	read_unlock(&dev_base_lock);
-	return found;
-}
-
-
 #ifdef CONFIG_PROC_FS
 struct ac6_iter_state {
 	struct net_device *dev;

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

end of thread, other threads:[~2008-02-08 17:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-08 17:23 ipv6_chk_acast_addr remove unused loop Daniel Lezcano
2008-02-08 17:42 ` David Stevens
2008-02-08 17:48   ` Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox