aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/arp.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2008-01-10 06:25:28 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:01:27 -0500
commit6b175b26c1048d331508940ad3516ead1998084f (patch)
tree810b0a18cee4d87c573274fdfd4a59fc624cfed2 /net/ipv4/arp.c
parent8ad4942cd5bdad4143f7aa1d1bd4f7b2526c19c5 (diff)
[NETNS]: Add netns parameter to inet_(dev_)add_type.
The patch extends the inet_addr_type and inet_dev_addr_type with the network namespace pointer. That allows to access the different tables relatively to the network namespace. The modification of the signature function is reported in all the callers of the inet_addr_type using the pointer to the well known init_net. Acked-by: Benjamin Thery <benjamin.thery@bull.net> Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/arp.c')
-rw-r--r--net/ipv4/arp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 46edf1c32a40..3f0730ec0a21 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -235,7 +235,7 @@ static int arp_constructor(struct neighbour *neigh)
235 struct in_device *in_dev; 235 struct in_device *in_dev;
236 struct neigh_parms *parms; 236 struct neigh_parms *parms;
237 237
238 neigh->type = inet_addr_type(addr); 238 neigh->type = inet_addr_type(&init_net, addr);
239 239
240 rcu_read_lock(); 240 rcu_read_lock();
241 in_dev = __in_dev_get_rcu(dev); 241 in_dev = __in_dev_get_rcu(dev);
@@ -341,14 +341,14 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
341 switch (IN_DEV_ARP_ANNOUNCE(in_dev)) { 341 switch (IN_DEV_ARP_ANNOUNCE(in_dev)) {
342 default: 342 default:
343 case 0: /* By default announce any local IP */ 343 case 0: /* By default announce any local IP */
344 if (skb && inet_addr_type(ip_hdr(skb)->saddr) == RTN_LOCAL) 344 if (skb && inet_addr_type(&init_net, ip_hdr(skb)->saddr) == RTN_LOCAL)
345 saddr = ip_hdr(skb)->saddr; 345 saddr = ip_hdr(skb)->saddr;
346 break; 346 break;
347 case 1: /* Restrict announcements of saddr in same subnet */ 347 case 1: /* Restrict announcements of saddr in same subnet */
348 if (!skb) 348 if (!skb)
349 break; 349 break;
350 saddr = ip_hdr(skb)->saddr; 350 saddr = ip_hdr(skb)->saddr;
351 if (inet_addr_type(saddr) == RTN_LOCAL) { 351 if (inet_addr_type(&init_net, saddr) == RTN_LOCAL) {
352 /* saddr should be known to target */ 352 /* saddr should be known to target */
353 if (inet_addr_onlink(in_dev, target, saddr)) 353 if (inet_addr_onlink(in_dev, target, saddr))
354 break; 354 break;
@@ -479,7 +479,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb)
479 479
480 paddr = ((struct rtable*)skb->dst)->rt_gateway; 480 paddr = ((struct rtable*)skb->dst)->rt_gateway;
481 481
482 if (arp_set_predefined(inet_addr_type(paddr), haddr, paddr, dev)) 482 if (arp_set_predefined(inet_addr_type(&init_net, paddr), haddr, paddr, dev))
483 return 0; 483 return 0;
484 484
485 n = __neigh_lookup(&arp_tbl, &paddr, dev, 1); 485 n = __neigh_lookup(&arp_tbl, &paddr, dev, 1);
@@ -806,7 +806,7 @@ static int arp_process(struct sk_buff *skb)
806 /* Special case: IPv4 duplicate address detection packet (RFC2131) */ 806 /* Special case: IPv4 duplicate address detection packet (RFC2131) */
807 if (sip == 0) { 807 if (sip == 0) {
808 if (arp->ar_op == htons(ARPOP_REQUEST) && 808 if (arp->ar_op == htons(ARPOP_REQUEST) &&
809 inet_addr_type(tip) == RTN_LOCAL && 809 inet_addr_type(&init_net, tip) == RTN_LOCAL &&
810 !arp_ignore(in_dev,dev,sip,tip)) 810 !arp_ignore(in_dev,dev,sip,tip))
811 arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha, 811 arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha,
812 dev->dev_addr, sha); 812 dev->dev_addr, sha);
@@ -866,7 +866,7 @@ static int arp_process(struct sk_buff *skb)
866 */ 866 */
867 if (n == NULL && 867 if (n == NULL &&
868 arp->ar_op == htons(ARPOP_REPLY) && 868 arp->ar_op == htons(ARPOP_REPLY) &&
869 inet_addr_type(sip) == RTN_UNICAST) 869 inet_addr_type(&init_net, sip) == RTN_UNICAST)
870 n = __neigh_lookup(&arp_tbl, &sip, dev, 1); 870 n = __neigh_lookup(&arp_tbl, &sip, dev, 1);
871 } 871 }
872 872