In the presence of multiple network namespaces the logic needed to allocate the a default parameter table is just barely non-trivial. So add a function to automate it to make everyone's life easier. Signed-off-by: Eric W. Biederman Signed-off-by: Daniel Lezcano --- include/net/neighbour.h | 1 + net/core/neighbour.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) Index: net-2.6.25/include/net/neighbour.h =================================================================== --- net-2.6.25.orig/include/net/neighbour.h +++ net-2.6.25/include/net/neighbour.h @@ -208,6 +208,7 @@ extern struct neighbour *neigh_event_ns struct net_device *dev); extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl); +extern struct neigh_parms *neigh_parms_alloc_default(struct neigh_table *tbl, struct net *net); extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms); extern void neigh_parms_destroy(struct neigh_parms *parms); extern unsigned long neigh_rand_reach_time(unsigned long base); Index: net-2.6.25/net/core/neighbour.c =================================================================== --- net-2.6.25.orig/net/core/neighbour.c +++ net-2.6.25/net/core/neighbour.c @@ -1327,6 +1327,20 @@ struct neigh_parms *neigh_parms_alloc(st return p; } +struct neigh_parms *neigh_parms_alloc_default(struct neigh_table *tbl, + struct net *net) +{ + struct neigh_parms *parms; + if (net != &init_net) { + parms = neigh_parms_alloc(NULL, tbl); + release_net(parms->net); + parms->net = hold_net(net); + } + else + parms = neigh_parms_clone(&tbl->parms); + return parms; +} + static void neigh_rcu_free_parms(struct rcu_head *head) { struct neigh_parms *parms = @@ -2789,6 +2803,7 @@ EXPORT_SYMBOL(neigh_ifdown); EXPORT_SYMBOL(neigh_lookup); EXPORT_SYMBOL(neigh_lookup_nodev); EXPORT_SYMBOL(neigh_parms_alloc); +EXPORT_SYMBOL(neigh_parms_alloc_default); EXPORT_SYMBOL(neigh_parms_release); EXPORT_SYMBOL(neigh_rand_reach_time); EXPORT_SYMBOL(neigh_resolve_output); -- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html