Skip to content

Commit

Permalink
batman-adv: Act on NETDEV_*_TYPE_CHANGE events
Browse files Browse the repository at this point in the history
A network interface can change type. It may change from a type which
batman does not support, e.g. hdlc, to one it does, e.g. hdlc-eth.
When an interface changes type, it sends two notifications. Handle
these notifications.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Andrew Lunn authored and David S. Miller committed Dec 5, 2015
1 parent 3ef0952 commit a1a66b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/batman-adv/hard-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,8 @@ static int batadv_hard_if_event(struct notifier_block *this,
}

hard_iface = batadv_hardif_get_by_netdev(net_dev);
if (!hard_iface && event == NETDEV_REGISTER)
if (!hard_iface && (event == NETDEV_REGISTER ||
event == NETDEV_POST_TYPE_CHANGE))
hard_iface = batadv_hardif_add_interface(net_dev);

if (!hard_iface)
Expand All @@ -724,6 +725,7 @@ static int batadv_hard_if_event(struct notifier_block *this,
batadv_hardif_deactivate_interface(hard_iface);
break;
case NETDEV_UNREGISTER:
case NETDEV_PRE_TYPE_CHANGE:
list_del_rcu(&hard_iface->list);

batadv_hardif_remove_interface(hard_iface);
Expand Down

0 comments on commit a1a66b1

Please sign in to comment.