public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: Add the backbone gateway list to debugfs
@ 2012-06-14 16:43 Simon Wunderlich
  2012-06-14 16:51 ` [B.A.T.M.A.N.] [PATCHv2] " Simon Wunderlich
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Wunderlich @ 2012-06-14 16:43 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Simon Wunderlich

This is especially useful if there are no claims yet, but we still want
to know which gateways are using bridge loop avoidance in the network.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
 bridge_loop_avoidance.c |   68 +++++++++++++++++++++++++++++++++++++++++++++++
 bridge_loop_avoidance.h |    8 ++++++
 debugfs.c               |   12 +++++++++
 3 files changed, 88 insertions(+)

diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index 38aab1e..f3c6dc0 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
@@ -1592,3 +1592,71 @@ out:
 		batadv_hardif_free_ref(primary_if);
 	return ret;
 }
+
+int batadv_bla_gw_table_seq_print_text(struct seq_file *seq, void *offset)
+{
+	struct net_device *net_dev = (struct net_device *)seq->private;
+	struct batadv_priv *bat_priv = netdev_priv(net_dev);
+	struct batadv_hashtable *hash = bat_priv->backbone_hash;
+	struct batadv_backbone_gw *backbone_gw;
+	struct batadv_hard_iface *primary_if;
+	struct hlist_node *node;
+	struct hlist_head *head;
+	int last_seen_secs;
+	int last_seen_msecs;
+	uint32_t i;
+	bool is_own;
+	int ret = 0;
+	uint8_t *primary_addr;
+
+	primary_if = batadv_primary_if_get_selected(bat_priv);
+	if (!primary_if) {
+		ret = seq_printf(seq,
+				 "BATMAN mesh %s disabled - please specify interfaces to enable it\n",
+				 net_dev->name);
+		goto out;
+	}
+
+	if (primary_if->if_status != BATADV_IF_ACTIVE) {
+		ret = seq_printf(seq,
+				 "BATMAN mesh %s disabled - primary interface not active\n",
+				 net_dev->name);
+		goto out;
+	}
+
+	primary_addr = primary_if->net_dev->dev_addr;
+	seq_printf(seq,
+		   "Backbones announced for the mesh %s (orig %pM, group id %04x)\n",
+		   net_dev->name, primary_addr,
+		   ntohs(bat_priv->claim_dest.group));
+	seq_printf(seq, "   %-17s    %-5s %-9s (%-4s)\n",
+		   "Originator", "VID", "last seen", "CRC");
+	for (i = 0; i < hash->size; i++) {
+		head = &hash->table[i];
+
+		rcu_read_lock();
+		hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
+			last_seen_msecs = jiffies_to_msecs(jiffies -
+							backbone_gw->lasttime);
+			last_seen_secs = last_seen_msecs / 1000;
+			last_seen_msecs = last_seen_msecs % 1000;
+
+
+			is_own = batadv_compare_eth(backbone_gw->orig,
+						    primary_addr);
+			if (is_own)
+				continue;
+
+			seq_printf(seq,
+				   " * %pM on % 5d % 4i.%03is (%04x)\n",
+				   backbone_gw->orig, backbone_gw->vid,
+				   last_seen_secs, last_seen_msecs,
+				   backbone_gw->crc);
+		}
+		rcu_read_unlock();
+	}
+out:
+	if (primary_if)
+		batadv_hardif_free_ref(primary_if);
+	return ret;
+}
diff --git a/bridge_loop_avoidance.h b/bridge_loop_avoidance.h
index 08d13cb..58015ce 100644
--- a/bridge_loop_avoidance.h
+++ b/bridge_loop_avoidance.h
@@ -26,6 +26,8 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid);
 int batadv_bla_is_backbone_gw(struct sk_buff *skb,
 			      struct batadv_orig_node *orig_node, int hdr_size);
 int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset);
+int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
+					     void *offset);
 int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig);
 int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
 				   struct batadv_bcast_packet *bcast_packet,
@@ -64,6 +66,12 @@ static inline int batadv_bla_claim_table_seq_print_text(struct seq_file *seq,
 	return 0;
 }
 
+static inline int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
+							void *offset)
+{
+	return 0;
+}
+
 static inline int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv,
 						 uint8_t *orig)
 {
diff --git a/debugfs.c b/debugfs.c
index e45cf0e..ee8b322 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -263,6 +263,15 @@ static int batadv_bla_claim_table_open(struct inode *inode, struct file *file)
 	return single_open(file, batadv_bla_claim_table_seq_print_text,
 			   net_dev);
 }
+
+static int batadv_bla_backbone_table_open(struct inode *inode,
+					  struct file *file)
+{
+	struct net_device *net_dev = (struct net_device *)inode->i_private;
+	return single_open(file, batadv_bla_backbone_table_seq_print_text,
+			   net_dev);
+}
+
 #endif
 
 static int batadv_transtable_local_open(struct inode *inode, struct file *file)
@@ -301,6 +310,8 @@ static BATADV_DEBUGINFO(transtable_global, S_IRUGO,
 			batadv_transtable_global_open);
 #ifdef CONFIG_BATMAN_ADV_BLA
 static BATADV_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open);
+static BATADV_DEBUGINFO(bla_backbone_table, S_IRUGO,
+			batadv_bla_backbone_table_open);
 #endif
 static BATADV_DEBUGINFO(transtable_local, S_IRUGO,
 			batadv_transtable_local_open);
@@ -312,6 +323,7 @@ static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {
 	&batadv_debuginfo_transtable_global,
 #ifdef CONFIG_BATMAN_ADV_BLA
 	&batadv_debuginfo_bla_claim_table,
+	&batadv_debuginfo_bla_backbone_table,
 #endif
 	&batadv_debuginfo_transtable_local,
 	&batadv_debuginfo_vis_data,
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [B.A.T.M.A.N.] [PATCHv2] batman-adv: Add the backbone gateway list to debugfs
  2012-06-14 16:43 [B.A.T.M.A.N.] [PATCH] batman-adv: Add the backbone gateway list to debugfs Simon Wunderlich
@ 2012-06-14 16:51 ` Simon Wunderlich
  2012-06-14 20:43   ` Sven Eckelmann
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Wunderlich @ 2012-06-14 16:51 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Simon Wunderlich

This is especially useful if there are no claims yet, but we still want
to know which gateways are using bridge loop avoidance in the network.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
[EDIT: forgot to rename the function ...]
---
 bridge_loop_avoidance.c |   68 +++++++++++++++++++++++++++++++++++++++++++++++
 bridge_loop_avoidance.h |    8 ++++++
 debugfs.c               |   12 +++++++++
 3 files changed, 88 insertions(+)

diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index 38aab1e..75587af 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
@@ -1592,3 +1592,71 @@ out:
 		batadv_hardif_free_ref(primary_if);
 	return ret;
 }
+
+int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
+{
+	struct net_device *net_dev = (struct net_device *)seq->private;
+	struct batadv_priv *bat_priv = netdev_priv(net_dev);
+	struct batadv_hashtable *hash = bat_priv->backbone_hash;
+	struct batadv_backbone_gw *backbone_gw;
+	struct batadv_hard_iface *primary_if;
+	struct hlist_node *node;
+	struct hlist_head *head;
+	int last_seen_secs;
+	int last_seen_msecs;
+	uint32_t i;
+	bool is_own;
+	int ret = 0;
+	uint8_t *primary_addr;
+
+	primary_if = batadv_primary_if_get_selected(bat_priv);
+	if (!primary_if) {
+		ret = seq_printf(seq,
+				 "BATMAN mesh %s disabled - please specify interfaces to enable it\n",
+				 net_dev->name);
+		goto out;
+	}
+
+	if (primary_if->if_status != BATADV_IF_ACTIVE) {
+		ret = seq_printf(seq,
+				 "BATMAN mesh %s disabled - primary interface not active\n",
+				 net_dev->name);
+		goto out;
+	}
+
+	primary_addr = primary_if->net_dev->dev_addr;
+	seq_printf(seq,
+		   "Backbones announced for the mesh %s (orig %pM, group id %04x)\n",
+		   net_dev->name, primary_addr,
+		   ntohs(bat_priv->claim_dest.group));
+	seq_printf(seq, "   %-17s    %-5s %-9s (%-4s)\n",
+		   "Originator", "VID", "last seen", "CRC");
+	for (i = 0; i < hash->size; i++) {
+		head = &hash->table[i];
+
+		rcu_read_lock();
+		hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
+			last_seen_msecs = jiffies_to_msecs(jiffies -
+							backbone_gw->lasttime);
+			last_seen_secs = last_seen_msecs / 1000;
+			last_seen_msecs = last_seen_msecs % 1000;
+
+
+			is_own = batadv_compare_eth(backbone_gw->orig,
+						    primary_addr);
+			if (is_own)
+				continue;
+
+			seq_printf(seq,
+				   " * %pM on % 5d % 4i.%03is (%04x)\n",
+				   backbone_gw->orig, backbone_gw->vid,
+				   last_seen_secs, last_seen_msecs,
+				   backbone_gw->crc);
+		}
+		rcu_read_unlock();
+	}
+out:
+	if (primary_if)
+		batadv_hardif_free_ref(primary_if);
+	return ret;
+}
diff --git a/bridge_loop_avoidance.h b/bridge_loop_avoidance.h
index 08d13cb..58015ce 100644
--- a/bridge_loop_avoidance.h
+++ b/bridge_loop_avoidance.h
@@ -26,6 +26,8 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid);
 int batadv_bla_is_backbone_gw(struct sk_buff *skb,
 			      struct batadv_orig_node *orig_node, int hdr_size);
 int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset);
+int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
+					     void *offset);
 int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig);
 int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
 				   struct batadv_bcast_packet *bcast_packet,
@@ -64,6 +66,12 @@ static inline int batadv_bla_claim_table_seq_print_text(struct seq_file *seq,
 	return 0;
 }
 
+static inline int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
+							void *offset)
+{
+	return 0;
+}
+
 static inline int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv,
 						 uint8_t *orig)
 {
diff --git a/debugfs.c b/debugfs.c
index e45cf0e..ee8b322 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -263,6 +263,15 @@ static int batadv_bla_claim_table_open(struct inode *inode, struct file *file)
 	return single_open(file, batadv_bla_claim_table_seq_print_text,
 			   net_dev);
 }
+
+static int batadv_bla_backbone_table_open(struct inode *inode,
+					  struct file *file)
+{
+	struct net_device *net_dev = (struct net_device *)inode->i_private;
+	return single_open(file, batadv_bla_backbone_table_seq_print_text,
+			   net_dev);
+}
+
 #endif
 
 static int batadv_transtable_local_open(struct inode *inode, struct file *file)
@@ -301,6 +310,8 @@ static BATADV_DEBUGINFO(transtable_global, S_IRUGO,
 			batadv_transtable_global_open);
 #ifdef CONFIG_BATMAN_ADV_BLA
 static BATADV_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open);
+static BATADV_DEBUGINFO(bla_backbone_table, S_IRUGO,
+			batadv_bla_backbone_table_open);
 #endif
 static BATADV_DEBUGINFO(transtable_local, S_IRUGO,
 			batadv_transtable_local_open);
@@ -312,6 +323,7 @@ static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {
 	&batadv_debuginfo_transtable_global,
 #ifdef CONFIG_BATMAN_ADV_BLA
 	&batadv_debuginfo_bla_claim_table,
+	&batadv_debuginfo_bla_backbone_table,
 #endif
 	&batadv_debuginfo_transtable_local,
 	&batadv_debuginfo_vis_data,
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv2] batman-adv: Add the backbone gateway list to debugfs
  2012-06-14 16:51 ` [B.A.T.M.A.N.] [PATCHv2] " Simon Wunderlich
