Acked-by: Simon Wunderlich <s...@hrz.tu-chemnitz.de>

Your patch does the trick, although I think this ugly function could use a 
rewrite.
First counting bytes and then allocating this size to do exactly the same thing 
again
is not really good style. If you would like to volunteer to do this job (or 
plan to
work more on vis), please tell me, otherwise I'll put it in on my TODO list.

Thanks
        Simon


On Sat, May 05, 2012 at 05:51:53PM +0200, Matthias Schiffer wrote:
> The primary entry and the corresponding secondary entries are missing when 
> there
> are no neighbors on the primary interface. This also causes the TT entries to
> miss and makes nodes with multiply secondary interface fall apart since there
> is no way to see they are related without a primary entry.
> 
> Fix this by always emitting a primary entry.
> 
> Signed-off-by: Matthias Schiffer <mschif...@universe-factory.net>
> ---
>  vis.c |   21 ++++++++++++++-------
>  1 file changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/vis.c b/vis.c
> index cec216f..c515927 100644
> --- a/vis.c
> +++ b/vis.c
> @@ -207,7 +207,6 @@ int vis_seq_print_text(struct seq_file *seq, void *offset)
>       int vis_server = atomic_read(&bat_priv->vis_mode);
>       size_t buff_pos, buf_size;
>       char *buff;
> -     int compare;
>  
>       primary_if = primary_if_get_selected(bat_priv);
>       if (!primary_if)
> @@ -228,14 +227,18 @@ int vis_seq_print_text(struct seq_file *seq, void 
> *offset)
>                       entries = (struct vis_info_entry *)
>                               ((char *)packet + sizeof(*packet));
>  
> +                     vis_data_insert_interface(packet->vis_orig,
> +                                               &vis_if_list, true);
> +
>                       for (j = 0; j < packet->entries; j++) {
>                               if (entries[j].quality == 0)
>                                       continue;
> -                             compare =
> -                              compare_eth(entries[j].src, packet->vis_orig);
> +                             if (compare_eth(entries[j].src,
> +                                             packet->vis_orig))
> +                                     continue;
>                               vis_data_insert_interface(entries[j].src,
>                                                         &vis_if_list,
> -                                                       compare);
> +                                                       false);
>                       }
>  
>                       hlist_for_each_entry(entry, pos, &vis_if_list, list) {
> @@ -276,14 +279,18 @@ int vis_seq_print_text(struct seq_file *seq, void 
> *offset)
>                       entries = (struct vis_info_entry *)
>                               ((char *)packet + sizeof(*packet));
>  
> +                     vis_data_insert_interface(packet->vis_orig,
> +                                               &vis_if_list, true);
> +
>                       for (j = 0; j < packet->entries; j++) {
>                               if (entries[j].quality == 0)
>                                       continue;
> -                             compare =
> -                              compare_eth(entries[j].src, packet->vis_orig);
> +                             if (compare_eth(entries[j].src,
> +                                             packet->vis_orig))
> +                                     continue;
>                               vis_data_insert_interface(entries[j].src,
>                                                         &vis_if_list,
> -                                                       compare);
> +                                                       false);
>                       }
>  
>                       hlist_for_each_entry(entry, pos, &vis_if_list, list) {
> -- 
> 1.7.10.1
> 
> 

Attachment: signature.asc
Description: Digital signature

Reply via email to