From patchwork Tue Feb 7 09:20:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1513 Return-Path: Received: from nm8-vm0.bullet.mail.ukl.yahoo.com (nm8-vm0.bullet.mail.ukl.yahoo.com [217.146.183.238]) by open-mesh.org (Postfix) with SMTP id 1821C60087F for ; Tue, 7 Feb 2012 10:21:14 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.215] by nm8.bullet.mail.ukl.yahoo.com with NNFMP; 07 Feb 2012 09:21:13 -0000 Received: from [77.238.184.76] by tm8.bullet.mail.ukl.yahoo.com with NNFMP; 07 Feb 2012 09:21:13 -0000 Received: from [127.0.0.1] by smtp145.mail.ukl.yahoo.com with NNFMP; 07 Feb 2012 09:21:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1328606473; bh=Q26kTkCNlN0A4aWgcJVZa8YJyocVad2qhCJ4+9HGoQQ=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=hbKuGa/6P7J2YW8d/rwdCSp8adK4fON0vA021jkKGF+BcW0hmbC0ck7GXLLmYk9Q0knhpkQ1YDrbTxHuRX0aG9fCif6q9mD23Ud5qErYy5VOVIEvoPaRRNvNpYJLtykdRCyGAKW/7NCMA4b/bwKlGXbmhlPgc/2598bKqtEmyro= X-Yahoo-Newman-Id: 657479.91347.bm@smtp145.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: Yoc_pOUVM1lzFisYfTBdFmjubfpGjlJi2Dhoxn1xubmRdXA zk9cyeoZgi4i4YccaxmBIdHBVr4LjPLScYC.3N.Piqc2mW0fcJeEkrEIycfc M.O_Zse46cN._0PJ6XoxExEgJEyf3ZezH2Ai7JuWneI2M9JDwjqclpf7bvGP gZcDMNVcC1zlZDtW7HH0dkXoV32LLz61.h8NZonVc6cGZh4pA3.Y3vx3kw9C Ai9W.DtMMfdUY5eWdYg3DDd_pOvLujMaflPVsrWTXNu1hbHtzcaZX2XMcOXn OFjUBFYlS88o7DEabTgav0_2WOJXt2gHe2j.dpBkxZEPtCf.Hxm564ApKTOi 3l__ZUpQGApQXCuxqNAImhYLlD4.lnDQDJ2hBuGULOf8Pgm.cL6TK4vuSBhR g0Q-- X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@210.177.7.38 with plain) by smtp145.mail.ukl.yahoo.com with SMTP; 07 Feb 2012 09:21:12 +0000 GMT From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Tue, 7 Feb 2012 17:20:47 +0800 Message-Id: <1328606451-3418-3-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1328606451-3418-1-git-send-email-lindner_marek@yahoo.de> References: <201202071719.22804.lindner_marek@yahoo.de> <1328606451-3418-1-git-send-email-lindner_marek@yahoo.de> Cc: Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH 4/8] batman-adv: add iface_disable() callback to routing API X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2012 09:21:14 -0000 Signed-off-by: Marek Lindner --- bat_iv_ogm.c | 7 +++++++ hard-interface.c | 3 +-- main.c | 1 + types.h | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c index 4ac2d1d..98c41f5 100644 --- a/bat_iv_ogm.c +++ b/bat_iv_ogm.c @@ -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; @@ -1186,6 +1192,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, diff --git a/hard-interface.c b/hard-interface.c index 4052444..ec2f478 100644 --- a/hard-interface.c +++ b/hard-interface.c @@ -409,8 +409,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 */ diff --git a/main.c b/main.c index 8bc27e1..c4a9b2b 100644 --- a/main.c +++ b/main.c @@ -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 || diff --git a/types.h b/types.h index c78b925..5e8de0e 100644 --- a/types.h +++ b/types.h @@ -371,6 +371,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 */