diff options
author | Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> | 2012-01-22 14:00:21 -0500 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-04-11 08:28:59 -0400 |
commit | 9bf8e4d4254397684250eae29a0dc12d54a00251 (patch) | |
tree | 0f34ba75d59ed93e48b5c8ac03191c614d9b5be9 /net/batman-adv/bridge_loop_avoidance.c | |
parent | c867305509e9bb748d9349c84cc26beaa95ccd73 (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/bridge_loop_avoidance.c')
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 53 |
1 files changed, 53 insertions, 0 deletions
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 | |||
1298 | int 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 | } | ||
1345 | out: | ||
1346 | if (primary_if) | ||
1347 | hardif_free_ref(primary_if); | ||
1348 | return ret; | ||
1349 | } | ||