@ 2012-06-14 20:43   ` Sven Eckelmann
  2012-06-15  8:47     ` Simon Wunderlich
  0 siblings, 1 reply; 14+ messages in thread
From: Sven Eckelmann @ 2012-06-14 20:43 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking
  Cc: Simon Wunderlich

[-- Attachment #1: Type: text/plain, Size: 605 bytes --]

On Thursday 14 June 2012 18:51:59 Simon Wunderlich wrote:
> This is especially useful if there are no claims yet, but we still want
> to know which gateways are using bridge loop avoidance in the network.
> 
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
> [EDIT: forgot to rename the function ...]
> ---
>  bridge_loop_avoidance.c |   68
> +++++++++++++++++++++++++++++++++++++++++++++++ bridge_loop_avoidance.h |  
>  8 ++++++
>  debugfs.c               |   12 +++++++++
>  3 files changed, 88 insertions(+)

You forgot the README and most likely the batctl part.

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv2] batman-adv: Add the backbone gateway list to debugfs
  2012-06-14 20:43   ` Sven Eckelmann
@ 2012-06-15  8:47     ` Simon Wunderlich
  2012-06-15  9:46       ` [B.A.T.M.A.N.] [PATCH] batctl: add support for the bla backbone table in debugfs Simon Wunderlich
  2012-06-15  9:46       ` [B.A.T.M.A.N.] [PATCHv3] batman-adv: Add the backbone gateway list to debugfs Simon Wunderlich
  0 siblings, 2 replies; 14+ messages in thread
