aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--net/core/neighbour.c15
2 files changed, 16 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5462c2cd5eab..1c4ddb37f2b5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -974,6 +974,8 @@ struct net_device_ops {
974 netdev_features_t features); 974 netdev_features_t features);
975 int (*ndo_set_features)(struct net_device *dev, 975 int (*ndo_set_features)(struct net_device *dev,
976 netdev_features_t features); 976 netdev_features_t features);
977 int (*ndo_neigh_construct)(struct neighbour *n);
978 int (*ndo_neigh_destroy)(struct neighbour *n);
977}; 979};
978 980
979/* 981/*
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index ef750ff7497e..cdf8dc34f0ba 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -489,6 +489,14 @@ struct neighbour *neigh_create(struct neigh_table *tbl, const void *pkey,
489 goto out_neigh_release; 489 goto out_neigh_release;
490 } 490 }
491 491
492 if (dev->netdev_ops->ndo_neigh_construct) {
493 error = dev->netdev_ops->ndo_neigh_construct(n);
494 if (error < 0) {
495 rc = ERR_PTR(error);
496 goto out_neigh_release;
497 }
498 }
499
492 /* Device specific setup. */ 500 /* Device specific setup. */
493 if (n->parms->neigh_setup && 501 if (n->parms->neigh_setup &&
494 (error = n->parms->neigh_setup(n)) < 0) { 502 (error = n->parms->neigh_setup(n)) < 0) {
@@ -692,6 +700,8 @@ static inline void neigh_parms_put(struct neigh_parms *parms)
692 */ 700 */
693void neigh_destroy(struct neighbour *neigh) 701void neigh_destroy(struct neighbour *neigh)
694{ 702{
703 struct net_device *dev = neigh->dev;
704
695 NEIGH_CACHE_STAT_INC(neigh->tbl, destroys); 705 NEIGH_CACHE_STAT_INC(neigh->tbl, destroys);
696 706
697 if (!neigh->dead) { 707 if (!neigh->dead) {
@@ -707,7 +717,10 @@ void neigh_destroy(struct neighbour *neigh)
707 skb_queue_purge(&neigh->arp_queue); 717 skb_queue_purge(&neigh->arp_queue);
708 neigh->arp_queue_len_bytes = 0; 718 neigh->arp_queue_len_bytes = 0;
709 719
710 dev_put(neigh->dev); 720 if (dev->netdev_ops->ndo_neigh_destroy)
721 dev->netdev_ops->ndo_neigh_destroy(neigh);
722
723 dev_put(dev);
711 neigh_parms_put(neigh->parms); 724 neigh_parms_put(neigh->parms);
712 725
713 NEIGH_PRINTK2("neigh %p is destroyed.\n", neigh); 726 NEIGH_PRINTK2("neigh %p is destroyed.\n", neigh);