batman-adv: add iface_disable() callback to routing API
authorMarek Lindner <lindner_marek@yahoo.de>
Tue, 7 Feb 2012 09:20:47 +0000 (17:20 +0800)
committerAntonio Quartulli <ordex@autistici.org>
Wed, 18 Apr 2012 07:53:59 +0000 (09:53 +0200)
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
net/batman-adv/bat_iv_ogm.c
net/batman-adv/hard-interface.c
net/batman-adv/main.c
net/batman-adv/types.h

index 95bfc5962e1ad1881adc6e8a15677d2bc027dbe7..4cc66db699ed50a8dea191fd7a1ed2e90e03d830 100644 (file)
@@ -52,6 +52,12 @@ static void bat_iv_ogm_iface_enable(struct hard_iface *hard_iface)
        batman_ogm_packet->ttvn = 0;
 }
 
+static void bat_iv_ogm_iface_disable(struct hard_iface *hard_iface)
+{
+       kfree(hard_iface->packet_buff);
+       hard_iface->packet_buff = NULL;
+}
+
 static void bat_iv_ogm_init_primary(struct hard_iface *hard_iface)
 {
        struct batman_ogm_packet *batman_ogm_packet;
@@ -1175,6 +1181,7 @@ static void bat_iv_ogm_receive(struct hard_iface *if_incoming,
 static struct bat_algo_ops batman_iv __read_mostly = {
        .name = "BATMAN IV",
        .bat_iface_enable = bat_iv_ogm_iface_enable,
+       .bat_iface_disable = bat_iv_ogm_iface_disable,
        .bat_ogm_init_primary = bat_iv_ogm_init_primary,
        .bat_ogm_update_mac = bat_iv_ogm_update_mac,
        .bat_ogm_schedule = bat_iv_ogm_schedule,
index 4d9b85ddd93abbcd3e85f18936efb8bfb9b229de..fd9715ec6dbdcb223d4885e47bb4f0e9a9938245 100644 (file)
@@ -397,8 +397,7 @@ void hardif_disable_interface(struct hard_iface *hard_iface)
                        hardif_free_ref(new_if);
        }
 
-       kfree(hard_iface->packet_buff);
-       hard_iface->packet_buff = NULL;
+       bat_priv->bat_algo_ops->bat_iface_disable(hard_iface);
        hard_iface->if_status = IF_NOT_IN_USE;
 
        /* delete all references to this hard_iface */
index ca8f395471057c78a2be06582560a55ccff0a4a4..a47a6ced1cb7cd552eb9e37c54fd2e4309042890 100644 (file)
@@ -209,6 +209,7 @@ int bat_algo_register(struct bat_algo_ops *bat_algo_ops)
 
        /* all algorithms must implement all ops (for now) */
        if (!bat_algo_ops->bat_iface_enable ||
+           !bat_algo_ops->bat_iface_disable ||
            !bat_algo_ops->bat_ogm_init_primary ||
            !bat_algo_ops->bat_ogm_update_mac ||
            !bat_algo_ops->bat_ogm_schedule ||
index 4b9224829a6c3edffe447c2d131db9ec8067a996..b034cf23bc9a2ed608044062814e119a8e1cce77 100644 (file)
@@ -379,6 +379,8 @@ struct bat_algo_ops {
        char *name;
        /* init routing info when hard-interface is enabled */
        void (*bat_iface_enable)(struct hard_iface *hard_iface);
+       /* de-init routing info when hard-interface is disabled */
+       void (*bat_iface_disable)(struct hard_iface *hard_iface);
        /* init primary OGM when primary interface is selected */
        void (*bat_ogm_init_primary)(struct hard_iface *hard_iface);
        /* init mac addresses of the OGM belonging to this hard-interface */