From: Simon Wunderlich @ 2012-06-15  8:47 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking
  Cc: Simon Wunderlich

[-- Attachment #1: Type: text/plain, Size: 224 bytes --]

Hey Sven,

On Thu, Jun 14, 2012 at 10:43:55PM +0200, Sven Eckelmann wrote:
> You forgot the README and most likely the batctl part.

I planned to send the batctl patch later, but README is definitly
missing. Thanks!

	Simon

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [B.A.T.M.A.N.] [PATCH] batctl: add support for the bla backbone table in debugfs
  2012-06-15  8:47     ` Simon Wunderlich
@ 2012-06-15  9:46       ` Simon Wunderlich
  2012-06-16  8:29         ` Marek Lindner
  2012-06-15  9:46       ` [B.A.T.M.A.N.] [PATCHv3] batman-adv: Add the backbone gateway list to debugfs Simon Wunderlich
  1 sibling, 1 reply; 14+ messages in thread
From: Simon Wunderlich @ 2012-06-15  9:46 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Simon Wunderlich

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
 debug.c |   10 ++++++++++
 debug.h |    2 ++
 main.c  |    6 ++++++
 3 files changed, 18 insertions(+)

diff --git a/debug.c b/debug.c
index 928f81d..5dca633 100644
--- a/debug.c
+++ b/debug.c
@@ -70,6 +70,16 @@ void bla_claim_table_usage(void)
 	printf(" \t -w [interval] watch mode - refresh the bridge loop avoidance claim table continuously\n");
 }
 
