From 13fed0d1de11da58dc866b65f6693ee4b5884995 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 19 Dec 2011 15:04:41 -0500 Subject: [PATCH] --- yaml --- r: 279012 b: refs/heads/master c: 447f219190bf0368b8b36cf60155744cb43510df h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/netdevice.h | 1 + trunk/include/net/neighbour.h | 1 + trunk/net/core/neighbour.c | 10 ++++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 5ef96b6d21ee..ce0822c0b96f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 72be84f1c21c0ddba1081291072d7acc9ccddf5f +refs/heads/master: 447f219190bf0368b8b36cf60155744cb43510df diff --git a/trunk/include/linux/netdevice.h b/trunk/include/linux/netdevice.h index 6b9d4edb7c26..603730804da5 100644 --- a/trunk/include/linux/netdevice.h +++ b/trunk/include/linux/netdevice.h @@ -974,6 +974,7 @@ struct net_device_ops { int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); int (*ndo_neigh_construct)(struct neighbour *n); + void (*ndo_neigh_destroy)(struct neighbour *n); }; /* diff --git a/trunk/include/net/neighbour.h b/trunk/include/net/neighbour.h index 6814c4d61c1c..e31f0a86f9b7 100644 --- a/trunk/include/net/neighbour.h +++ b/trunk/include/net/neighbour.h @@ -43,6 +43,7 @@ struct neigh_parms { #endif struct net_device *dev; struct neigh_parms *next; + int (*neigh_setup)(struct neighbour *); void (*neigh_cleanup)(struct neighbour *); struct neigh_table *tbl; diff --git a/trunk/net/core/neighbour.c b/trunk/net/core/neighbour.c index d57a40a2598c..4af151e1bf5d 100644 --- a/trunk/net/core/neighbour.c +++ b/trunk/net/core/neighbour.c @@ -497,6 +497,13 @@ struct neighbour *neigh_create(struct neigh_table *tbl, const void *pkey, } } + /* Device specific setup. */ + if (n->parms->neigh_setup && + (error = n->parms->neigh_setup(n)) < 0) { + rc = ERR_PTR(error); + goto out_neigh_release; + } + n->confirmed = jiffies - (n->parms->base_reachable_time << 1); write_lock_bh(&tbl->lock); @@ -710,6 +717,9 @@ void neigh_destroy(struct neighbour *neigh) skb_queue_purge(&neigh->arp_queue); neigh->arp_queue_len_bytes = 0; + if (dev->netdev_ops->ndo_neigh_destroy) + dev->netdev_ops->ndo_neigh_destroy(neigh); + dev_put(dev); neigh_parms_put(neigh->parms);