public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Daniel Lezcano <dlezcano@fr•ibm.com>
To: David Miller <davem@davemloft•net>
Cc: "Linux Netdev List" <netdev@vger•kernel.org>,
	"YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6•org>
Subject: ipv6_chk_acast_addr remove unused loop
Date: Fri, 08 Feb 2008 18:23:09 +0100	[thread overview]
Message-ID: <47AC8FFD.3090401@fr.ibm.com> (raw)

[-- 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;

             reply	other threads:[~2008-02-08 17:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-08 17:23 Daniel Lezcano [this message]
2008-02-08 17:42 ` ipv6_chk_acast_addr remove unused loop David Stevens
2008-02-08 17:48   ` Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47AC8FFD.3090401@fr.ibm.com \
    --to=dlezcano@fr$(echo .)ibm.com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=yoshfuji@linux-ipv6$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox