neigh: only allow init_net to change the default neigh_parms
authorGao feng <gaofeng@cn.fujitsu.com>
Thu, 20 Jun 2013 02:01:33 +0000 (10:01 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Jun 2013 04:13:24 +0000 (21:13 -0700)
Though we don't export the /proc/sys/net/ipv[4,6]/neigh/default/
directory to the un-init_net, but we can still use cmd such as
"ip ntable change name arp_cache locktime 129" to change the locktime
of default neigh_parms.

This patch disallows the un-init_net to find out the neigh_table.parms.
So the un-init_net will failed to influence the init_net.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/neighbour.c

index 53eab513955a4bbaa29d2a63f3ba37288693e356..86f9b165bbba69482f151010d05ad8fe6243b293 100644 (file)
@@ -1419,7 +1419,7 @@ static inline struct neigh_parms *lookup_neigh_parms(struct neigh_table *tbl,
 
        for (p = &tbl->parms; p; p = p->next) {
                if ((p->dev && p->dev->ifindex == ifindex && net_eq(neigh_parms_net(p), net)) ||
-                   (!p->dev && !ifindex))
+                   (!p->dev && !ifindex && net_eq(net, &init_net)))
                        return p;
        }