]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/core/neighbour.c
[NET] NETNS: Omit net_device->nd_net without CONFIG_NET_NS.
[net-next-2.6.git] / net / core / neighbour.c
index d9a02b2cc28940d1dde4f5f7ee6064f9581b046b..c978bd1cd6592d7bf91b83f03ff24df56ebea9a5 100644 (file)
@@ -388,7 +388,7 @@ struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net,
        hash_val = tbl->hash(pkey, NULL);
        for (n = tbl->hash_buckets[hash_val & tbl->hash_mask]; n; n = n->next) {
                if (!memcmp(n->primary_key, pkey, key_len) &&
-                   (net == n->dev->nd_net)) {
+                   dev_net(n->dev) == net) {
                        neigh_hold(n);
                        NEIGH_CACHE_STAT_INC(tbl, hits);
                        break;
@@ -1284,9 +1284,7 @@ static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl,
        struct neigh_parms *p;
 
        for (p = &tbl->parms; p; p = p->next) {
-               if (p->net != net)
-                       continue;
-               if ((p->dev && p->dev->ifindex == ifindex) ||
+               if ((p->dev && p->dev->ifindex == ifindex && p->net == net) ||
                    (!p->dev && !ifindex))
                        return p;
        }
@@ -1300,7 +1298,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
        struct neigh_parms *p, *ref;
        struct net *net;
 
-       net = dev->nd_net;
+       net = dev_net(dev);
        ref = lookup_neigh_params(tbl, net, 0);
        if (!ref)
                return NULL;
@@ -2052,7 +2050,7 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
                        s_idx = 0;
                for (n = tbl->hash_buckets[h], idx = 0; n; n = n->next) {
                        int lidx;
-                       if (n->dev->nd_net != net)
+                       if (dev_net(n->dev) != net)
                                continue;
                        lidx = idx++;
                        if (lidx < s_idx)
@@ -2157,7 +2155,7 @@ static struct neighbour *neigh_get_first(struct seq_file *seq)
                n = tbl->hash_buckets[bucket];
 
                while (n) {
-                       if (n->dev->nd_net != net)
+                       if (dev_net(n->dev) != net)
                                goto next;
                        if (state->neigh_sub_iter) {
                                loff_t fakep = 0;
@@ -2200,7 +2198,7 @@ static struct neighbour *neigh_get_next(struct seq_file *seq,
 
        while (1) {
                while (n) {
-                       if (n->dev->nd_net != net)
+                       if (dev_net(n->dev) != net)
                                goto next;
                        if (state->neigh_sub_iter) {
                                void *v = state->neigh_sub_iter(state, n, pos);
@@ -2484,7 +2482,7 @@ static inline size_t neigh_nlmsg_size(void)
 
 static void __neigh_notify(struct neighbour *n, int type, int flags)
 {
-       struct net *net = n->dev->nd_net;
+       struct net *net = dev_net(n->dev);
        struct sk_buff *skb;
        int err = -ENOBUFS;
 
@@ -2741,7 +2739,8 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
        neigh_path[NEIGH_CTL_PATH_PROTO].procname = p_name;
        neigh_path[NEIGH_CTL_PATH_PROTO].ctl_name = p_id;
 
-       t->sysctl_header = register_sysctl_paths(neigh_path, t->neigh_vars);
+       t->sysctl_header =
+               register_net_sysctl_table(p->net, neigh_path, t->neigh_vars);
        if (!t->sysctl_header)
                goto free_procname;