From patchwork Sun Jan 22 19:00:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Wunderlich X-Patchwork-Id: 1483 Return-Path: Received: from cora.hrz.tu-chemnitz.de (cora.hrz.tu-chemnitz.de [134.109.228.40]) by open-mesh.org (Postfix) with ESMTPS id 342F160084F for ; Sun, 22 Jan 2012 20:00:38 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@tu-chemnitz.de; dkim-adsp=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tu-chemnitz.de; s=dkim2010; h=References:In-Reply-To:Message-Id:Date:Subject:To:From; bh=CTRC5CNxJ9zgR5D0blixGsUY71X6ud3x8U3WAieVhJ8=; b=qU16kvcl1yWJfOBqja0Enu4u3yOrj8OPas8rw77WX+iYFyniXnVJ2nyBiYyBg71d1ERTe9rWgegUFwCaoyc5hWDEYkQy5T6eJLYgfN5MHQeA/51FE1fmDCYKSUNqrtqVTsCSzBsiMg6lkHC2L7rM2c+i0ZwXE1cRhhNoAk3ABsc=; Received: from p57aa022b.dip0.t-ipconnect.de ([87.170.2.43] helo=pandem0nium) by cora.hrz.tu-chemnitz.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1Rp2eY-0002dm-5Y for b.a.t.m.a.n@lists.open-mesh.org; Sun, 22 Jan 2012 20:00:35 +0100 Received: from dotslash by pandem0nium with local (Exim 4.72) (envelope-from ) id 1Rp2eS-0003cY-AV for b.a.t.m.a.n@lists.open-mesh.org; Sun, 22 Jan 2012 20:00:28 +0100 From: Simon Wunderlich To: b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 22 Jan 2012 20:00:27 +0100 Message-Id: <1327258827-13861-11-git-send-email-siwu@hrz.tu-chemnitz.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1327258827-13861-1-git-send-email-siwu@hrz.tu-chemnitz.de> References: <1327258827-13861-1-git-send-email-siwu@hrz.tu-chemnitz.de> X-RBL-Warning: 87.170.2.43 is listed at zen.spamhaus.org X-Scan-AV: cora.hrz.tu-chemnitz.de; 2012-01-22 20:00:34; f52a576b0c44f34fd237c70e3efbf269 X-Scan-SA: cora.hrz.tu-chemnitz.de; 2012-01-22 20:00:35; 0152b5c5893d02375993127b5bcf821c X-Spam-Score: 1.5 (+) X-Spam-Report: --- Textanalyse SpamAssassin 3.3.1 (1.5 Punkte) Fragen an/questions to: Postmaster TU Chemnitz * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 2.5 TUC_RBL RBL: Mail von bekanntem Spam-Relay oder Dialup (TUC) --- Ende Textanalyse Subject: [B.A.T.M.A.N.] [PATCHv3 10/10] batman-adv: add bridge loop avoidance compile option 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: Sun, 22 Jan 2012 19:00:38 -0000 The define CONFIG_BATMAN_ADV_BLA switches the bridge loop avoidance on - skip it, and the bridge loop avoidance is not compiled in. This is useful if binary size should be saved or the feature is not needed. Signed-off-by: Simon Wunderlich --- Makefile | 2 ++ Makefile.kbuild | 2 +- README.external | 1 + bat_debugfs.c | 7 ++++++- bat_sysfs.c | 4 ++++ bridge_loop_avoidance.h | 14 ++++++++++++++ gen-compat-autoconf.sh | 1 + 7 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 776cca4..08f8c39 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,8 @@ # changing the CONFIG_* line to 'y' enables the related feature # B.A.T.M.A.N. debugging: export CONFIG_BATMAN_ADV_DEBUG=n +# B.A.T.M.A.N. bridge loop avoidance: +export CONFIG_BATMAN_ADV_BLA=y PWD:=$(shell pwd) KERNELPATH ?= /lib/modules/$(shell uname -r)/build diff --git a/Makefile.kbuild b/Makefile.kbuild index 94b67fd..6d5c194 100644 --- a/Makefile.kbuild +++ b/Makefile.kbuild @@ -23,7 +23,7 @@ batman-adv-y += bat_debugfs.o batman-adv-y += bat_iv_ogm.o batman-adv-y += bat_sysfs.o batman-adv-y += bitarray.o -batman-adv-y += bridge_loop_avoidance.o +batman-adv-$(CONFIG_BATMAN_ADV_BLA) += bridge_loop_avoidance.o batman-adv-y += gateway_client.o batman-adv-y += gateway_common.o batman-adv-y += hard-interface.o diff --git a/README.external b/README.external index 4aa4763..4a3a504 100644 --- a/README.external +++ b/README.external @@ -36,6 +36,7 @@ module). Available options and their possible values are (default marked with an "*") * CONFIG_BATMAN_ADV_DEBUG=[y|n*] (B.A.T.M.A.N. debugging) + * CONFIG_BATMAN_ADV_BLA=[y*|n] (B.A.T.M.A.N. bridge loop avoidance) e.g., debugging can be enabled by diff --git a/bat_debugfs.c b/bat_debugfs.c index 0e35177..916380c 100644 --- a/bat_debugfs.c +++ b/bat_debugfs.c @@ -245,12 +245,13 @@ static int transtable_global_open(struct inode *inode, struct file *file) return single_open(file, tt_global_seq_print_text, net_dev); } +#ifdef CONFIG_BATMAN_ADV_BLA static int bla_claim_table_open(struct inode *inode, struct file *file) { struct net_device *net_dev = (struct net_device *)inode->i_private; return single_open(file, bla_claim_table_seq_print_text, net_dev); } - +#endif static int transtable_local_open(struct inode *inode, struct file *file) { @@ -285,7 +286,9 @@ static BAT_DEBUGINFO(routing_algos, S_IRUGO, bat_algorithms_open); static BAT_DEBUGINFO(originators, S_IRUGO, originators_open); static BAT_DEBUGINFO(gateways, S_IRUGO, gateways_open); static BAT_DEBUGINFO(transtable_global, S_IRUGO, transtable_global_open); +#ifdef CONFIG_BATMAN_ADV_BLA static BAT_DEBUGINFO(bla_claim_table, S_IRUGO, bla_claim_table_open); +#endif static BAT_DEBUGINFO(transtable_local, S_IRUGO, transtable_local_open); static BAT_DEBUGINFO(vis_data, S_IRUGO, vis_data_open); @@ -293,7 +296,9 @@ static struct bat_debuginfo *mesh_debuginfos[] = { &bat_debuginfo_originators, &bat_debuginfo_gateways, &bat_debuginfo_transtable_global, +#ifdef CONFIG_BATMAN_ADV_BLA &bat_debuginfo_bla_claim_table, +#endif &bat_debuginfo_transtable_local, &bat_debuginfo_vis_data, NULL, diff --git a/bat_sysfs.c b/bat_sysfs.c index 2305cad..3adb183 100644 --- a/bat_sysfs.c +++ b/bat_sysfs.c @@ -386,7 +386,9 @@ static ssize_t store_gw_bwidth(struct kobject *kobj, struct attribute *attr, BAT_ATTR_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); BAT_ATTR_BOOL(bonding, S_IRUGO | S_IWUSR, NULL); +#ifdef CONFIG_BATMAN_ADV_BLA BAT_ATTR_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL); +#endif BAT_ATTR_BOOL(fragmentation, S_IRUGO | S_IWUSR, update_min_mtu); BAT_ATTR_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL); static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode); @@ -405,7 +407,9 @@ BAT_ATTR_UINT(log_level, S_IRUGO | S_IWUSR, 0, 15, NULL); static struct bat_attribute *mesh_attrs[] = { &bat_attr_aggregated_ogms, &bat_attr_bonding, +#ifdef CONFIG_BATMAN_ADV_BLA &bat_attr_bridge_loop_avoidance, +#endif &bat_attr_fragmentation, &bat_attr_ap_isolation, &bat_attr_vis_mode, diff --git a/bridge_loop_avoidance.h b/bridge_loop_avoidance.h index 9468c24..24d7f16 100644 --- a/bridge_loop_avoidance.h +++ b/bridge_loop_avoidance.h @@ -22,6 +22,7 @@ #ifndef _NET_BATMAN_ADV_BLA_H_ #define _NET_BATMAN_ADV_BLA_H_ +#ifdef CONFIG_BATMAN_ADV_BLA int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid); int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid); int bla_is_backbone_gw(struct sk_buff *skb, @@ -37,5 +38,18 @@ int bla_init(struct bat_priv *bat_priv); void bla_free(struct bat_priv *bat_priv); #define BLA_CRC_INIT 0 +#else /* ifdef CONFIG_BATMAN_ADV_BLA */ + +#define bla_rx(...) (0) +#define bla_tx(...) (0) +#define bla_is_backbone_gw(...) (0) +#define bla_claim_table_seq_print_text (0) +#define bla_is_backbone_gw_orig(...) (0) +#define bla_check_bcast_duplist(...) (0) +#define bla_update_orig_address(...) {} +#define bla_init(...) (1) +#define bla_free(...) {} + +#endif /* ifdef CONFIG_BATMAN_ADV_BLA */ #endif /* ifndef _NET_BATMAN_ADV_BLA_H_ */ diff --git a/gen-compat-autoconf.sh b/gen-compat-autoconf.sh index 1a020c1..7cf621b 100755 --- a/gen-compat-autoconf.sh +++ b/gen-compat-autoconf.sh @@ -37,6 +37,7 @@ gen_config() { # write config variables gen_config 'CONFIG_BATMAN_ADV_DEBUG' ${CONFIG_BATMAN_ADV_DEBUG:="n"} >> "${TMP}" +gen_config 'CONFIG_BATMAN_ADV_BLA' ${CONFIG_BATMAN_ADV_BLA:="y"} >> "${TMP}" # only regenerate compat-autoconf.h when config was changed diff "${TMP}" "${TARGET}" > /dev/null 2>&1 || cp "${TMP}" "${TARGET}"