+void bla_backbone_table_usage(void)
+{
+	printf("Usage: batctl [options] backbone table\n");
+	printf("options:\n");
+	printf(" \t -h print this help\n");
+	printf(" \t -n don't replace mac addresses with bat-host names\n");
+	printf(" \t -w [interval] watch mode - refresh the bridge loop avoidance backbone table continuously\n");
+}
+
+
 void gateways_usage(void)
 {
 	printf("Usage: batctl [options] gateways \n");
diff --git a/debug.h b/debug.h
index 50d0e24..2c6d24c 100644
--- a/debug.h
+++ b/debug.h
@@ -25,6 +25,7 @@
 #define DEBUG_TRANSTABLE_LOCAL "transtable_local"
 #define DEBUG_TRANSTABLE_GLOBAL "transtable_global"
 #define DEBUG_BLA_CLAIM_TABLE "bla_claim_table"
+#define DEBUG_BLA_BACKBONE_TABLE "bla_backbone_table"
 #define DEBUG_GATEWAYS "gateways"
 #define DEBUG_VIS_DATA "vis_data"
 #define DEBUG_LOG "log"
@@ -33,6 +34,7 @@ void originators_usage(void);
 void trans_local_usage(void);
 void trans_global_usage(void);
 void bla_claim_table_usage(void);
+void bla_backbone_table_usage(void);
 void gateways_usage(void);
 int handle_debug_table(char *mesh_iface, int argc, char **argv,
 		       char *file_path, void table_usage(void));
diff --git a/main.c b/main.c
index 72b1ea4..929b762 100644
--- a/main.c
+++ b/main.c
@@ -56,6 +56,7 @@ void print_usage(void) {
 	printf(" \ttranslocal|tl                                \tdisplay the local translation table\n");
 	printf(" \ttransglobal|tg                               \tdisplay the global translation table\n");
 	printf(" \tclaimtable|cl                                \tdisplay the bridge loop avoidance claim table\n");
+	printf(" \tbackbonetable|bbl                            \tdisplay the bridge loop avoidance backbone table\n");
 	printf(" \tvis_mode|vm                [mode]            \tdisplay or modify the status of the VIS server\n");
 	printf(" \tvis_data|vd                [dot|JSON]        \tdisplay the VIS data in dot or JSON format\n");
 	printf(" \taggregation|ag             [0|1]             \tdisplay or modify the packet aggregation setting\n");
@@ -158,6 +159,11 @@ int main(int argc, char **argv)
 
 		ret = handle_debug_table(mesh_iface, argc - 1, argv + 1,
 					 DEBUG_BLA_CLAIM_TABLE, bla_claim_table_usage);
+	} else if ((strcmp(argv[1], "backbonetable") == 0) || (strcmp(argv[1], "bbl") == 0)) {
+
+		ret = handle_debug_table(mesh_iface, argc - 1, argv + 1,
+					 DEBUG_BLA_BACKBONE_TABLE,
+					 bla_backbone_table_usage);
 
 	} else if ((strcmp(argv[1], "loglevel") == 0) || (strcmp(argv[1], "ll") == 0)) {
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [B.A.T.M.A.N.] [PATCHv3] batman-adv: Add the backbone gateway list to debugfs
  2012-06-15  8:47     ` Simon Wunderlich
  2012-06-15  9:46       ` [B.A.T.M.A.N.] [PATCH] batctl: add support for the bla backbone table in debugfs Simon Wunderlich
@ 2012-06-15  9:46       ` Simon Wunderlich
  2012-06-16  6:37         ` Sven Eckelmann
  1 sibling, 1 reply; 14+ messages in thread
From: Simon Wunderlich @ 2012-06-15  9:46 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Simon Wunderlich

This is especially useful if there are no claims yet, but we still want
to know which gateways are using bridge loop avoidance in the network.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
[EDITv2: forgot to rename the function ...]
[EDITv3: add README entry]
---
 README                  |    7 ++---
 bridge_loop_avoidance.c |   68 +++++++++++++++++++++++++++++++++++++++++++++++
 bridge_loop_avoidance.h |    8 ++++++
 debugfs.c               |   12 +++++++++
 4 files changed, 92 insertions(+), 3 deletions(-)

diff --git a/README b/README
index 8f3ae4a..a173d2a 100644
--- a/README
+++ b/README
@@ -75,9 +75,10 @@ folder:
 
 There is a special folder for debugging information:
 
-#  ls /sys/kernel/debug/batman_adv/bat0/
-# bla_claim_table    log                socket             transtable_local
-# gateways           originators        transtable_global  vis_data
+# ls /sys/kernel/debug/batman_adv/bat0/
+# bla_backbone_table  log                 transtable_global
+# bla_claim_table     originators         transtable_local
+# gateways            socket              vis_data
 
 Some of the files contain all sort of status information  regard-
 ing  the  mesh  network.  For  example, you can view the table of
diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index 38aab1e..75587af 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
@@ -1592,3 +1592,71 @@ out:
 		batadv_hardif_free_ref(primary_if);
 	return ret;
 }
+
+int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
+{
+	struct net_device *net_dev = (struct net_device *)seq->private;
+	struct batadv_priv *bat_priv = netdev_priv(net_dev);
+	struct batadv_hashtable *hash = bat_priv->backbone_hash;
+	struct batadv_backbone_gw *backbone_gw;
+	struct batadv_hard_iface *primary_if;
+	struct hlist_node *node;
+	struct hlist_head *head;
+	int last_seen_secs;
+	int last_seen_msecs;
+	uint32_t i;
+	bool is_own;
+	int ret = 0;
+	uint8_t *primary_addr;
+
+	primary_if = batadv_primary_if_get_selected(bat_priv);
+	if (!primary_if) {
+		ret = seq_printf(seq,
+				 "BATMAN mesh %s disabled - please specify interfaces to enable it\n",
+				 net_dev->name);
+		goto out;
+	}
+
+	if (primary_if->if_status != BATADV_IF_ACTIVE) {
+		ret = seq_printf(seq,
+				 "BATMAN mesh %s disabled - primary interface not active\n",
+				 net_dev->name);
+		goto out;
+	}
+
+	primary_addr = primary_if->net_dev->dev_addr;
+	seq_printf(seq,
+		   "Backbones announced for the mesh %s (orig %pM, group id %04x)\n",
+		   net_dev->name, primary_addr,
+		   ntohs(bat_priv->claim_dest.group));
+	seq_printf(seq, "   %-17s    %-5s %-9s (%-4s)\n",
+		   "Originator", "VID", "last seen", "CRC");
+	for (i = 0; i < hash->size; i++) {
+		head = &hash->table[i];
+
+		rcu_read_lock();
+		hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
+			last_seen_msecs = jiffies_to_msecs(jiffies -
+							backbone_gw->lasttime);
+			last_seen_secs = last_seen_msecs / 1000;
+			last_seen_msecs = last_seen_msecs % 1000;
+
+
+			is_own = batadv_compare_eth(backbone_gw->orig,
+						    primary_addr);
+			if (is_own)
+				continue;
+
+			seq_printf(seq,
+				   " * %pM on % 5d % 4i.%03is (%04x)\n",
+				   backbone_gw->orig, backbone_gw->vid,
+				   last_seen_secs, last_seen_msecs,
+				   backbone_gw->crc);
+		}
+		rcu_read_unlock();
+	}
+out:
+	if (primary_if)
+		batadv_hardif_free_ref(primary_if);
+	return ret;
+}
diff --git a/bridge_loop_avoidance.h b/bridge_loop_avoidance.h
index 08d13cb..58015ce 100644
--- a/bridge_loop_avoidance.h
+++ b/bridge_loop_avoidance.h
@@ -26,6 +26,8 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid);
 int batadv_bla_is_backbone_gw(struct sk_buff *skb,
 			      struct batadv_orig_node *orig_node, int hdr_size);
 int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset);
+int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
+					     void *offset);
 int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig);
 int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
 				   struct batadv_bcast_packet *bcast_packet,
@@ -64,6 +66,12 @@ static inline int batadv_bla_claim_table_seq_print_text(struct seq_file *seq,
 	return 0;
 }
 
+static inline int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
+							void *offset)
+{
+	return 0;
+}
+
 static inline int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv,
 						 uint8_t *orig)
 {
diff --git a/debugfs.c b/debugfs.c
index e45cf0e..ee8b322 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -263,6 +263,15 @@ static int batadv_bla_claim_table_open(struct inode *inode, struct file *file)
 	return single_open(file, batadv_bla_claim_table_seq_print_text,
 			   net_dev);
 }
+
+static int batadv_bla_backbone_table_open(struct inode *inode,
+					  struct file *file)
+{
+	struct net_device *net_dev = (struct net_device *)inode->i_private;
+	return single_open(file, batadv_bla_backbone_table_seq_print_text,
+			   net_dev);
+}
+
 #endif
 
 static int batadv_transtable_local_open(struct inode *inode, struct file *file)
@@ -301,6 +310,8 @@ static BATADV_DEBUGINFO(transtable_global, S_IRUGO,
 			batadv_transtable_global_open);
 #ifdef CONFIG_BATMAN_ADV_BLA
 static BATADV_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open);
+static BATADV_DEBUGINFO(bla_backbone_table, S_IRUGO,
+			batadv_bla_backbone_table_open);
 #endif
 static BATADV_DEBUGINFO(transtable_local, S_IRUGO,
 			batadv_transtable_local_open);
