diff options
author | Antonio Quartulli <antonio@open-mesh.com> | 2013-06-04 06:11:41 -0400 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2013-10-19 09:11:25 -0400 |
commit | 1605278901718ed51b5c8c832d61b1009e556306 (patch) | |
tree | f39218b3f8a0d78448a960dbbb7d1feaaa8df16d /net/batman-adv/translation-table.c | |
parent | 0ffa9e8d86d665f0f29343e45ecc09e2772ac646 (diff) |
batman-adv: print the VID together with the TT entries
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r-- | net/batman-adv/translation-table.c | 82 |
1 files changed, 50 insertions, 32 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index c8fc303ae71e..9bf928c0b188 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -328,8 +328,9 @@ static void batadv_tt_global_free(struct batadv_priv *bat_priv, | |||
328 | const char *message) | 328 | const char *message) |
329 | { | 329 | { |
330 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 330 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
331 | "Deleting global tt entry %pM: %s\n", | 331 | "Deleting global tt entry %pM (vid: %d): %s\n", |
332 | tt_global->common.addr, message); | 332 | tt_global->common.addr, |
333 | BATADV_PRINT_VID(tt_global->common.vid), message); | ||
333 | 334 | ||
334 | batadv_hash_remove(bat_priv->tt.global_hash, batadv_compare_tt, | 335 | batadv_hash_remove(bat_priv->tt.global_hash, batadv_compare_tt, |
335 | batadv_choose_tt, &tt_global->common); | 336 | batadv_choose_tt, &tt_global->common); |
@@ -363,7 +364,8 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
363 | tt_local->last_seen = jiffies; | 364 | tt_local->last_seen = jiffies; |
364 | if (tt_local->common.flags & BATADV_TT_CLIENT_PENDING) { | 365 | if (tt_local->common.flags & BATADV_TT_CLIENT_PENDING) { |
365 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 366 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
366 | "Re-adding pending client %pM\n", addr); | 367 | "Re-adding pending client %pM (vid: %d)\n", |
368 | addr, BATADV_PRINT_VID(vid)); | ||
367 | /* whatever the reason why the PENDING flag was set, | 369 | /* whatever the reason why the PENDING flag was set, |
368 | * this is a client which was enqueued to be removed in | 370 | * this is a client which was enqueued to be removed in |
369 | * this orig_interval. Since it popped up again, the | 371 | * this orig_interval. Since it popped up again, the |
@@ -375,8 +377,8 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
375 | 377 | ||
376 | if (tt_local->common.flags & BATADV_TT_CLIENT_ROAM) { | 378 | if (tt_local->common.flags & BATADV_TT_CLIENT_ROAM) { |
377 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 379 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
378 | "Roaming client %pM came back to its original location\n", | 380 | "Roaming client %pM (vid: %d) came back to its original location\n", |
379 | addr); | 381 | addr, BATADV_PRINT_VID(vid)); |
380 | /* the ROAM flag is set because this client roamed away | 382 | /* the ROAM flag is set because this client roamed away |
381 | * and the node got a roaming_advertisement message. Now | 383 | * and the node got a roaming_advertisement message. Now |
382 | * that the client popped up again at its original | 384 | * that the client popped up again at its original |
@@ -393,7 +395,8 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
393 | goto out; | 395 | goto out; |
394 | 396 | ||
395 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 397 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
396 | "Creating new local tt entry: %pM (ttvn: %d)\n", addr, | 398 | "Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n", |
399 | addr, BATADV_PRINT_VID(vid), | ||
397 | (uint8_t)atomic_read(&bat_priv->tt.vn)); | 400 | (uint8_t)atomic_read(&bat_priv->tt.vn)); |
398 | 401 | ||
399 | memcpy(tt_local->common.addr, addr, ETH_ALEN); | 402 | memcpy(tt_local->common.addr, addr, ETH_ALEN); |
@@ -562,8 +565,8 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) | |||
562 | "Locally retrieved addresses (from %s) announced via TT (TTVN: %u CRC: %#.8x):\n", | 565 | "Locally retrieved addresses (from %s) announced via TT (TTVN: %u CRC: %#.8x):\n", |
563 | net_dev->name, (uint8_t)atomic_read(&bat_priv->tt.vn), | 566 | net_dev->name, (uint8_t)atomic_read(&bat_priv->tt.vn), |
564 | bat_priv->tt.local_crc); | 567 | bat_priv->tt.local_crc); |
565 | seq_printf(seq, " %-13s %-7s %-10s\n", "Client", "Flags", | 568 | seq_printf(seq, " %-13s %s %-7s %-10s\n", "Client", "VID", |
566 | "Last seen"); | 569 | "Flags", "Last seen"); |
567 | 570 | ||
568 | for (i = 0; i < hash->size; i++) { | 571 | for (i = 0; i < hash->size; i++) { |
569 | head = &hash->table[i]; | 572 | head = &hash->table[i]; |
@@ -581,8 +584,9 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) | |||
581 | 584 | ||
582 | no_purge = tt_common_entry->flags & np_flag; | 585 | no_purge = tt_common_entry->flags & np_flag; |
583 | 586 | ||
584 | seq_printf(seq, " * %pM [%c%c%c%c%c] %3u.%03u\n", | 587 | seq_printf(seq, " * %pM %4i [%c%c%c%c%c] %3u.%03u\n", |
585 | tt_common_entry->addr, | 588 | tt_common_entry->addr, |
589 | BATADV_PRINT_VID(tt_common_entry->vid), | ||
586 | (tt_common_entry->flags & | 590 | (tt_common_entry->flags & |
587 | BATADV_TT_CLIENT_ROAM ? 'R' : '.'), | 591 | BATADV_TT_CLIENT_ROAM ? 'R' : '.'), |
588 | no_purge ? 'P' : '.', | 592 | no_purge ? 'P' : '.', |
@@ -617,8 +621,9 @@ batadv_tt_local_set_pending(struct batadv_priv *bat_priv, | |||
617 | tt_local_entry->common.flags |= BATADV_TT_CLIENT_PENDING; | 621 | tt_local_entry->common.flags |= BATADV_TT_CLIENT_PENDING; |
618 | 622 | ||
619 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 623 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
620 | "Local tt entry (%pM) pending to be removed: %s\n", | 624 | "Local tt entry (%pM, vid: %d) pending to be removed: %s\n", |
621 | tt_local_entry->common.addr, message); | 625 | tt_local_entry->common.addr, |
626 | BATADV_PRINT_VID(tt_local_entry->common.vid), message); | ||
622 | } | 627 | } |
623 | 628 | ||
624 | /** | 629 | /** |
@@ -996,8 +1001,9 @@ add_orig_entry: | |||
996 | batadv_tt_global_orig_entry_add(tt_global_entry, orig_node, ttvn); | 1001 | batadv_tt_global_orig_entry_add(tt_global_entry, orig_node, ttvn); |
997 | 1002 | ||
998 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 1003 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
999 | "Creating new global tt entry: %pM (via %pM)\n", | 1004 | "Creating new global tt entry: %pM (vid: %d, via %pM)\n", |
1000 | common->addr, orig_node->orig); | 1005 | common->addr, BATADV_PRINT_VID(common->vid), |
1006 | orig_node->orig); | ||
1001 | ret = true; | 1007 | ret = true; |
1002 | 1008 | ||
1003 | out_remove: | 1009 | out_remove: |
@@ -1077,8 +1083,9 @@ batadv_tt_global_print_entry(struct batadv_tt_global_entry *tt_global_entry, | |||
1077 | if (best_entry) { | 1083 | if (best_entry) { |
1078 | last_ttvn = atomic_read(&best_entry->orig_node->last_ttvn); | 1084 | last_ttvn = atomic_read(&best_entry->orig_node->last_ttvn); |
1079 | seq_printf(seq, | 1085 | seq_printf(seq, |
1080 | " %c %pM (%3u) via %pM (%3u) (%#.8x) [%c%c%c]\n", | 1086 | " %c %pM %4i (%3u) via %pM (%3u) (%#.8x) [%c%c%c]\n", |
1081 | '*', tt_global_entry->common.addr, | 1087 | '*', tt_global_entry->common.addr, |
1088 | BATADV_PRINT_VID(tt_global_entry->common.vid), | ||
1082 | best_entry->ttvn, best_entry->orig_node->orig, | 1089 | best_entry->ttvn, best_entry->orig_node->orig, |
1083 | last_ttvn, best_entry->orig_node->tt_crc, | 1090 | last_ttvn, best_entry->orig_node->tt_crc, |
1084 | (flags & BATADV_TT_CLIENT_ROAM ? 'R' : '.'), | 1091 | (flags & BATADV_TT_CLIENT_ROAM ? 'R' : '.'), |
@@ -1093,8 +1100,10 @@ batadv_tt_global_print_entry(struct batadv_tt_global_entry *tt_global_entry, | |||
1093 | continue; | 1100 | continue; |
1094 | 1101 | ||
1095 | last_ttvn = atomic_read(&orig_entry->orig_node->last_ttvn); | 1102 | last_ttvn = atomic_read(&orig_entry->orig_node->last_ttvn); |
1096 | seq_printf(seq, " %c %pM (%3u) via %pM (%3u) [%c%c%c]\n", | 1103 | seq_printf(seq, |
1104 | " %c %pM %4d (%3u) via %pM (%3u) [%c%c%c]\n", | ||
1097 | '+', tt_global_entry->common.addr, | 1105 | '+', tt_global_entry->common.addr, |
1106 | BATADV_PRINT_VID(tt_global_entry->common.vid), | ||
1098 | orig_entry->ttvn, orig_entry->orig_node->orig, | 1107 | orig_entry->ttvn, orig_entry->orig_node->orig, |
1099 | last_ttvn, | 1108 | last_ttvn, |
1100 | (flags & BATADV_TT_CLIENT_ROAM ? 'R' : '.'), | 1109 | (flags & BATADV_TT_CLIENT_ROAM ? 'R' : '.'), |
@@ -1121,9 +1130,9 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) | |||
1121 | seq_printf(seq, | 1130 | seq_printf(seq, |
1122 | "Globally announced TT entries received via the mesh %s\n", | 1131 | "Globally announced TT entries received via the mesh %s\n", |
1123 | net_dev->name); | 1132 | net_dev->name); |
1124 | seq_printf(seq, " %-13s %s %-15s %s (%-10s) %s\n", | 1133 | seq_printf(seq, " %-13s %s %s %-15s %s (%-10s) %s\n", |
1125 | "Client", "(TTVN)", "Originator", "(Curr TTVN)", "CRC", | 1134 | "Client", "VID", "(TTVN)", "Originator", "(Curr TTVN)", |
1126 | "Flags"); | 1135 | "CRC", "Flags"); |
1127 | 1136 | ||
1128 | for (i = 0; i < hash->size; i++) { | 1137 | for (i = 0; i < hash->size; i++) { |
1129 | head = &hash->table[i]; | 1138 | head = &hash->table[i]; |
@@ -1170,15 +1179,18 @@ batadv_tt_global_del_orig_entry(struct batadv_priv *bat_priv, | |||
1170 | struct hlist_head *head; | 1179 | struct hlist_head *head; |
1171 | struct hlist_node *safe; | 1180 | struct hlist_node *safe; |
1172 | struct batadv_tt_orig_list_entry *orig_entry; | 1181 | struct batadv_tt_orig_list_entry *orig_entry; |
1182 | unsigned short vid; | ||
1173 | 1183 | ||
1174 | spin_lock_bh(&tt_global_entry->list_lock); | 1184 | spin_lock_bh(&tt_global_entry->list_lock); |
1175 | head = &tt_global_entry->orig_list; | 1185 | head = &tt_global_entry->orig_list; |
1176 | hlist_for_each_entry_safe(orig_entry, safe, head, list) { | 1186 | hlist_for_each_entry_safe(orig_entry, safe, head, list) { |
1177 | if (orig_entry->orig_node == orig_node) { | 1187 | if (orig_entry->orig_node == orig_node) { |
1188 | vid = tt_global_entry->common.vid; | ||
1178 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 1189 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
1179 | "Deleting %pM from global tt entry %pM: %s\n", | 1190 | "Deleting %pM from global tt entry %pM (vid: %d): %s\n", |
1180 | orig_node->orig, | 1191 | orig_node->orig, |
1181 | tt_global_entry->common.addr, message); | 1192 | tt_global_entry->common.addr, |
1193 | BATADV_PRINT_VID(vid), message); | ||
1182 | hlist_del_rcu(&orig_entry->list); | 1194 | hlist_del_rcu(&orig_entry->list); |
1183 | batadv_tt_orig_list_entry_free_ref(orig_entry); | 1195 | batadv_tt_orig_list_entry_free_ref(orig_entry); |
1184 | } | 1196 | } |
@@ -1303,6 +1315,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, | |||
1303 | struct hlist_node *safe; | 1315 | struct hlist_node *safe; |
1304 | struct hlist_head *head; | 1316 | struct hlist_head *head; |
1305 | spinlock_t *list_lock; /* protects write access to the hash lists */ | 1317 | spinlock_t *list_lock; /* protects write access to the hash lists */ |
1318 | unsigned short vid; | ||
1306 | 1319 | ||
1307 | if (!hash) | 1320 | if (!hash) |
1308 | return; | 1321 | return; |
@@ -1322,9 +1335,11 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, | |||
1322 | orig_node, message); | 1335 | orig_node, message); |
1323 | 1336 | ||
1324 | if (hlist_empty(&tt_global->orig_list)) { | 1337 | if (hlist_empty(&tt_global->orig_list)) { |
1338 | vid = tt_global->common.vid; | ||
1325 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 1339 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
1326 | "Deleting global tt entry %pM: %s\n", | 1340 | "Deleting global tt entry %pM (vid: %d): %s\n", |
1327 | tt_global->common.addr, message); | 1341 | tt_global->common.addr, |
1342 | BATADV_PRINT_VID(vid), message); | ||
1328 | hlist_del_rcu(&tt_common_entry->hash_entry); | 1343 | hlist_del_rcu(&tt_common_entry->hash_entry); |
1329 | batadv_tt_global_entry_free_ref(tt_global); | 1344 | batadv_tt_global_entry_free_ref(tt_global); |
1330 | } | 1345 | } |
@@ -1382,8 +1397,10 @@ static void batadv_tt_global_purge(struct batadv_priv *bat_priv) | |||
1382 | continue; | 1397 | continue; |
1383 | 1398 | ||
1384 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 1399 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
1385 | "Deleting global tt entry (%pM): %s\n", | 1400 | "Deleting global tt entry %pM (vid: %d): %s\n", |
1386 | tt_global->common.addr, msg); | 1401 | tt_global->common.addr, |
1402 | BATADV_PRINT_VID(tt_global->common.vid), | ||
1403 | msg); | ||
1387 | 1404 | ||
1388 | hlist_del_rcu(&tt_common->hash_entry); | 1405 | hlist_del_rcu(&tt_common->hash_entry); |
1389 | 1406 | ||
@@ -2366,8 +2383,8 @@ static void batadv_send_roam_adv(struct batadv_priv *bat_priv, uint8_t *client, | |||
2366 | goto out; | 2383 | goto out; |
2367 | 2384 | ||
2368 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 2385 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
2369 | "Sending ROAMING_ADV to %pM (client %pM)\n", | 2386 | "Sending ROAMING_ADV to %pM (client %pM, vid: %d)\n", |
2370 | orig_node->orig, client); | 2387 | orig_node->orig, client, BATADV_PRINT_VID(vid)); |
2371 | 2388 | ||
2372 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_TX); | 2389 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_TX); |
2373 | 2390 | ||
@@ -2480,8 +2497,9 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) | |||
2480 | continue; | 2497 | continue; |
2481 | 2498 | ||
2482 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 2499 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
2483 | "Deleting local tt entry (%pM): pending\n", | 2500 | "Deleting local tt entry (%pM, vid: %d): pending\n", |
2484 | tt_common->addr); | 2501 | tt_common->addr, |
2502 | BATADV_PRINT_VID(tt_common->vid)); | ||
2485 | 2503 | ||
2486 | atomic_dec(&bat_priv->tt.local_entry_num); | 2504 | atomic_dec(&bat_priv->tt.local_entry_num); |
2487 | hlist_del_rcu(&tt_common->hash_entry); | 2505 | hlist_del_rcu(&tt_common->hash_entry); |
@@ -2694,7 +2712,7 @@ out: | |||
2694 | bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, | 2712 | bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, |
2695 | struct batadv_orig_node *orig_node, | 2713 | struct batadv_orig_node *orig_node, |
2696 | const unsigned char *addr, | 2714 | const unsigned char *addr, |
2697 | unsigned short vlan) | 2715 | unsigned short vid) |
2698 | { | 2716 | { |
2699 | bool ret = false; | 2717 | bool ret = false; |
2700 | 2718 | ||
@@ -2705,14 +2723,14 @@ bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, | |||
2705 | if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig)) | 2723 | if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig)) |
2706 | goto out; | 2724 | goto out; |
2707 | 2725 | ||
2708 | if (!batadv_tt_global_add(bat_priv, orig_node, addr, vlan, | 2726 | if (!batadv_tt_global_add(bat_priv, orig_node, addr, vid, |
2709 | BATADV_TT_CLIENT_TEMP, | 2727 | BATADV_TT_CLIENT_TEMP, |
2710 | atomic_read(&orig_node->last_ttvn))) | 2728 | atomic_read(&orig_node->last_ttvn))) |
2711 | goto out; | 2729 | goto out; |
2712 | 2730 | ||
2713 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 2731 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
2714 | "Added temporary global client (addr: %pM orig: %pM)\n", | 2732 | "Added temporary global client (addr: %pM, vid: %d, orig: %pM)\n", |
2715 | addr, orig_node->orig); | 2733 | addr, BATADV_PRINT_VID(vid), orig_node->orig); |
2716 | ret = true; | 2734 | ret = true; |
2717 | out: | 2735 | out: |
2718 | return ret; | 2736 | return ret; |