diff options
Diffstat (limited to 'net/ipv4/arp.c')
-rw-r--r-- | net/ipv4/arp.c | 41 |
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 | ||
955 | static 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 | |||
955 | static int arp_req_set_public(struct arpreq *r, struct net_device *dev) | 968 | static 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 | ||
984 | static int arp_req_set(struct arpreq *r, struct net_device * dev) | 990 | static 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 | ||
1100 | static int arp_req_delete(struct arpreq *r, struct net_device * dev) | 1097 | static int arp_req_delete(struct arpreq *r, struct net_device * dev) |