aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/arp.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-12-06 00:20:50 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:56:38 -0500
commitf8b33fdfafea0f909712a55fbb3d83b89f70f3f5 (patch)
treea933c08d0302ae39ea1aa5e2c09382954d4c2453 /net/ipv4/arp.c
parent46479b432989d61c6f676adf21b4f4d8abd7bc26 (diff)
[ARP]: Consolidate some code in arp_req_set/delete_publc
The PROXY_ARP is set on devconfigs in a similar way in both calls. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/arp.c')
-rw-r--r--net/ipv4/arp.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index e947ad9409b0..477f3e5fe8d1 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -952,6 +952,19 @@ out_of_mem:
952 * Set (create) an ARP cache entry. 952 * Set (create) an ARP cache entry.
953 */ 953 */
954 954
955static int arp_req_set_proxy(struct net_device *dev, int on)
956{
957 if (dev == NULL) {
958 IPV4_DEVCONF_ALL(PROXY_ARP) = on;
959 return 0;
960 }
961 if (__in_dev_get_rtnl(dev)) {
962 IN_DEV_CONF_SET(__in_dev_get_rtnl(dev), PROXY_ARP, on);
963 return 0;
964 }
965 return -ENXIO;
966}
967
955static int arp_req_set_public(struct arpreq *r, struct net_device *dev) 968static int arp_req_set_public(struct arpreq *r, struct net_device *dev)
956{ 969{
957 __be32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; 970 __be32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
@@ -970,15 +983,8 @@ static int arp_req_set_public(struct arpreq *r, struct net_device *dev)
970 return -ENOBUFS; 983 return -ENOBUFS;
971 return 0; 984 return 0;
972 } 985 }
973 if (dev == NULL) { 986
974 IPV4_DEVCONF_ALL(PROXY_ARP) = 1; 987 return arp_req_set_proxy(dev, 1);
975 return 0;
976 }
977 if (__in_dev_get_rtnl(dev)) {
978 IN_DEV_CONF_SET(__in_dev_get_rtnl(dev), PROXY_ARP, 1);
979 return 0;
980 }
981 return -ENXIO;
982} 988}
983 989
984static int arp_req_set(struct arpreq *r, struct net_device * dev) 990static int arp_req_set(struct arpreq *r, struct net_device * dev)
@@ -1082,19 +1088,10 @@ static int arp_req_delete_public(struct arpreq *r, struct net_device *dev)
1082 if (mask == htonl(0xFFFFFFFF)) 1088 if (mask == htonl(0xFFFFFFFF))
1083 return pneigh_delete(&arp_tbl, &ip, dev); 1089 return pneigh_delete(&arp_tbl, &ip, dev);
1084 1090
1085 if (mask == 0) { 1091 if (mask)
1086 if (dev == NULL) { 1092 return -EINVAL;
1087 IPV4_DEVCONF_ALL(PROXY_ARP) = 0; 1093
1088 return 0; 1094 return arp_req_set_proxy(dev, 0);
1089 }
1090 if (__in_dev_get_rtnl(dev)) {
1091 IN_DEV_CONF_SET(__in_dev_get_rtnl(dev),
1092 PROXY_ARP, 0);
1093 return 0;
1094 }
1095 return -ENXIO;
1096 }
1097 return -EINVAL;
1098} 1095}
1099 1096
1100static int arp_req_delete(struct arpreq *r, struct net_device * dev) 1097static int arp_req_delete(struct arpreq *r, struct net_device * dev)