[IPV4]: Remove extra argument from arp_ignore.
authorDenis V. Lunev <den@openvz.org>
Tue, 15 Jan 2008 07:05:55 +0000 (23:05 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:02:12 +0000 (15:02 -0800)
arp_ignore has two arguments: dev & in_dev. dev is used for
inet_confirm_addr calling only.

inet_confirm_addr, in turn, either gets in_dev from the device passed
or iterates over all network devices if the device passed is NULL. It
seems logical to directly pass in_dev into inet_confirm_addr.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/inetdevice.h
net/ipv4/arp.c
net/ipv4/devinet.c

index b3c5081de02da407b8b42bb21ed2bf6d70299d06..45f3731075306665ade3368d28800256017e7ca6 100644 (file)
@@ -135,7 +135,7 @@ extern int          devinet_ioctl(unsigned int cmd, void __user *);
 extern void            devinet_init(void);
 extern struct in_device        *inetdev_by_index(int);
 extern __be32          inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
-extern __be32          inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope);
+extern __be32          inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope);
 extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask);
 
 static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
index 357e8987146b92c2ff8b4946cee0ca6ddb58ddd5..6f0827b2b154c298869f825d3585a41002008f55 100644 (file)
@@ -382,8 +382,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
                read_unlock_bh(&neigh->lock);
 }
 
-static int arp_ignore(struct in_device *in_dev, struct net_device *dev,
-                     __be32 sip, __be32 tip)
+static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
 {
        int scope;
 
@@ -403,7 +402,7 @@ static int arp_ignore(struct in_device *in_dev, struct net_device *dev,
        case 3: /* Do not reply for scope host addresses */
                sip = 0;
                scope = RT_SCOPE_LINK;
-               dev = NULL;
+               in_dev = NULL;
                break;
        case 4: /* Reserved */
        case 5:
@@ -415,7 +414,7 @@ static int arp_ignore(struct in_device *in_dev, struct net_device *dev,
        default:
                return 0;
        }
-       return !inet_confirm_addr(dev, sip, tip, scope);
+       return !inet_confirm_addr(in_dev, sip, tip, scope);
 }
 
 static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
@@ -807,7 +806,7 @@ static int arp_process(struct sk_buff *skb)
        if (sip == 0) {
                if (arp->ar_op == htons(ARPOP_REQUEST) &&
                    inet_addr_type(&init_net, tip) == RTN_LOCAL &&
-                   !arp_ignore(in_dev,dev,sip,tip))
+                   !arp_ignore(in_dev, sip, tip))
                        arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha,
                                 dev->dev_addr, sha);
                goto out;
@@ -825,7 +824,7 @@ static int arp_process(struct sk_buff *skb)
                                int dont_send = 0;
 
                                if (!dont_send)
-                                       dont_send |= arp_ignore(in_dev,dev,sip,tip);
+                                       dont_send |= arp_ignore(in_dev,sip,tip);
                                if (!dont_send && IN_DEV_ARPFILTER(in_dev))
                                        dont_send |= arp_filter(sip,tip,dev);
                                if (!dont_send)
index 03db15b1030976d94bbd79ef8990821643e59705..dc1665a2b0751caefa28adb8b51e1de7f9a56b63 100644 (file)
@@ -968,24 +968,19 @@ static __be32 confirm_addr_indev(struct in_device *in_dev, __be32 dst,
 
 /*
  * Confirm that local IP address exists using wildcards:
- * - dev: only on this interface, 0=any interface
+ * - in_dev: only on this interface, 0=any interface
  * - dst: only in the same subnet as dst, 0=any dst
  * - local: address, 0=autoselect the local address
  * - scope: maximum allowed scope value for the local address
  */
-__be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope)
+__be32 inet_confirm_addr(struct in_device *in_dev,
+                        __be32 dst, __be32 local, int scope)
 {
        __be32 addr = 0;
-       struct in_device *in_dev;
-
-       if (dev) {
-               rcu_read_lock();
-               if ((in_dev = __in_dev_get_rcu(dev)))
-                       addr = confirm_addr_indev(in_dev, dst, local, scope);
-               rcu_read_unlock();
+       struct net_device *dev;
 
-               return addr;
-       }
+       if (in_dev != NULL)
+               return confirm_addr_indev(in_dev, dst, local, scope);
 
        read_lock(&dev_base_lock);
        rcu_read_lock();