@@ -312,6 +323,7 @@ static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {
 	&batadv_debuginfo_transtable_global,
 #ifdef CONFIG_BATMAN_ADV_BLA
 	&batadv_debuginfo_bla_claim_table,
+	&batadv_debuginfo_bla_backbone_table,
 #endif
 	&batadv_debuginfo_transtable_local,
 	&batadv_debuginfo_vis_data,
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv3] batman-adv: Add the backbone gateway list to debugfs
  2012-06-15  9:46       ` [B.A.T.M.A.N.] [PATCHv3] batman-adv: Add the backbone gateway list to debugfs Simon Wunderlich
@ 2012-06-16  6:37         ` Sven Eckelmann
  2012-06-18 10:21           ` [B.A.T.M.A.N.] [PATCHv2] batctl: add support for the bla backbone table in debugfs Simon Wunderlich
  2012-06-18 10:21           ` [B.A.T.M.A.N.] [PATCHv4] batman-adv: Add the backbone gateway list to debugfs Simon Wunderlich
  0 siblings, 2 replies; 14+ messages in thread
From: Sven Eckelmann @ 2012-06-16  6:37 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking
  Cc: Simon Wunderlich

[-- Attachment #1: Type: text/plain, Size: 301 bytes --]

On Fri, Jun 15, 2012 at 11:46:03AM +0200, Simon Wunderlich wrote:
> +		hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
> +			last_seen_msecs = jiffies_to_msecs(jiffies -
> +							backbone_gw->lasttime);

Please fix that in another way and not by wrong alignment.

Kind regards,
	Sven

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batctl: add support for the bla backbone table in debugfs
  2012-06-15  9:46       ` [B.A.T.M.A.N.] [PATCH] batctl: add support for the bla backbone table in debugfs Simon Wunderlich
@ 2012-06-16  8:29         ` Marek Lindner
  0 siblings, 0 replies; 14+ messages in thread
From: Marek Lindner @ 2012-06-16  8:29 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Friday, June 15, 2012 17:46:02 Simon Wunderlich wrote:
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
>  debug.c |   10 ++++++++++
>  debug.h |    2 ++
>  main.c  |    6 ++++++
>  3 files changed, 18 insertions(+)

What about the batctl man page ? :)

Cheers,
Marek

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [B.A.T.M.A.N.] [PATCHv2] batctl: add support for the bla backbone table in debugfs
  2012-06-16  6:37         ` Sven Eckelmann
@ 2012-06-18 10:21           ` Simon Wunderlich
  2012-06-22 18:12             ` Marek Lindner
  2012-06-18 10:21           ` [B.A.T.M.A.N.] [PATCHv4] batman-adv: Add the backbone gateway list to debugfs Simon Wunderlich
  1 sibling, 1 reply; 14+ messages in thread
From: Simon Wunderlich @ 2012-06-18 10:21 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Simon Wunderlich

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
[EDITv2: add manpage entry]
---
 debug.c      |   10 ++++++++++
 debug.h      |    2 ++
 main.c       |    6 ++++++
 man/batctl.8 |    3 +++
 4 files changed, 21 insertions(+)

diff --git a/debug.c b/debug.c
index 928f81d..5dca633 100644
--- a/debug.c
+++ b/debug.c
@@ -70,6 +70,16 @@ void bla_claim_table_usage(void)
 	printf(" \t -w [interval] watch mode - refresh the bridge loop avoidance claim table continuously\n");
 }
 
