]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/arp.c
[NETNS][ICMP]: Make ctl tables for ICMP sysctls per-net.
[linux-2.6-omap-h63xx.git] / net / ipv4 / arp.c
index 6d90ec5242122256c456bdad5f1587e6ec39cb41..3ce2e137e7bc134d6397c278e8994e8804df84be 100644 (file)
@@ -242,7 +242,7 @@ static int arp_constructor(struct neighbour *neigh)
                return -EINVAL;
        }
 
-       neigh->type = inet_addr_type(dev->nd_net, addr);
+       neigh->type = inet_addr_type(dev_net(dev), addr);
 
        parms = in_dev->arp_parms;
        __neigh_parms_put(neigh->parms);
@@ -341,14 +341,14 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
        switch (IN_DEV_ARP_ANNOUNCE(in_dev)) {
        default:
        case 0:         /* By default announce any local IP */
-               if (skb && inet_addr_type(dev->nd_net, ip_hdr(skb)->saddr) == RTN_LOCAL)
+               if (skb && inet_addr_type(dev_net(dev), ip_hdr(skb)->saddr) == RTN_LOCAL)
                        saddr = ip_hdr(skb)->saddr;
                break;
        case 1:         /* Restrict announcements of saddr in same subnet */
                if (!skb)
                        break;
                saddr = ip_hdr(skb)->saddr;
-               if (inet_addr_type(dev->nd_net, saddr) == RTN_LOCAL) {
+               if (inet_addr_type(dev_net(dev), saddr) == RTN_LOCAL) {
                        /* saddr should be known to target */
                        if (inet_addr_onlink(in_dev, target, saddr))
                                break;
@@ -424,7 +424,7 @@ static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
        int flag = 0;
        /*unsigned long now; */
 
-       if (ip_route_output_key(dev->nd_net, &rt, &fl) < 0)
+       if (ip_route_output_key(dev_net(dev), &rt, &fl) < 0)
                return 1;
        if (rt->u.dst.dev != dev) {
                NET_INC_STATS_BH(LINUX_MIB_ARPFILTER);
@@ -477,7 +477,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb)
 
        paddr = skb->rtable->rt_gateway;
 
-       if (arp_set_predefined(inet_addr_type(dev->nd_net, paddr), haddr, paddr, dev))
+       if (arp_set_predefined(inet_addr_type(dev_net(dev), paddr), haddr, paddr, dev))
                return 0;
 
        n = __neigh_lookup(&arp_tbl, &paddr, dev, 1);
@@ -709,7 +709,7 @@ static int arp_process(struct sk_buff *skb)
        u16 dev_type = dev->type;
        int addr_type;
        struct neighbour *n;
-       struct net *net = dev->nd_net;
+       struct net *net = dev_net(dev);
 
        /* arp_rcv below verifies the ARP header and verifies the device
         * is ARP'able.
@@ -858,7 +858,7 @@ static int arp_process(struct sk_buff *skb)
 
        n = __neigh_lookup(&arp_tbl, &sip, dev, 0);
 
-       if (IPV4_DEVCONF_ALL(dev->nd_net, ARP_ACCEPT)) {
+       if (IPV4_DEVCONF_ALL(dev_net(dev), ARP_ACCEPT)) {
                /* Unsolicited ARP is not accepted by default.
                   It is possible, that this option should be enabled for some
                   devices (strip is candidate)
@@ -1377,13 +1377,29 @@ static const struct file_operations arp_seq_fops = {
        .release        = seq_release_net,
 };
 
-static int __init arp_proc_init(void)
+
+static int __net_init arp_net_init(struct net *net)
 {
-       if (!proc_net_fops_create(&init_net, "arp", S_IRUGO, &arp_seq_fops))
+       if (!proc_net_fops_create(net, "arp", S_IRUGO, &arp_seq_fops))
                return -ENOMEM;
        return 0;
 }
 
+static void __net_exit arp_net_exit(struct net *net)
+{
+       proc_net_remove(net, "arp");
+}
+
+static struct pernet_operations arp_net_ops = {
+       .init = arp_net_init,
+       .exit = arp_net_exit,
+};
+
+static int __init arp_proc_init(void)
+{
+       return register_pernet_subsys(&arp_net_ops);
+}
+
 #else /* CONFIG_PROC_FS */
 
 static int __init arp_proc_init(void)