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

Hans-Christoph Steiner hans at guardianproject.info
Tue Jul 31 17:46:49 UTC 2012


Thanks for tracking this down.  Turns out the issue was bigger than
that, but I just committed and pushed a fix that works for me.  Its in
the olsrd.git, please test it there, or use the attached patch.

.hc

On 07/30/2012 11:35 AM, Benjamin Chodoroff wrote:
> 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
> 
> _______________________________________________
> Commotion-dev mailing list
> Commotion-dev at lists.chambana.net
> http://lists.chambana.net/mailman/listinfo/commotion-dev
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-jsoninfo-fix-crash-in-interfaces-when-olsrd-is-using.patch
Type: text/x-patch
Size: 3250 bytes
Desc: not available
URL: <http://lists.chambana.net/pipermail/commotion-dev/attachments/20120731/79213425/attachment.bin>


More information about the Commotion-dev mailing list