diff options
Diffstat (limited to 'net/ipv4/arp.c')
-rw-r--r-- | net/ipv4/arp.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 477f3e5fe8d1..5daf504ba3b3 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -952,7 +952,7 @@ 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) | 955 | static int arp_req_set_proxy(struct net *net, struct net_device *dev, int on) |
956 | { | 956 | { |
957 | if (dev == NULL) { | 957 | if (dev == NULL) { |
958 | IPV4_DEVCONF_ALL(PROXY_ARP) = on; | 958 | IPV4_DEVCONF_ALL(PROXY_ARP) = on; |
@@ -965,7 +965,8 @@ static int arp_req_set_proxy(struct net_device *dev, int on) | |||
965 | return -ENXIO; | 965 | return -ENXIO; |
966 | } | 966 | } |
967 | 967 | ||
968 | static int arp_req_set_public(struct arpreq *r, struct net_device *dev) | 968 | static int arp_req_set_public(struct net *net, struct arpreq *r, |
969 | struct net_device *dev) | ||
969 | { | 970 | { |
970 | __be32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; | 971 | __be32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; |
971 | __be32 mask = ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr; | 972 | __be32 mask = ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr; |
@@ -984,17 +985,18 @@ static int arp_req_set_public(struct arpreq *r, struct net_device *dev) | |||
984 | return 0; | 985 | return 0; |
985 | } | 986 | } |
986 | 987 | ||
987 | return arp_req_set_proxy(dev, 1); | 988 | return arp_req_set_proxy(net, dev, 1); |
988 | } | 989 | } |
989 | 990 | ||
990 | static int arp_req_set(struct arpreq *r, struct net_device * dev) | 991 | static int arp_req_set(struct net *net, struct arpreq *r, |
992 | struct net_device * dev) | ||
991 | { | 993 | { |
992 | __be32 ip; | 994 | __be32 ip; |
993 | struct neighbour *neigh; | 995 | struct neighbour *neigh; |
994 | int err; | 996 | int err; |
995 | 997 | ||
996 | if (r->arp_flags & ATF_PUBL) | 998 | if (r->arp_flags & ATF_PUBL) |
997 | return arp_req_set_public(r, dev); | 999 | return arp_req_set_public(net, r, dev); |
998 | 1000 | ||
999 | ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; | 1001 | ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; |
1000 | if (r->arp_flags & ATF_PERM) | 1002 | if (r->arp_flags & ATF_PERM) |
@@ -1080,7 +1082,8 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev) | |||
1080 | return err; | 1082 | return err; |
1081 | } | 1083 | } |
1082 | 1084 | ||
1083 | static int arp_req_delete_public(struct arpreq *r, struct net_device *dev) | 1085 | static int arp_req_delete_public(struct net *net, struct arpreq *r, |
1086 | struct net_device *dev) | ||
1084 | { | 1087 | { |
1085 | __be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr; | 1088 | __be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr; |
1086 | __be32 mask = ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr; | 1089 | __be32 mask = ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr; |
@@ -1091,17 +1094,18 @@ static int arp_req_delete_public(struct arpreq *r, struct net_device *dev) | |||
1091 | if (mask) | 1094 | if (mask) |
1092 | return -EINVAL; | 1095 | return -EINVAL; |
1093 | 1096 | ||
1094 | return arp_req_set_proxy(dev, 0); | 1097 | return arp_req_set_proxy(net, dev, 0); |
1095 | } | 1098 | } |
1096 | 1099 | ||
1097 | static int arp_req_delete(struct arpreq *r, struct net_device * dev) | 1100 | static int arp_req_delete(struct net *net, struct arpreq *r, |
1101 | struct net_device * dev) | ||
1098 | { | 1102 | { |
1099 | int err; | 1103 | int err; |
1100 | __be32 ip; | 1104 | __be32 ip; |
1101 | struct neighbour *neigh; | 1105 | struct neighbour *neigh; |
1102 | 1106 | ||
1103 | if (r->arp_flags & ATF_PUBL) | 1107 | if (r->arp_flags & ATF_PUBL) |
1104 | return arp_req_delete_public(r, dev); | 1108 | return arp_req_delete_public(net, r, dev); |
1105 | 1109 | ||
1106 | ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; | 1110 | ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; |
1107 | if (dev == NULL) { | 1111 | if (dev == NULL) { |
@@ -1131,7 +1135,7 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev) | |||
1131 | * Handle an ARP layer I/O control request. | 1135 | * Handle an ARP layer I/O control request. |
1132 | */ | 1136 | */ |
1133 | 1137 | ||
1134 | int arp_ioctl(unsigned int cmd, void __user *arg) | 1138 | int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg) |
1135 | { | 1139 | { |
1136 | int err; | 1140 | int err; |
1137 | struct arpreq r; | 1141 | struct arpreq r; |
@@ -1179,10 +1183,10 @@ int arp_ioctl(unsigned int cmd, void __user *arg) | |||
1179 | 1183 | ||
1180 | switch (cmd) { | 1184 | switch (cmd) { |
1181 | case SIOCDARP: | 1185 | case SIOCDARP: |
1182 | err = arp_req_delete(&r, dev); | 1186 | err = arp_req_delete(net, &r, dev); |
1183 | break; | 1187 | break; |
1184 | case SIOCSARP: | 1188 | case SIOCSARP: |
1185 | err = arp_req_set(&r, dev); | 1189 | err = arp_req_set(net, &r, dev); |
1186 | break; | 1190 | break; |
1187 | case SIOCGARP: | 1191 | case SIOCGARP: |
1188 | err = arp_req_get(&r, dev); | 1192 | err = arp_req_get(&r, dev); |