[Commotion-dev] doubledip: starting olsrd with alias interfaces & olsr jsoninfo segfault on down interface

Benjamin Chodoroff ben at theworkdept.com
Mon Jul 30 15:35:23 UTC 2012


hi commotion!

first thing: i've noticed that, at least on some ubuntu systems i use,
you need to specify an alias interface name when you start olsrd for it
to work.. like ``olsrd -i wlan0:0'' if your mesh interface is wlan0.
olsrd ends up using wlan0 and not using wlan0:0 -- it marks it as down.

second thing: when olsrd has an interface that is down, jsoninfo doesn't
deal with it gracefully - it segfaults!

i used httpinfo as an example and patched
lib/jsoninfo/src/olsrd_jsoninfo.c - jsoninfo checks to see if rifs
exists, but not before it tries to read from it!

--8<--

diff --git a/lib/jsoninfo/src/olsrd_jsoninfo.c
b/lib/jsoninfo/src/olsrd_jsoninfo.c
index 2057468..5faec7a 100644
--- a/lib/jsoninfo/src/olsrd_jsoninfo.c
+++ b/lib/jsoninfo/src/olsrd_jsoninfo.c
@@ -1068,6 +1068,10 @@ ipc_print_interfaces(struct autobuf *abuf)
   abuf_json_open_array(abuf, "interfaces");
   for (ifs = olsr_cnf->interfaces; ifs != NULL; ifs = ifs->next) {
     const struct interface *const rifs = ifs->interf;
+    if (!rifs) {
+      abuf_json_string(abuf, "state", "down");
+      continue;
+    }
     abuf_json_open_array_entry(abuf);
     abuf_json_string(abuf, "name", ifs->name);
 //    abuf_json_string(abuf, "nameFromKernel", ifs->interf->int_name);

--8<--

i can post this to the olsr mailinglist, but i wanted to check in with
people here to make sure i'm not doing anything totally idiotic :)

we can remove the if(!rifs) test a few lines down if this seems to be
the right way of doing things.

thanks!
ben



More information about the Commotion-dev mailing list