diff options
Diffstat (limited to 'net/batman-adv/hard-interface.c')
-rw-r--r-- | net/batman-adv/hard-interface.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index f11345e163d7..01acccc4d218 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/rculist.h> | 32 | #include <linux/rculist.h> |
33 | #include <linux/rtnetlink.h> | 33 | #include <linux/rtnetlink.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/spinlock.h> | ||
35 | #include <linux/workqueue.h> | 36 | #include <linux/workqueue.h> |
36 | #include <net/net_namespace.h> | 37 | #include <net/net_namespace.h> |
37 | 38 | ||
@@ -464,7 +465,8 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, | |||
464 | hard_iface->soft_iface = soft_iface; | 465 | hard_iface->soft_iface = soft_iface; |
465 | bat_priv = netdev_priv(hard_iface->soft_iface); | 466 | bat_priv = netdev_priv(hard_iface->soft_iface); |
466 | 467 | ||
467 | ret = netdev_master_upper_dev_link(hard_iface->net_dev, soft_iface); | 468 | ret = netdev_master_upper_dev_link(hard_iface->net_dev, |
469 | soft_iface, NULL, NULL); | ||
468 | if (ret) | 470 | if (ret) |
469 | goto err_dev; | 471 | goto err_dev; |
470 | 472 | ||
@@ -638,9 +640,12 @@ batadv_hardif_add_interface(struct net_device *net_dev) | |||
638 | goto free_sysfs; | 640 | goto free_sysfs; |
639 | 641 | ||
640 | INIT_LIST_HEAD(&hard_iface->list); | 642 | INIT_LIST_HEAD(&hard_iface->list); |
643 | INIT_HLIST_HEAD(&hard_iface->neigh_list); | ||
641 | INIT_WORK(&hard_iface->cleanup_work, | 644 | INIT_WORK(&hard_iface->cleanup_work, |
642 | batadv_hardif_remove_interface_finish); | 645 | batadv_hardif_remove_interface_finish); |
643 | 646 | ||
647 | spin_lock_init(&hard_iface->neigh_list_lock); | ||
648 | |||
644 | hard_iface->num_bcasts = BATADV_NUM_BCASTS_DEFAULT; | 649 | hard_iface->num_bcasts = BATADV_NUM_BCASTS_DEFAULT; |
645 | if (batadv_is_wifi_netdev(net_dev)) | 650 | if (batadv_is_wifi_netdev(net_dev)) |
646 | hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS; | 651 | hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS; |
@@ -708,7 +713,8 @@ static int batadv_hard_if_event(struct notifier_block *this, | |||
708 | } | 713 | } |
709 | 714 | ||
710 | hard_iface = batadv_hardif_get_by_netdev(net_dev); | 715 | hard_iface = batadv_hardif_get_by_netdev(net_dev); |
711 | if (!hard_iface && event == NETDEV_REGISTER) | 716 | if (!hard_iface && (event == NETDEV_REGISTER || |
717 | event == NETDEV_POST_TYPE_CHANGE)) | ||
712 | hard_iface = batadv_hardif_add_interface(net_dev); | 718 | hard_iface = batadv_hardif_add_interface(net_dev); |
713 | 719 | ||
714 | if (!hard_iface) | 720 | if (!hard_iface) |
@@ -723,6 +729,7 @@ static int batadv_hard_if_event(struct notifier_block *this, | |||
723 | batadv_hardif_deactivate_interface(hard_iface); | 729 | batadv_hardif_deactivate_interface(hard_iface); |
724 | break; | 730 | break; |
725 | case NETDEV_UNREGISTER: | 731 | case NETDEV_UNREGISTER: |
732 | case NETDEV_PRE_TYPE_CHANGE: | ||
726 | list_del_rcu(&hard_iface->list); | 733 | list_del_rcu(&hard_iface->list); |
727 | 734 | ||
728 | batadv_hardif_remove_interface(hard_iface); | 735 | batadv_hardif_remove_interface(hard_iface); |