+void bla_backbone_table_usage(void)
+{
+	printf("Usage: batctl [options] backbone table\n");
+	printf("options:\n");
+	printf(" \t -h print this help\n");
+	printf(" \t -n don't replace mac addresses with bat-host names\n");
+	printf(" \t -w [interval] watch mode - refresh the bridge loop avoidance backbone table continuously\n");
+}
+
+
 void gateways_usage(void)
 {
 	printf("Usage: batctl [options] gateways \n");
diff --git a/debug.h b/debug.h
index 50d0e24..2c6d24c 100644
--- a/debug.h
+++ b/debug.h
@@ -25,6 +25,7 @@
 #define DEBUG_TRANSTABLE_LOCAL "transtable_local"
 #define DEBUG_TRANSTABLE_GLOBAL "transtable_global"
 #define DEBUG_BLA_CLAIM_TABLE "bla_claim_table"
+#define DEBUG_BLA_BACKBONE_TABLE "bla_backbone_table"
 #define DEBUG_GATEWAYS "gateways"
 #define DEBUG_VIS_DATA "vis_data"
 #define DEBUG_LOG "log"
@@ -33,6 +34,7 @@ void originators_usage(void);
 void trans_local_usage(void);
 void trans_global_usage(void);
 void bla_claim_table_usage(void);
+void bla_backbone_table_usage(void);
 void gateways_usage(void);
 int handle_debug_table(char *mesh_iface, int argc, char **argv,
 		       char *file_path, void table_usage(void));
diff --git a/main.c b/main.c
index 72b1ea4..929b762 100644
--- a/main.c
+++ b/main.c
@@ -56,6 +56,7 @@ void print_usage(void) {
 	printf(" \ttranslocal|tl                                \tdisplay the local translation table\n");
 	printf(" \ttransglobal|tg                               \tdisplay the global translation table\n");
 	printf(" \tclaimtable|cl                                \tdisplay the bridge loop avoidance claim table\n");
+	printf(" \tbackbonetable|bbl                            \tdisplay the bridge loop avoidance backbone table\n");
 	printf(" \tvis_mode|vm                [mode]            \tdisplay or modify the status of the VIS server\n");
 	printf(" \tvis_data|vd                [dot|JSON]        \tdisplay the VIS data in dot or JSON format\n");
 	printf(" \taggregation|ag             [0|1]             \tdisplay or modify the packet aggregation setting\n");
@@ -158,6 +159,11 @@ int main(int argc, char **argv)
 
 		ret = handle_debug_table(mesh_iface, argc - 1, argv + 1,
 					 DEBUG_BLA_CLAIM_TABLE, bla_claim_table_usage);
+	} else if ((strcmp(argv[1], "backbonetable") == 0) || (strcmp(argv[1], "bbl") == 0)) {
+
+		ret = handle_debug_table(mesh_iface, argc - 1, argv + 1,
+					 DEBUG_BLA_BACKBONE_TABLE,
+					 bla_backbone_table_usage);
 
 	} else if ((strcmp(argv[1], "loglevel") == 0) || (strcmp(argv[1], "ll") == 0)) {
 
diff --git a/man/batctl.8 b/man/batctl.8
index 714f50a..af30b67 100644
--- a/man/batctl.8
+++ b/man/batctl.8
@@ -124,6 +124,9 @@ Display the global translation table. batctl will refresh the list every second
 .IP "\fBclaimtable\fP|\fBcl\fP   [\fB\-w\fP [\fI\interval\fP]][\fB\-n\fP]"
 Display the bridge loop avoidance claim table. batctl will refresh the list every second if the "\-w" option was given or add a number to let it refresh at a custom interval in seconds (with optional decimal places). Use "\-n" to let batctl not replace the MAC addresses with bat\-host names in the output.
 .br
+.IP "\fBbackbonetable\fP|\fBbbl\fP   [\fB\-w\fP [\fI\interval\fP]][\fB\-n\fP]"
+Display the bridge loop avoidance backbone table. batctl will refresh the list every second if the "\-w" option was given or add a number to let it refresh at a custom interval in seconds (with optional decimal places). Use "\-n" to let batctl not replace the MAC addresses with bat\-host names in the output.
+.br
 .IP "\fBvis_mode|vm\fP	  [\fBmode\fP]\fP"
 If no parameter is given the current vis mode is displayed otherwise the parameter is used to set the vis mode.
 .br
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [B.A.T.M.A.N.] [PATCHv4] batman-adv: Add the backbone gateway list to debugfs
  2012-06-16  6:37         ` Sven Eckelmann
  2012-06-18 10:21           ` [B.A.T.M.A.N.] [PATCHv2] batctl: add support for the bla backbone table in debugfs Simon Wunderlich
@ 2012-06-18 10:21           ` Simon Wunderlich
  2012-06-18 10:41             ` Sven Eckelmann
  1 sibling, 1 reply; 14+ messages in thread
From: Simon Wunderlich @ 2012-06-18 10:21 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Simon Wunderlich

This is especially useful if there are no claims yet, but we still want
to know which gateways are using bridge loop avoidance in the network.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
[EDITv2: forgot to rename the function ...]
[EDITv3: add README entry]
[EDITv4: fix style]
---
 README                  |    7 ++---
 bridge_loop_avoidance.c |   66 +++++++++++++++++++++++++++++++++++++++++++++++
 bridge_loop_avoidance.h |    8 ++++++
 debugfs.c               |   12 +++++++++
 4 files changed, 90 insertions(+), 3 deletions(-)

diff --git a/README b/README
index 8f3ae4a..a173d2a 100644
--- a/README
+++ b/README
@@ -75,9 +75,10 @@ folder:
 
 There is a special folder for debugging information:
 
-#  ls /sys/kernel/debug/batman_adv/bat0/
-# bla_claim_table    log                socket             transtable_local
-# gateways           originators        transtable_global  vis_data
+# ls /sys/kernel/debug/batman_adv/bat0/
+# bla_backbone_table  log                 transtable_global
+# bla_claim_table     originators         transtable_local
+# gateways            socket              vis_data
 
 Some of the files contain all sort of status information  regard-
 ing  the  mesh  network.  For  example, you can view the table of
diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index 38aab1e..ee97531 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
@@ -1592,3 +1592,69 @@ out:
 		batadv_hardif_free_ref(primary_if);
 	return ret;
 }
+
+int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
+{
+	struct net_device *net_dev = (struct net_device *)seq->private;
+	struct batadv_priv *bat_priv = netdev_priv(net_dev);
+	struct batadv_hashtable *hash = bat_priv->backbone_hash;
+	struct batadv_backbone_gw *backbone_gw;
+	struct batadv_hard_iface *primary_if;
+	struct hlist_node *node;
+	struct hlist_head *head;
+	int secs, msecs;
+	uint32_t i;
+	bool is_own;
+	int ret = 0;
+	uint8_t *primary_addr;
+
+	primary_if = batadv_primary_if_get_selected(bat_priv);
+	if (!primary_if) {
+		ret = seq_printf(seq,
+				 "BATMAN mesh %s disabled - please specify interfaces to enable it\n",
+				 net_dev->name);
+		goto out;
+	}
+
+	if (primary_if->if_status != BATADV_IF_ACTIVE) {
+		ret = seq_printf(seq,
+				 "BATMAN mesh %s disabled - primary interface not active\n",
+				 net_dev->name);
+		goto out;
+	}
+
+	primary_addr = primary_if->net_dev->dev_addr;
+	seq_printf(seq,
+		   "Backbones announced for the mesh %s (orig %pM, group id %04x)\n",
+		   net_dev->name, primary_addr,
+		   ntohs(bat_priv->claim_dest.group));
+	seq_printf(seq, "   %-17s    %-5s %-9s (%-4s)\n",
+		   "Originator", "VID", "last seen", "CRC");
+	for (i = 0; i < hash->size; i++) {
+		head = &hash->table[i];
+
+		rcu_read_lock();
+		hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
+			msecs = jiffies_to_msecs(jiffies -
+						 backbone_gw->lasttime);
+			secs = msecs / 1000;
+			msecs = msecs % 1000;
+
+
+			is_own = batadv_compare_eth(backbone_gw->orig,
+						    primary_addr);
+			if (is_own)
+				continue;
+
+			seq_printf(seq,
+				   " * %pM on % 5d % 4i.%03is (%04x)\n",
+				   backbone_gw->orig, backbone_gw->vid,
+				   secs, msecs, backbone_gw->crc);
+		}
+		rcu_read_unlock();
+	}
+out:
+	if (primary_if)
+		batadv_hardif_free_ref(primary_if);
+	return ret;
+}
diff --git a/bridge_loop_avoidance.h b/bridge_loop_avoidance.h
index 08d13cb..58015ce 100644
--- a/bridge_loop_avoidance.h
+++ b/bridge_loop_avoidance.h
@@ -26,6 +26,8 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid);
 int batadv_bla_is_backbone_gw(struct sk_buff *skb,
 			      struct batadv_orig_node *orig_node, int hdr_size);
 int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset);
+int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
+					     void *offset);
 int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig);
 int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
 				   struct batadv_bcast_packet *bcast_packet,
@@ -64,6 +66,12 @@ static inline int batadv_bla_claim_table_seq_print_text(struct seq_file *seq,
 	return 0;
 }
 
