[B.A.T.M.A.N.] [PATCH] batman-adv: Add the backbone gateway list to debugfs
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 s...@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
[B.A.T.M.A.N.] [PATCHv2] batman-adv: Add the backbone gateway list to debugfs
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 s...@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); }
Re: [B.A.T.M.A.N.] [PATCHv2] batman-adv: Add the backbone gateway list to debugfs
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 s...@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 signature.asc Description: This is a digitally signed message part.
Re: [B.A.T.M.A.N.] [PATCH] batman-adv: don't redirect tt_request for me
On Thu, Jun 14, 2012 at 11:27:27PM +0200, Antonio Quartulli wrote: If a tt_request is directed to me, it never has to be redirected Signed-off-by: Antonio Quartulli or...@autistici.org sorry, drop this patch. I'll send v2 Cheers, -- Antonio Quartulli ..each of us alone is worth nothing.. Ernesto Che Guevara pgpyI8DRzXLeK.pgp Description: PGP signature
[B.A.T.M.A.N.] [PATCH] batman-adv: don't redirect tt_request for me
If a tt_request is directed to me, it never has to be redirected Signed-off-by: Antonio Quartulli or...@autistici.org --- translation-table.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/translation-table.c b/translation-table.c index 2a6d7d6..c32c5f6 100644 --- a/translation-table.c +++ b/translation-table.c @@ -1648,7 +1648,7 @@ out: } -static bool +static void batadv_send_my_tt_response(struct batadv_priv *bat_priv, struct batadv_tt_query_packet *tt_request) { @@ -1656,7 +1656,6 @@ batadv_send_my_tt_response(struct batadv_priv *bat_priv, struct batadv_neigh_node *neigh_node = NULL; struct batadv_hard_iface *primary_if = NULL; uint8_t my_ttvn, req_ttvn, ttvn; - int ret = false; unsigned char *tt_buff; bool full_table; uint16_t tt_len, tt_tot; @@ -1751,7 +1750,6 @@ batadv_send_my_tt_response(struct batadv_priv *bat_priv, batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); batadv_send_skb_packet(skb, neigh_node-if_incoming, neigh_node-addr); - ret = true; goto out; unlock: @@ -1765,8 +1763,6 @@ out: batadv_hardif_free_ref(primary_if); if (!ret) kfree_skb(skb); - /* This packet was for me, so it doesn't need to be re-routed */ - return true; } bool batadv_send_tt_response(struct batadv_priv *bat_priv, @@ -1777,7 +1773,9 @@ bool batadv_send_tt_response(struct batadv_priv *bat_priv, if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_request-src)) return true; - return batadv_send_my_tt_response(bat_priv, tt_request); + batadv_send_my_tt_response(bat_priv, tt_request); + /* This packet was for me, so it never needs to be re-routed */ + return true; } else { return batadv_send_other_tt_response(bat_priv, tt_request); } -- 1.7.9.4