Bug Fixes (of stupid and forgotten bugs) from Sven-Ola Tuecke <sven-ola@gmx.de> from
authorBernd Petrovitsch <bernd@firmix.at>
Thu, 29 Nov 2007 00:10:17 +0000 (00:10 +0000)
committerBernd Petrovitsch <bernd@firmix.at>
Thu, 29 Nov 2007 00:10:17 +0000 (00:10 +0000)
http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/102-olsrd-cvs-fixes.patch

lib/nameservice/src/nameservice.c
lib/txtinfo/src/olsrd_txtinfo.c
src/mid_set.c

index faffd9b..fa5ca1d 100644 (file)
@@ -31,7 +31,7 @@
  *
  */
 
-/* $Id: nameservice.c,v 1.37 2007/11/16 22:56:54 bernd67 Exp $ */
+/* $Id: nameservice.c,v 1.38 2007/11/29 00:10:17 bernd67 Exp $ */
 
 /*
  * Dynamic linked library for UniK OLSRd
@@ -829,10 +829,13 @@ decap_namemsg(struct name *from_packet, struct name_entry **to, olsr_bool *this_
                        }
                        if (!ipequal(&already_saved_name_entries->ip, &from_packet->ip))
                        {
+#ifndef NODEBUG
+                               struct ipaddr_str strbuf2, strbuf3;
+#endif
                                OLSR_PRINTF(4, "NAME PLUGIN: updating ip %s -> %s (%s)\n",
                                        olsr_ip_to_string(&strbuf, &already_saved_name_entries->ip),
-                                       olsr_ip_to_string(&strbuf, &from_packet->ip),
-                                       olsr_ip_to_string(&strbuf, &already_saved_name_entries->ip));
+                                       olsr_ip_to_string(&strbuf2, &from_packet->ip),
+                                       olsr_ip_to_string(&strbuf3, &already_saved_name_entries->ip));
                                memcpy(&already_saved_name_entries->ip, &from_packet->ip, olsr_cnf->ipsize);
                                *this_table_changed = OLSR_TRUE;
                        }
@@ -1484,7 +1487,7 @@ write_latlon_file(void)
        FILE* js;
        struct olsr_if *ifs;
        union olsr_ip_addr ip;
-       struct ipaddr_str strbuf;
+       struct ipaddr_str strbuf1, strbuf2;
        struct tc_entry *tc;
        struct tc_edge_entry *tc_edge;
 
@@ -1506,13 +1509,12 @@ write_latlon_file(void)
                {
                        if (olsr_cnf->ip_version == AF_INET)
                        {
-                               struct ipaddr_str strbuf;
                                /*
                                 * Didn't find a good sample to grab a simple
                                 * olsr_ip_addr from a given interface. Sven-Ola
                                 */
-                               const char* p = olsr_ip_to_string(&strbuf, &olsr_cnf->main_addr);
-                               const char* q = ip4_to_string(&strbuf, ifs->interf->int_addr.sin_addr);
+                               const char* p = olsr_ip_to_string(&strbuf1, &olsr_cnf->main_addr);
+                               const char* q = ip4_to_string(&strbuf1, ifs->interf->int_addr.sin_addr);
                                if (0 != strcmp(p, q))
                                {
                                        fprintf(js, "Mid('%s','%s');\n", p, q);
@@ -1520,10 +1522,9 @@ write_latlon_file(void)
                        }
                        else if (!(ipequal(&olsr_cnf->main_addr, (union olsr_ip_addr *)&ifs->interf->int6_addr.sin6_addr)))
                        {
-                               struct ipaddr_str strbuf;
                                fprintf(js, "Mid('%s','%s');\n",
-                                       olsr_ip_to_string(&strbuf, &olsr_cnf->main_addr),
-                                       olsr_ip_to_string(&strbuf, (union olsr_ip_addr *)&ifs->interf->int6_addr.sin6_addr));
+                                       olsr_ip_to_string(&strbuf1, &olsr_cnf->main_addr),
+                                       olsr_ip_to_string(&strbuf2, (union olsr_ip_addr *)&ifs->interf->int6_addr.sin6_addr));
                        }
                }
        }
@@ -1537,16 +1538,16 @@ write_latlon_file(void)
                        while(alias)
                        {
                                fprintf(js, "Mid('%s','%s');\n",
-                                               olsr_ip_to_string(&strbuf, &entry->main_addr),
-                                               olsr_ip_to_string(&strbuf, &alias->alias));
+                                               olsr_ip_to_string(&strbuf1, &entry->main_addr),
+                                               olsr_ip_to_string(&strbuf2, &alias->alias));
                                alias = alias->next_alias;
                        }
                        entry = entry->next;
                }
        }
        lookup_defhna_latlon(&ip);
-       fprintf(js, "Self('%s',%f,%f,%d,'%s','%s');\n", olsr_ip_to_string(&strbuf, &olsr_cnf->main_addr),
-                       my_lat, my_lon, get_isdefhna_latlon(), olsr_ip_to_string(&strbuf, &ip), my_names->name);
+       fprintf(js, "Self('%s',%f,%f,%d,'%s','%s');\n", olsr_ip_to_string(&strbuf1, &olsr_cnf->main_addr),
+                       my_lat, my_lon, get_isdefhna_latlon(), olsr_ip_to_string(&strbuf2, &ip), my_names->name);
        for (hash = 0; hash < HASHSIZE; hash++) 
        {
                struct db_entry *entry;
@@ -1556,8 +1557,8 @@ write_latlon_file(void)
                        for (name = entry->names; name != NULL; name = name->next) 
                        {
                                fprintf(js, "Node('%s',%s,'%s','%s');\n",
-                                       olsr_ip_to_string(&strbuf, &entry->originator),
-                                       name->name, olsr_ip_to_string(&strbuf, &name->ip),
+                                       olsr_ip_to_string(&strbuf1, &entry->originator),
+                                       name->name, olsr_ip_to_string(&strbuf2, &name->ip),
                                        lookup_name_latlon(&entry->originator));
                        }
                }
@@ -1565,10 +1566,9 @@ write_latlon_file(void)
 
        OLSR_FOR_ALL_TC_ENTRIES(tc) {
                OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) {
-                       struct ipaddr_str dstbuf, addrbuf;
                        fprintf(js, "Link('%s','%s',%f,%f,%f);\n", 
-                                       olsr_ip_to_string(&dstbuf, &tc_edge->T_dest_addr),
-                                       olsr_ip_to_string(&addrbuf, &tc->addr), 
+                                       olsr_ip_to_string(&strbuf1, &tc_edge->T_dest_addr),
+                                       olsr_ip_to_string(&strbuf2, &tc->addr), 
                                        tc_edge->link_quality,
                                        tc_edge->inverse_link_quality,
                                        olsr_calc_tc_etx(tc_edge));
index 702a94d..86e5031 100644 (file)
@@ -40,7 +40,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: olsrd_txtinfo.c,v 1.15 2007/11/08 22:47:41 bernd67 Exp $
+ * $Id: olsrd_txtinfo.c,v 1.16 2007/11/29 00:10:17 bernd67 Exp $
  */
 
 /*
@@ -297,7 +297,7 @@ static void ipc_action(int fd)
 
 static void ipc_print_neigh_link(void)
 {
-    struct ipaddr_str buf;
+    struct ipaddr_str buf1, buf2;
     struct neighbor_entry *neigh;
     struct neighbor_2_list_entry *list_2;
     struct link_entry *link = NULL;
@@ -309,8 +309,8 @@ static void ipc_print_neigh_link(void)
     link = link_set;
     while(link)        {
        ipc_sendf( "%s\t%s\t%0.2f\t%0.2f\t%d\t%d\t%0.2f\t%0.2f\t\n",
-                   olsr_ip_to_string(&buf, &link->local_iface_addr),
-                   olsr_ip_to_string(&buf, &link->neighbor_iface_addr),
+                   olsr_ip_to_string(&buf1, &link->local_iface_addr),
+                   olsr_ip_to_string(&buf2, &link->neighbor_iface_addr),
                    link->L_link_quality, 
                    link->loss_link_quality,
                    link->lost_packets, 
@@ -327,7 +327,7 @@ static void ipc_print_neigh_link(void)
             neigh != &neighbortable[index];
             neigh = neigh->next) {
             ipc_sendf("%s\t%s\t%s\t%s\t%d\t", 
-                      olsr_ip_to_string(&buf, &neigh->neighbor_main_addr),
+                      olsr_ip_to_string(&buf1, &neigh->neighbor_main_addr),
                       (neigh->status == SYM) ? "YES" : "NO",
                       neigh->is_mpr ? "YES" : "NO",
                       olsr_lookup_mprs_set(&neigh->neighbor_main_addr) ? "YES" : "NO",
@@ -338,7 +338,7 @@ static void ipc_print_neigh_link(void)
                 list_2 != &neigh->neighbor_2_list;
                 list_2 = list_2->next)
                 {
-                    //size += sprintf(&buf[size], "<option>%s</option>\n", olsr_ip_to_string(&buf, &list_2->neighbor_2->neighbor_2_addr));
+                    //size += sprintf(&buf[size], "<option>%s</option>\n", olsr_ip_to_string(&buf1, &list_2->neighbor_2->neighbor_2_addr));
                     thop_cnt ++;
                 }
             ipc_sendf("%d\n", thop_cnt);
@@ -349,7 +349,7 @@ static void ipc_print_neigh_link(void)
 
 static void ipc_print_routes(void)
 {
-    struct ipaddr_str buf;
+    struct ipaddr_str buf1, buf2;
     struct rt_entry *rt;
     struct avl_node *rt_tree_node;
 
@@ -363,9 +363,9 @@ static void ipc_print_routes(void)
         rt = rt_tree_node->data;
 
         ipc_sendf( "%s/%d\t%s\t%d\t%.3f\t%s\t\n",
-                   olsr_ip_to_string(&buf, &rt->rt_dst.prefix),
+                   olsr_ip_to_string(&buf1, &rt->rt_dst.prefix),
                    rt->rt_dst.prefix_len,
-                   olsr_ip_to_string(&buf, &rt->rt_best->rtp_nexthop.gateway),
+                   olsr_ip_to_string(&buf2, &rt->rt_best->rtp_nexthop.gateway),
                    rt->rt_best->rtp_metric.hops,
                    rt->rt_best->rtp_metric.etx,
                    if_ifwithindex_name(rt->rt_best->rtp_nexthop.iif_index));
index f852d29..2899318 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: mid_set.c,v 1.23 2007/11/08 22:47:41 bernd67 Exp $
+ * $Id: mid_set.c,v 1.24 2007/11/29 00:10:17 bernd67 Exp $
  */
 
 #include "defs.h"
@@ -226,12 +226,12 @@ insert_mid_alias(const union olsr_ip_addr *main_add, const union olsr_ip_addr *a
   struct mid_entry *me_old;
   int ne_ref_rp_count;
 #ifndef NODEBUG
-  struct ipaddr_str buf;
+  struct ipaddr_str buf1, buf2;
 #endif
   struct mid_address *adr = olsr_malloc(sizeof(struct mid_address), "Insert MID alias");
   
-  OLSR_PRINTF(1, "Inserting alias %s for ", olsr_ip_to_string(&buf, alias));
-  OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&buf, main_add));
+  OLSR_PRINTF(1, "Inserting alias %s for ", olsr_ip_to_string(&buf1, alias));
+  OLSR_PRINTF(1, "%s\n", olsr_ip_to_string(&buf1, main_add));
 
   //COPY_IP(&adr->alias, alias);
   adr->alias = *alias;
@@ -242,7 +242,7 @@ insert_mid_alias(const union olsr_ip_addr *main_add, const union olsr_ip_addr *a
   // neighbortable and link_set will be created by way of this mid entry.
   ne_old = olsr_lookup_neighbor_table_alias(alias);
   if (ne_old != NULL) {
-     OLSR_PRINTF(2, "Remote main address change detected. Mangling neighbortable to replace %s with %s.\n", olsr_ip_to_string(&buf, alias), olsr_ip_to_string(&buf, main_add));
+     OLSR_PRINTF(2, "Remote main address change detected. Mangling neighbortable to replace %s with %s.\n", olsr_ip_to_string(&buf1, alias), olsr_ip_to_string(&buf2, main_add));
      olsr_delete_neighbor_table(alias);
      ne_new = olsr_insert_neighbor_table(main_add);
      // adjust pointers to neighbortable-entry in link_set