+static inline int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
+							void *offset)
+{
+	return 0;
+}
+
 static inline int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv,
 						 uint8_t *orig)
 {
diff --git a/debugfs.c b/debugfs.c
index e45cf0e..ee8b322 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -263,6 +263,15 @@ static int batadv_bla_claim_table_open(struct inode *inode, struct file *file)
 	return single_open(file, batadv_bla_claim_table_seq_print_text,
 			   net_dev);
 }
+
+static int batadv_bla_backbone_table_open(struct inode *inode,
+					  struct file *file)
+{
+	struct net_device *net_dev = (struct net_device *)inode->i_private;
+	return single_open(file, batadv_bla_backbone_table_seq_print_text,
+			   net_dev);
+}
+
 #endif
 
 static int batadv_transtable_local_open(struct inode *inode, struct file *file)
@@ -301,6 +310,8 @@ static BATADV_DEBUGINFO(transtable_global, S_IRUGO,
 			batadv_transtable_global_open);
 #ifdef CONFIG_BATMAN_ADV_BLA
 static BATADV_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open);
+static BATADV_DEBUGINFO(bla_backbone_table, S_IRUGO,
+			batadv_bla_backbone_table_open);
 #endif
 static BATADV_DEBUGINFO(transtable_local, S_IRUGO,
 			batadv_transtable_local_open);
@@ -312,6 +323,7 @@ static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {
 	&batadv_debuginfo_transtable_global,
 #ifdef CONFIG_BATMAN_ADV_BLA
 	&batadv_debuginfo_bla_claim_table,
+	&batadv_debuginfo_bla_backbone_table,
 #endif
 	&batadv_debuginfo_transtable_local,
 	&batadv_debuginfo_vis_data,
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv4] batman-adv: Add the backbone gateway list to debugfs
  2012-06-18 10:21           ` [B.A.T.M.A.N.] [PATCHv4] batman-adv: Add the backbone gateway list to debugfs Simon Wunderlich
@ 2012-06-18 10:41             ` Sven Eckelmann
  2012-06-18 16:39               ` [B.A.T.M.A.N.] [PATCHv5] " Simon Wunderlich
  0 siblings, 1 reply; 14+ messages in thread
From: Sven Eckelmann @ 2012-06-18 10:41 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking
  Cc: Simon Wunderlich

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

On Mon, Jun 18, 2012 at 12:21:32PM +0200, Simon Wunderlich wrote:
> +			msecs = msecs % 1000;
> +
> +
> +			is_own = batadv_compare_eth(backbone_gw->orig,

Why two empty lines?

> +static inline int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
> +							void *offset)
> +{
> +	return 0;
> +}
> +d

This also looks wrong aligned. 

Kind regards,
	Sven

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [B.A.T.M.A.N.] [PATCHv5] batman-adv: Add the backbone gateway list to debugfs
  2012-06-18 10:41             ` Sven Eckelmann
@ 2012-06-18 16:39               ` Simon Wunderlich
  2012-06-22 18:09                 ` Marek Lindner
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Wunderlich @ 2012-06-18 16:39 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Simon Wunderlich

This is especially useful if there are no claims yet, but we still want
to know which gateways are using bridge loop avoidance in the network.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
[EDITv2: forgot to rename the function ...]
[EDITv3: add README entry]
[EDITv4: fix style]
[EDITv5: some more style fixes]
---
 README                  |    7 ++---
 bridge_loop_avoidance.c |   65 +++++++++++++++++++++++++++++++++++++++++++++++
 bridge_loop_avoidance.h |    8 ++++++
 debugfs.c               |   12 +++++++++
 4 files changed, 89 insertions(+), 3 deletions(-)

diff --git a/README b/README
index 8f3ae4a..a173d2a 100644
--- a/README
+++ b/README
@@ -75,9 +75,10 @@ folder:
 
 There is a special folder for debugging information:
 
-#  ls /sys/kernel/debug/batman_adv/bat0/
-# bla_claim_table    log                socket             transtable_local
-# gateways           originators        transtable_global  vis_data
+# ls /sys/kernel/debug/batman_adv/bat0/
+# bla_backbone_table  log                 transtable_global
+# bla_claim_table     originators         transtable_local
+# gateways            socket              vis_data
 
 Some of the files contain all sort of status information  regard-
 ing  the  mesh  network.  For  example, you can view the table of
diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index 38aab1e..03fe5ea 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
@@ -1592,3 +1592,68 @@ out:
 		batadv_hardif_free_ref(primary_if);
 	return ret;
 }
+
+int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
+{
+	struct net_device *net_dev = (struct net_device *)seq->private;
+	struct batadv_priv *bat_priv = netdev_priv(net_dev);
+	struct batadv_hashtable *hash = bat_priv->backbone_hash;
+	struct batadv_backbone_gw *backbone_gw;
+	struct batadv_hard_iface *primary_if;
+	struct hlist_node *node;
+	struct hlist_head *head;
+	int secs, msecs;
+	uint32_t i;
+	bool is_own;
+	int ret = 0;
+	uint8_t *primary_addr;
+
+	primary_if = batadv_primary_if_get_selected(bat_priv);
+	if (!primary_if) {
+		ret = seq_printf(seq,
+				 "BATMAN mesh %s disabled - please specify interfaces to enable it\n",
+				 net_dev->name);
+		goto out;
+	}
+
+	if (primary_if->if_status != BATADV_IF_ACTIVE) {
+		ret = seq_printf(seq,
+				 "BATMAN mesh %s disabled - primary interface not active\n",
+				 net_dev->name);
+		goto out;
+	}
+
+	primary_addr = primary_if->net_dev->dev_addr;
+	seq_printf(seq,
+		   "Backbones announced for the mesh %s (orig %pM, group id %04x)\n",
+		   net_dev->name, primary_addr,
+		   ntohs(bat_priv->claim_dest.group));
+	seq_printf(seq, "   %-17s    %-5s %-9s (%-4s)\n",
+		   "Originator", "VID", "last seen", "CRC");
+	for (i = 0; i < hash->size; i++) {
+		head = &hash->table[i];
+
+		rcu_read_lock();
+		hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
+			msecs = jiffies_to_msecs(jiffies -
+						 backbone_gw->lasttime);
+			secs = msecs / 1000;
+			msecs = msecs % 1000;
+
+			is_own = batadv_compare_eth(backbone_gw->orig,
+						    primary_addr);
+			if (is_own)
+				continue;
+
+			seq_printf(seq,
+				   " * %pM on % 5d % 4i.%03is (%04x)\n",
+				   backbone_gw->orig, backbone_gw->vid,
+				   secs, msecs, backbone_gw->crc);
+		}
+		rcu_read_unlock();
+	}
+out:
+	if (primary_if)
+		batadv_hardif_free_ref(primary_if);
+	return ret;
+}
diff --git a/bridge_loop_avoidance.h b/bridge_loop_avoidance.h
index 08d13cb..35d39e3 100644
--- a/bridge_loop_avoidance.h
+++ b/bridge_loop_avoidance.h
@@ -26,6 +26,8 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid);
 int batadv_bla_is_backbone_gw(struct sk_buff *skb,
 			      struct batadv_orig_node *orig_node, int hdr_size);
 int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset);
