aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/arp.h2
-rw-r--r--net/ipv4/af_inet.c2
-rw-r--r--net/ipv4/arp.c28
3 files changed, 18 insertions, 14 deletions
diff --git a/include/net/arp.h b/include/net/arp.h
index f02664568600..36482bf9ad36 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -11,7 +11,7 @@ extern struct neigh_table arp_tbl;
11 11
12extern void arp_init(void); 12extern void arp_init(void);
13extern int arp_find(unsigned char *haddr, struct sk_buff *skb); 13extern int arp_find(unsigned char *haddr, struct sk_buff *skb);
14extern int arp_ioctl(unsigned int cmd, void __user *arg); 14extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg);
15extern void arp_send(int type, int ptype, __be32 dest_ip, 15extern void arp_send(int type, int ptype, __be32 dest_ip,
16 struct net_device *dev, __be32 src_ip, 16 struct net_device *dev, __be32 src_ip,
17 unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); 17 unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th);
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 5089a369e99c..03633b7b9b4a 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -798,7 +798,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
798 case SIOCDARP: 798 case SIOCDARP:
799 case SIOCGARP: 799 case SIOCGARP:
800 case SIOCSARP: 800 case SIOCSARP:
801 err = arp_ioctl(cmd, (void __user *)arg); 801 err = arp_ioctl(sk->sk_net, cmd, (void __user *)arg);
802 break; 802 break;
803 case SIOCGIFADDR: 803 case SIOCGIFADDR:
804 case SIOCSIFADDR: 804 case SIOCSIFADDR:
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
955static int arp_req_set_proxy(struct net_device *dev, int on) 955static 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
968static int arp_req_set_public(struct arpreq *r, struct net_device *dev) 968static 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
990static int arp_req_set(struct arpreq *r, struct net_device * dev) 991static 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
1083static int arp_req_delete_public(struct arpreq *r, struct net_device *dev) 1085static 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
1097static int arp_req_delete(struct arpreq *r, struct net_device * dev) 1100static 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
1134int arp_ioctl(unsigned int cmd, void __user *arg) 1138int 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);