aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-01-15 02:05:55 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:02:12 -0500
commit9bd85e32644d4d3744117b0a196ad4382f8acf35 (patch)
treed25bb624d799e787f9de589f317001ee8b2357aa
parent06f0511df1b3b32fc8e0840514d4b207150f1fa7 (diff)
[IPV4]: Remove extra argument from arp_ignore.
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>
-rw-r--r--include/linux/inetdevice.h2
-rw-r--r--net/ipv4/arp.c11
-rw-r--r--net/ipv4/devinet.c17
3 files changed, 12 insertions, 18 deletions
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index b3c5081de02d..45f373107530 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -135,7 +135,7 @@ extern int devinet_ioctl(unsigned int cmd, void __user *);
135extern void devinet_init(void); 135extern void devinet_init(void);
136extern struct in_device *inetdev_by_index(int); 136extern struct in_device *inetdev_by_index(int);
137extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); 137extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
138extern __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope); 138extern __be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope);
139extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask); 139extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask);
140 140
141static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa) 141static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 357e8987146b..6f0827b2b154 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -382,8 +382,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
382 read_unlock_bh(&neigh->lock); 382 read_unlock_bh(&neigh->lock);
383} 383}
384 384
385static int arp_ignore(struct in_device *in_dev, struct net_device *dev, 385static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
386 __be32 sip, __be32 tip)
387{ 386{
388 int scope; 387 int scope;
389 388
@@ -403,7 +402,7 @@ static int arp_ignore(struct in_device *in_dev, struct net_device *dev,
403 case 3: /* Do not reply for scope host addresses */ 402 case 3: /* Do not reply for scope host addresses */
404 sip = 0; 403 sip = 0;
405 scope = RT_SCOPE_LINK; 404 scope = RT_SCOPE_LINK;
406 dev = NULL; 405 in_dev = NULL;
407 break; 406 break;
408 case 4: /* Reserved */ 407 case 4: /* Reserved */
409 case 5: 408 case 5:
@@ -415,7 +414,7 @@ static int arp_ignore(struct in_device *in_dev, struct net_device *dev,
415 default: 414 default:
416 return 0; 415 return 0;
417 } 416 }
418 return !inet_confirm_addr(dev, sip, tip, scope); 417 return !inet_confirm_addr(in_dev, sip, tip, scope);
419} 418}
420 419
421static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev) 420static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
@@ -807,7 +806,7 @@ static int arp_process(struct sk_buff *skb)
807 if (sip == 0) { 806 if (sip == 0) {
808 if (arp->ar_op == htons(ARPOP_REQUEST) && 807 if (arp->ar_op == htons(ARPOP_REQUEST) &&
809 inet_addr_type(&init_net, tip) == RTN_LOCAL && 808 inet_addr_type(&init_net, tip) == RTN_LOCAL &&
810 !arp_ignore(in_dev,dev,sip,tip)) 809 !arp_ignore(in_dev, sip, tip))
811 arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha, 810 arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha,
812 dev->dev_addr, sha); 811 dev->dev_addr, sha);
813 goto out; 812 goto out;
@@ -825,7 +824,7 @@ static int arp_process(struct sk_buff *skb)
825 int dont_send = 0; 824 int dont_send = 0;
826 825
827 if (!dont_send) 826 if (!dont_send)
828 dont_send |= arp_ignore(in_dev,dev,sip,tip); 827 dont_send |= arp_ignore(in_dev,sip,tip);
829 if (!dont_send && IN_DEV_ARPFILTER(in_dev)) 828 if (!dont_send && IN_DEV_ARPFILTER(in_dev))
830 dont_send |= arp_filter(sip,tip,dev); 829 dont_send |= arp_filter(sip,tip,dev);
831 if (!dont_send) 830 if (!dont_send)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 03db15b10309..dc1665a2b075 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -968,24 +968,19 @@ static __be32 confirm_addr_indev(struct in_device *in_dev, __be32 dst,
968 968
969/* 969/*
970 * Confirm that local IP address exists using wildcards: 970 * Confirm that local IP address exists using wildcards:
971 * - dev: only on this interface, 0=any interface 971 * - in_dev: only on this interface, 0=any interface
972 * - dst: only in the same subnet as dst, 0=any dst 972 * - dst: only in the same subnet as dst, 0=any dst
973 * - local: address, 0=autoselect the local address 973 * - local: address, 0=autoselect the local address
974 * - scope: maximum allowed scope value for the local address 974 * - scope: maximum allowed scope value for the local address
975 */ 975 */
976__be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope) 976__be32 inet_confirm_addr(struct in_device *in_dev,
977 __be32 dst, __be32 local, int scope)
977{ 978{
978 __be32 addr = 0; 979 __be32 addr = 0;
979 struct in_device *in_dev; 980 struct net_device *dev;
980
981 if (dev) {
982 rcu_read_lock();
983 if ((in_dev = __in_dev_get_rcu(dev)))
984 addr = confirm_addr_indev(in_dev, dst, local, scope);
985 rcu_read_unlock();
986 981
987 return addr; 982 if (in_dev != NULL)
988 } 983 return confirm_addr_indev(in_dev, dst, local, scope);
989 984
990 read_lock(&dev_base_lock); 985 read_lock(&dev_base_lock);
991 rcu_read_lock(); 986 rcu_read_lock();