+int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
+					     void *offset);
 int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig);
 int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
 				   struct batadv_bcast_packet *bcast_packet,
@@ -64,6 +66,12 @@ static inline int batadv_bla_claim_table_seq_print_text(struct seq_file *seq,
 	return 0;
 }
 
+static inline int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
+							   void *offset)
+{
+	return 0;
+}
+
 static inline int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv,
 						 uint8_t *orig)
 {
diff --git a/debugfs.c b/debugfs.c
index e45cf0e..ee8b322 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -263,6 +263,15 @@ static int batadv_bla_claim_table_open(struct inode *inode, struct file *file)
 	return single_open(file, batadv_bla_claim_table_seq_print_text,
 			   net_dev);
 }
+
+static int batadv_bla_backbone_table_open(struct inode *inode,
+					  struct file *file)
+{
+	struct net_device *net_dev = (struct net_device *)inode->i_private;
+	return single_open(file, batadv_bla_backbone_table_seq_print_text,
+			   net_dev);
+}
+
 #endif
 
 static int batadv_transtable_local_open(struct inode *inode, struct file *file)
@@ -301,6 +310,8 @@ static BATADV_DEBUGINFO(transtable_global, S_IRUGO,
 			batadv_transtable_global_open);
 #ifdef CONFIG_BATMAN_ADV_BLA
 static BATADV_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open);
+static BATADV_DEBUGINFO(bla_backbone_table, S_IRUGO,
+			batadv_bla_backbone_table_open);
 #endif
 static BATADV_DEBUGINFO(transtable_local, S_IRUGO,
 			batadv_transtable_local_open);
@@ -312,6 +323,7 @@ static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {
 	&batadv_debuginfo_transtable_global,
 #ifdef CONFIG_BATMAN_ADV_BLA
 	&batadv_debuginfo_bla_claim_table,
+	&batadv_debuginfo_bla_backbone_table,
 #endif
 	&batadv_debuginfo_transtable_local,
 	&batadv_debuginfo_vis_data,
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv5] batman-adv: Add the backbone gateway list to debugfs
  2012-06-18 16:39               ` [B.A.T.M.A.N.] [PATCHv5] " Simon Wunderlich
@ 2012-06-22 18:09                 ` Marek Lindner
  0 siblings, 0 replies; 14+ messages in thread
From: Marek Lindner @ 2012-06-22 18:09 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Monday, June 18, 2012 18:39:26 Simon Wunderlich wrote:
> This is especially useful if there are no claims yet, but we still want
> to know which gateways are using bridge loop avoidance in the network.
> 
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
> [EDITv2: forgot to rename the function ...]
> [EDITv3: add README entry]
> [EDITv4: fix style]
> [EDITv5: some more style fixes]
> ---
>  README                  |    7 ++---
>  bridge_loop_avoidance.c |   65
> +++++++++++++++++++++++++++++++++++++++++++++++ bridge_loop_avoidance.h
> |    8 ++++++
>  debugfs.c               |   12 +++++++++
>  4 files changed, 89 insertions(+), 3 deletions(-)

Applied in revision 500ab9a.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv2] batctl: add support for the bla backbone table in debugfs
  2012-06-18 10:21           ` [B.A.T.M.A.N.] [PATCHv2] batctl: add support for the bla backbone table in debugfs Simon Wunderlich
@ 2012-06-22 18:12             ` Marek Lindner
  0 siblings, 0 replies; 14+ messages in thread
From: Marek Lindner @ 2012-06-22 18:12 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Monday, June 18, 2012 12:21:31 Simon Wunderlich wrote:
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
> [EDITv2: add manpage entry]
> ---
>  debug.c      |   10 ++++++++++
>  debug.h      |    2 ++
>  main.c       |    6 ++++++
>  man/batctl.8 |    3 +++
>  4 files changed, 21 insertions(+)

Applied in revision a738c35.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-06-22 18:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-14 16:43 [B.A.T.M.A.N.] [PATCH] batman-adv: Add the backbone gateway list to debugfs Simon Wunderlich
2012-06-14 16:51 ` [B.A.T.M.A.N.] [PATCHv2] " Simon Wunderlich
2012-06-14 20:43   ` Sven Eckelmann
2012-06-15  8:47     ` Simon Wunderlich
2012-06-15  9:46       ` [B.A.T.M.A.N.] [PATCH] batctl: add support for the bla backbone table in debugfs Simon Wunderlich
2012-06-16  8:29         ` Marek Lindner
2012-06-15  9:46       ` [B.A.T.M.A.N.] [PATCHv3] batman-adv: Add the backbone gateway list to debugfs Simon Wunderlich
2012-06-16  6:37         ` Sven Eckelmann
2012-06-18 10:21           ` [B.A.T.M.A.N.] [PATCHv2] batctl: add support for the bla backbone table in debugfs Simon Wunderlich
2012-06-22 18:12             ` Marek Lindner
2012-06-18 10:21           ` [B.A.T.M.A.N.] [PATCHv4] batman-adv: Add the backbone gateway list to debugfs Simon Wunderlich
2012-06-18 10:41             ` Sven Eckelmann
2012-06-18 16:39               ` [B.A.T.M.A.N.] [PATCHv5] " Simon Wunderlich
2012-06-22 18:09                 ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox