aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorSimon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>2012-01-22 14:00:21 -0500
committerAntonio Quartulli <ordex@autistici.org>2012-04-11 08:28:59 -0400
commit9bf8e4d4254397684250eae29a0dc12d54a00251 (patch)
tree0f34ba75d59ed93e48b5c8ac03191c614d9b5be9 /net/batman-adv
parentc867305509e9bb748d9349c84cc26beaa95ccd73 (diff)
batman-adv: export claim tables through debugfs
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/bat_debugfs.c10
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c53
-rw-r--r--net/batman-adv/bridge_loop_avoidance.h1
3 files changed, 64 insertions, 0 deletions
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c
index 165ff62a2bed..0e3517773a8b 100644
--- a/net/batman-adv/bat_debugfs.c
+++ b/net/batman-adv/bat_debugfs.c
@@ -32,6 +32,7 @@
32#include "soft-interface.h" 32#include "soft-interface.h"
33#include "vis.h" 33#include "vis.h"
34#include "icmp_socket.h" 34#include "icmp_socket.h"
35#include "bridge_loop_avoidance.h"
35 36
36static struct dentry *bat_debugfs; 37static struct dentry *bat_debugfs;
37 38
@@ -244,6 +245,13 @@ static int transtable_global_open(struct inode *inode, struct file *file)
244 return single_open(file, tt_global_seq_print_text, net_dev); 245 return single_open(file, tt_global_seq_print_text, net_dev);
245} 246}
246 247
248static int bla_claim_table_open(struct inode *inode, struct file *file)
249{
250 struct net_device *net_dev = (struct net_device *)inode->i_private;
251 return single_open(file, bla_claim_table_seq_print_text, net_dev);
252}
253
254
247static int transtable_local_open(struct inode *inode, struct file *file) 255static int transtable_local_open(struct inode *inode, struct file *file)
248{ 256{
249 struct net_device *net_dev = (struct net_device *)inode->i_private; 257 struct net_device *net_dev = (struct net_device *)inode->i_private;
@@ -277,6 +285,7 @@ static BAT_DEBUGINFO(routing_algos, S_IRUGO, bat_algorithms_open);
277static BAT_DEBUGINFO(originators, S_IRUGO, originators_open); 285static BAT_DEBUGINFO(originators, S_IRUGO, originators_open);
278static BAT_DEBUGINFO(gateways, S_IRUGO, gateways_open); 286static BAT_DEBUGINFO(gateways, S_IRUGO, gateways_open);
279static BAT_DEBUGINFO(transtable_global, S_IRUGO, transtable_global_open); 287static BAT_DEBUGINFO(transtable_global, S_IRUGO, transtable_global_open);
288static BAT_DEBUGINFO(bla_claim_table, S_IRUGO, bla_claim_table_open);
280static BAT_DEBUGINFO(transtable_local, S_IRUGO, transtable_local_open); 289static BAT_DEBUGINFO(transtable_local, S_IRUGO, transtable_local_open);
281static BAT_DEBUGINFO(vis_data, S_IRUGO, vis_data_open); 290static BAT_DEBUGINFO(vis_data, S_IRUGO, vis_data_open);
282 291
@@ -284,6 +293,7 @@ static struct bat_debuginfo *mesh_debuginfos[] = {
284 &bat_debuginfo_originators, 293 &bat_debuginfo_originators,
285 &bat_debuginfo_gateways, 294 &bat_debuginfo_gateways,
286 &bat_debuginfo_transtable_global, 295 &bat_debuginfo_transtable_global,
296 &bat_debuginfo_bla_claim_table,
287 &bat_debuginfo_transtable_local, 297 &bat_debuginfo_transtable_local,
288 &bat_debuginfo_vis_data, 298 &bat_debuginfo_vis_data,
289 NULL, 299 NULL,
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index f84c892be7ea..56b9b4924763 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1294,3 +1294,56 @@ out:
1294 claim_free_ref(claim); 1294 claim_free_ref(claim);
1295 return ret; 1295 return ret;
1296} 1296}
1297
1298int bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
1299{
1300 struct net_device *net_dev = (struct net_device *)seq->private;
1301 struct bat_priv *bat_priv = netdev_priv(net_dev);
1302 struct hashtable_t *hash = bat_priv->claim_hash;
1303 struct claim *claim;
1304 struct hard_iface *primary_if;
1305 struct hlist_node *node;
1306 struct hlist_head *head;
1307 uint32_t i;
1308 bool is_own;
1309 int ret = 0;
1310
1311 primary_if = primary_if_get_selected(bat_priv);
1312 if (!primary_if) {
1313 ret = seq_printf(seq,
1314 "BATMAN mesh %s disabled - please specify interfaces to enable it\n",
1315 net_dev->name);
1316 goto out;
1317 }
1318
1319 if (primary_if->if_status != IF_ACTIVE) {
1320 ret = seq_printf(seq,
1321 "BATMAN mesh %s disabled - primary interface not active\n",
1322 net_dev->name);
1323 goto out;
1324 }
1325
1326 seq_printf(seq, "Claims announced for the mesh %s (orig %pM)\n",
1327 net_dev->name, primary_if->net_dev->dev_addr);
1328 seq_printf(seq, " %-17s %-5s %-17s [o] (%-4s)\n",
1329 "Client", "VID", "Originator", "CRC");
1330 for (i = 0; i < hash->size; i++) {
1331 head = &hash->table[i];
1332
1333 rcu_read_lock();
1334 hlist_for_each_entry_rcu(claim, node, head, hash_entry) {
1335 is_own = compare_eth(claim->backbone_gw->orig,
1336 primary_if->net_dev->dev_addr);
1337 seq_printf(seq, " * %pM on % 5d by %pM [%c] (%04x)\n",
1338 claim->addr, claim->vid,
1339 claim->backbone_gw->orig,
1340 (is_own ? 'x' : ' '),
1341 claim->backbone_gw->crc);
1342 }
1343 rcu_read_unlock();
1344 }
1345out:
1346 if (primary_if)
1347 hardif_free_ref(primary_if);
1348 return ret;
1349}
diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h
index 488d77895d01..d9e34803a465 100644
--- a/net/batman-adv/bridge_loop_avoidance.h
+++ b/net/batman-adv/bridge_loop_avoidance.h
@@ -26,6 +26,7 @@ int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid);
26int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid); 26int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid);
27int bla_is_backbone_gw(struct sk_buff *skb, 27int bla_is_backbone_gw(struct sk_buff *skb,
28 struct orig_node *orig_node, int hdr_size); 28 struct orig_node *orig_node, int hdr_size);
29int bla_claim_table_seq_print_text(struct seq_file *seq, void *offset);
29void bla_update_orig_address(struct bat_priv *bat_priv, 30void bla_update_orig_address(struct bat_priv *bat_priv,
30 struct hard_iface *primary_if, 31 struct hard_iface *primary_if,
31 struct hard_iface *oldif); 32 struct hard_iface *oldif);