Show
Ignore:
Timestamp:
03/10/10 22:48:40 (6 months ago)
Author:
marek
Message:

batman-adv: Fix VIS output bug for secondary interfaces

TQ and HNA records for originators on secondary interfaces were
wrongly being included on the primary interface. Ensure we output a
line for each source interface on every node, so we correctly separate
primary and secondary interface records.

Signed-off-by: Linus Luessing <linus.luessing@…>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/batman-adv-kernelland/vis.c

    r1579 r1589  
    8888/* insert interface to the list of interfaces of one originator, if it 
    8989 * does not already exist in the list */ 
    90 static void proc_vis_insert_interface(const uint8_t *interface, 
     90void proc_vis_insert_interface(const uint8_t *interface, 
    9191                                      struct hlist_head *if_list, 
    9292                                      bool primary) 
     
    113113{ 
    114114        struct if_list_entry *entry; 
    115         struct hlist_node *pos, *n; 
     115        struct hlist_node *pos; 
    116116        char tmp_addr_str[ETH_STR_LEN]; 
    117117 
    118         hlist_for_each_entry_safe(entry, pos, n, if_list, list) { 
    119                 if (entry->primary) { 
     118        hlist_for_each_entry(entry, pos, if_list, list) { 
     119                if (entry->primary) 
    120120                        seq_printf(seq, "PRIMARY, "); 
    121                 } else { 
     121                else { 
    122122                        addr_to_string(tmp_addr_str, entry->addr); 
    123123                        seq_printf(seq, "SEC %s, ", tmp_addr_str); 
    124124                } 
    125  
    126                 hlist_del(&entry->list); 
    127                 kfree(entry); 
    128125        } 
    129126} 
     
    132129void proc_vis_read_entry(struct seq_file *seq, 
    133130                                struct vis_info_entry *entry, 
    134                                 struct hlist_head *if_list, 
    135                                 uint8_t *vis_orig) 
     131                                uint8_t *src, 
     132                                bool primary) 
    136133{ 
    137134        char to[40]; 
    138135 
    139136        addr_to_string(to, entry->dest); 
    140         if (entry->quality == 0) { 
    141                 proc_vis_insert_interface(vis_orig, if_list, true); 
     137        if (primary && entry->quality == 0) 
    142138                seq_printf(seq, "HNA %s, ", to); 
    143         } else { 
    144                 proc_vis_insert_interface(entry->src, if_list, 
    145                                           compare_orig(entry->src, vis_orig)); 
     139        else if (compare_orig(entry->src, src)) 
    146140                seq_printf(seq, "TQ %s %d, ", to, entry->quality); 
    147         } 
    148141} 
    149142