Commit 32e569b7 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

[IPV4]: Pass the net pointer to the arp_req_set_proxy()

This one will need to set the IPV4_DEVCONF_ALL(PROXY_ARP), but
there's no ways to get the net right in place, so we have to
pull one from the inet_ioctl's struct sock.
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ea40b324
...@@ -11,7 +11,7 @@ extern struct neigh_table arp_tbl; ...@@ -11,7 +11,7 @@ extern struct neigh_table arp_tbl;
extern void arp_init(void); extern void arp_init(void);
extern int arp_find(unsigned char *haddr, struct sk_buff *skb); extern int arp_find(unsigned char *haddr, struct sk_buff *skb);
extern int arp_ioctl(unsigned int cmd, void __user *arg); extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg);
extern void arp_send(int type, int ptype, __be32 dest_ip, extern void arp_send(int type, int ptype, __be32 dest_ip,
struct net_device *dev, __be32 src_ip, struct net_device *dev, __be32 src_ip,
unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th);
......
...@@ -798,7 +798,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -798,7 +798,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCDARP: case SIOCDARP:
case SIOCGARP: case SIOCGARP:
case SIOCSARP: case SIOCSARP:
err = arp_ioctl(cmd, (void __user *)arg); err = arp_ioctl(sk->sk_net, cmd, (void __user *)arg);
break; break;
case SIOCGIFADDR: case SIOCGIFADDR:
case SIOCSIFADDR: case SIOCSIFADDR:
......
...@@ -952,7 +952,7 @@ static int arp_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -952,7 +952,7 @@ static int arp_rcv(struct sk_buff *skb, struct net_device *dev,
* Set (create) an ARP cache entry. * Set (create) an ARP cache entry.
*/ */
static int arp_req_set_proxy(struct net_device *dev, int on) static int arp_req_set_proxy(struct net *net, struct net_device *dev, int on)
{ {
if (dev == NULL) { if (dev == NULL) {
IPV4_DEVCONF_ALL(PROXY_ARP) = on; IPV4_DEVCONF_ALL(PROXY_ARP) = on;
...@@ -965,7 +965,8 @@ static int arp_req_set_proxy(struct net_device *dev, int on) ...@@ -965,7 +965,8 @@ static int arp_req_set_proxy(struct net_device *dev, int on)
return -ENXIO; return -ENXIO;
} }
static int arp_req_set_public(struct arpreq *r, struct net_device *dev) static int arp_req_set_public(struct net *net, struct arpreq *r,
struct net_device *dev)
{ {
__be32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; __be32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
__be32 mask = ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr; __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,17 +985,18 @@ static int arp_req_set_public(struct arpreq *r, struct net_device *dev)
return 0; return 0;
} }
return arp_req_set_proxy(dev, 1); return arp_req_set_proxy(net, dev, 1);
} }
static int arp_req_set(struct arpreq *r, struct net_device * dev) static int arp_req_set(struct net *net, struct arpreq *r,
struct net_device * dev)
{ {
__be32 ip; __be32 ip;
struct neighbour *neigh; struct neighbour *neigh;
int err; int err;
if (r->arp_flags & ATF_PUBL) if (r->arp_flags & ATF_PUBL)
return arp_req_set_public(r, dev); return arp_req_set_public(net, r, dev);
ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
if (r->arp_flags & ATF_PERM) if (r->arp_flags & ATF_PERM)
...@@ -1080,7 +1082,8 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev) ...@@ -1080,7 +1082,8 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev)
return err; return err;
} }
static int arp_req_delete_public(struct arpreq *r, struct net_device *dev) static int arp_req_delete_public(struct net *net, struct arpreq *r,
struct net_device *dev)
{ {
__be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr; __be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr;
__be32 mask = ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr; __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,17 +1094,18 @@ static int arp_req_delete_public(struct arpreq *r, struct net_device *dev)
if (mask) if (mask)
return -EINVAL; return -EINVAL;
return arp_req_set_proxy(dev, 0); return arp_req_set_proxy(net, dev, 0);
} }
static int arp_req_delete(struct arpreq *r, struct net_device * dev) static int arp_req_delete(struct net *net, struct arpreq *r,
struct net_device * dev)
{ {
int err; int err;
__be32 ip; __be32 ip;
struct neighbour *neigh; struct neighbour *neigh;
if (r->arp_flags & ATF_PUBL) if (r->arp_flags & ATF_PUBL)
return arp_req_delete_public(r, dev); return arp_req_delete_public(net, r, dev);
ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
if (dev == NULL) { if (dev == NULL) {
...@@ -1131,7 +1135,7 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev) ...@@ -1131,7 +1135,7 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev)
* Handle an ARP layer I/O control request. * Handle an ARP layer I/O control request.
*/ */
int arp_ioctl(unsigned int cmd, void __user *arg) int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg)
{ {
int err; int err;
struct arpreq r; struct arpreq r;
...@@ -1179,10 +1183,10 @@ int arp_ioctl(unsigned int cmd, void __user *arg) ...@@ -1179,10 +1183,10 @@ int arp_ioctl(unsigned int cmd, void __user *arg)
switch (cmd) { switch (cmd) {
case SIOCDARP: case SIOCDARP:
err = arp_req_delete(&r, dev); err = arp_req_delete(net, &r, dev);
break; break;
case SIOCSARP: case SIOCSARP:
err = arp_req_set(&r, dev); err = arp_req_set(net, &r, dev);
break; break;
case SIOCGARP: case SIOCGARP:
err = arp_req_get(&r, dev); err = arp_req_get(&r, dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment