* do not generate netmasks but the prefixlen
authorBernd Petrovitsch <bernd@firmix.at>
Wed, 12 Dec 2007 22:06:24 +0000 (22:06 +0000)
committerBernd Petrovitsch <bernd@firmix.at>
Wed, 12 Dec 2007 22:06:24 +0000 (22:06 +0000)
lib/httpinfo/src/admin_interface.c
lib/httpinfo/src/olsrd_httpinfo.c

index 2cdea3a..6845248 100644 (file)
@@ -37,7 +37,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: admin_interface.c,v 1.15 2007/12/02 19:00:29 bernd67 Exp $
+ * $Id: admin_interface.c,v 1.16 2007/12/12 22:06:24 bernd67 Exp $
  */
 
 /*
@@ -152,26 +152,13 @@ build_admin_body(char *buf, olsr_u32_t bufsize __attribute__((unused)))
   size += snprintf(&buf[size], bufsize-size, admin_frame_mid);
 
   if(olsr_cnf->hna_entries) {
-    if(olsr_cnf->ip_version == AF_INET) {
-      struct ip_prefix_list *hna;
-      struct ipaddr_str netbuf, maskbuf;
-      for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) {
-        union olsr_ip_addr netmask;
-        olsr_prefix_to_netmask(&netmask, hna->net.prefix_len);
-        size += snprintf(&buf[size], bufsize-size,
-                         "<tr><td halign=\"middle\"><input type=\"checkbox\" name=\"del_hna%1$s*%2$s\" class=\"input_checkbox\"></td><td>%1$s</td><td>%2$s</td></tr>\n",
-                         olsr_ip_to_string(&netbuf, &hna->net.prefix),
-                         olsr_ip_to_string(&maskbuf, &netmask));
-      }
-    } else {
-      struct ip_prefix_list *hna;
-      for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) {
-        struct ipaddr_str netbuf;
-        size += snprintf(&buf[size], bufsize-size,
-                         "<tr><td halign=\"middle\"><input type=\"checkbox\" name=\"del_hna%1$s*%2$d\" class=\"input_checkbox\"></td><td>%1$s</td><td>%2$d</td></tr>\n",
-                         olsr_ip_to_string(&netbuf, &hna->net.prefix),
-                         hna->net.prefix_len);
-      }
+    struct ip_prefix_list *hna;
+    for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) {
+      struct ipaddr_str netbuf;
+      size += snprintf(&buf[size], bufsize-size,
+                       "<tr><td halign=\"middle\"><input type=\"checkbox\" name=\"del_hna%1$s*%2$d\" class=\"input_checkbox\"></td><td>%1$s</td><td>%2$d</td></tr>\n",
+                       olsr_ip_to_string(&netbuf, &hna->net.prefix),
+                       hna->net.prefix_len);
     }
   }
   size += snprintf(&buf[size], bufsize-size, admin_frame_epilog);
index 237db6f..66cef4e 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: olsrd_httpinfo.c,v 1.89 2007/12/02 19:00:29 bernd67 Exp $
+ * $Id: olsrd_httpinfo.c,v 1.90 2007/12/12 22:06:24 bernd67 Exp $
  */
 
 /*
@@ -950,26 +950,13 @@ static int build_config_body(char *buf, olsr_u32_t bufsize)
     size += section_title(&buf[size], bufsize-size, "Announced HNA entries");
     if (olsr_cnf->hna_entries) {
       struct ip_prefix_list *hna;
-      if (olsr_cnf->ip_version == AF_INET) {
-       size += snprintf(&buf[size], bufsize-size, "<tr><th>Network</th><th>Netmask</th></tr>\n");
-       for (hna = olsr_cnf->hna_entries; hna; hna = hna->next) {
-          union olsr_ip_addr netmask;
-          struct ipaddr_str netbuf, maskbuf;
-          olsr_prefix_to_netmask(&netmask, hna->net.prefix_len);
-          size += snprintf(&buf[size], bufsize-size,
-                           "<tr><td>%s</td><td>%s</td></tr>\n", 
-                           olsr_ip_to_string(&netbuf, &hna->net.prefix),
-                           olsr_ip_to_string(&maskbuf, &netmask));
-        }
-      } else {
-       size += snprintf(&buf[size], bufsize-size, "<tr><th>Network</th><th>Prefix length</th></tr>\n");
-       for (hna = olsr_cnf->hna_entries; hna; hna = hna->next) {
-          struct ipaddr_str netbuf;
-          size += snprintf(&buf[size], bufsize-size,
-                           "<tr><td>%s</td><td>%d</td></tr>\n", 
-                           olsr_ip_to_string(&netbuf, &hna->net.prefix),
-                           hna->net.prefix_len);
-        }
+      size += snprintf(&buf[size], bufsize-size, "<tr><th>Network</th></tr>\n");
+      for (hna = olsr_cnf->hna_entries; hna; hna = hna->next) {
+        struct ipaddr_str netbuf;
+        size += snprintf(&buf[size], bufsize-size,
+                         "<tr><td>%s/%d</td></tr>\n", 
+                         olsr_ip_to_string(&netbuf, &hna->net.prefix),
+                         hna->net.prefix_len);
       }
     } else {
       size += snprintf(&buf[size], bufsize-size, "<tr><td></td></tr>\n");