Author: marek Date: 2009-10-16 23:35:17 +0000 (Fri, 16 Oct 2009) New Revision: 1442
Modified: trunk/batctl/bisect.c Log: [batctl] bisect - highlight last routing table change
Modified: trunk/batctl/bisect.c =================================================================== --- trunk/batctl/bisect.c 2009-10-16 17:59:45 UTC (rev 1441) +++ trunk/batctl/bisect.c 2009-10-16 23:35:17 UTC (rev 1442) @@ -841,7 +841,8 @@ { struct bat_node *bat_node; struct seqno_event *seqno_event; - int i; + struct rt_table *prev_rt_table = NULL; + int i, j, changed_entry;
printf("Routing tables of originator: %s ", get_name_by_macstr(rt_orig, read_opt)); @@ -884,13 +885,30 @@ get_name_by_macstr(seqno_event->prev_sender->name, read_opt));
for (i = 0; i < seqno_event->rt_table->num_entries; i++) { - printf(" %s via next hop", + changed_entry = 1; + + if (prev_rt_table) { + for (j = 0; j < prev_rt_table->num_entries; j++) { + if (!compare_name(seqno_event->rt_table->entries[i].orig, prev_rt_table->entries[j].orig)) + continue; + + if (seqno_event->rt_table->entries[i].next_hop != prev_rt_table->entries[j].next_hop) + continue; + + changed_entry = 0; + break; + } + } + + printf("%s %s via next hop", (changed_entry ? " *" : " "), get_name_by_macstr(seqno_event->rt_table->entries[i].orig, read_opt)); printf(" %s\n", get_name_by_macstr(seqno_event->rt_table->entries[i].next_hop->name, read_opt)); }
printf("\n"); + + prev_rt_table = seqno_event->rt_table; }
out: