[commits] [batman-adv] next: batman-adv: Act on NETDEV_*_TYPE_CHANGE events (399bf29)

postmaster at open-mesh.org postmaster at open-mesh.org
Sun Dec 13 07:23:14 CET 2015


Repository : ssh://git@open-mesh.org/batman-adv

On branch  : next

>---------------------------------------------------------------

commit 399bf29c6a307fdcc835a8b7262bce56df71f977
Author: Andrew Lunn <andrew at lunn.ch>
Date:   Tue Dec 8 21:35:58 2015 +0100

    batman-adv: Act on NETDEV_*_TYPE_CHANGE events
    
    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 at lunn.ch>
    Signed-off-by: David S. Miller <davem at davemloft.net>
    Signed-off-by: Marek Lindner <mareklindner at neomailbox.ch>


>---------------------------------------------------------------

399bf29c6a307fdcc835a8b7262bce56df71f977
 compat-include/linux/netdevice.h | 3 +++
 net/batman-adv/hard-interface.c  | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/compat-include/linux/netdevice.h b/compat-include/linux/netdevice.h
index 34e5ac7..10253e0 100644
--- a/compat-include/linux/netdevice.h
+++ b/compat-include/linux/netdevice.h
@@ -58,6 +58,9 @@ struct batadv_dev_addr_list {
 	int da_gusers;
 };
 
+#define NETDEV_PRE_TYPE_CHANGE	0x000E
+#define NETDEV_POST_TYPE_CHANGE	0x000F
+
 #endif /* < KERNEL_VERSION(2, 6, 35) */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 2d1470f..49e05d2 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -714,7 +714,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)
@@ -729,6 +730,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);



More information about the commits mailing list