[Commotion-dev] Can't talk between desktop OLSRd and Commotion OpenWRT boxes

Ben West ben at gowasabi.net
Tue Mar 19 06:13:00 UTC 2013


I have been able to get a custom-compiled olsrd running now under my own
instances of Ubuntu quantal, by applying this patch to src/net_olsr.c and
then rebuilding the debs:
https://lists.olsr.org/pipermail/olsr-dev/2012-June/005547.html

This patch was referred to in the thread started by Hans on this topic in
the olsr-dev listserv:
https://lists.olsr.org/pipermail/olsr-dev/2013-March/006725.html

Interestingly, the original bug was basically that olsrd was not sending
outgoing packets out the wireless interface, instead failing with error
message "sendto(v4): Invalid argument."  The variables that are supposed to
store the destination address for IPv4/6 packets, due to improper
declaration, were being sometimes optimized away, depending on the gcc
version and the optimization flags given.  The patch mentioned above
corrects the variables' declaration.

It seems this particular bug has been fixed in newer versions of olsrd, but
I'm guessing Canonical isn't going to be especially prompt about releasing
an updated Ubuntu package.

Could this patch be included in the guardianproject PPA for olsrd?

On Mon, Mar 18, 2013 at 2:38 PM, Ben West <ben at gowasabi.net> wrote:

> Hi All,
>
> I'm having difficulty replicating this solution on my own platform (Ubuntu
> quantal i386 under a VMware host, but with real USB wifi radio).
>
> That is, removing the O2 compile option and recompiling olsrd does not
> seem to yield a working olsrd for me.  I'm presently trying this out on a
> real host instead (i.e. no virtualization), but that is slowly opening a
> delightful can of worms w/r/t/ to thge newer Ubuntus dropping legacy video
> driver support and other such pleasantness.
>
> If the problem's source has been conclusively narrowed down to the -O2
> (and even -fPIE?) flag added by Hans' patch 310-hardening-fixes.patch,
> could Hans just release an updated olsrd package in his PPA, with those
> flags removed, as an interim workaround for anyone not able to compile
> their own?
>
> On Sat, Mar 9, 2013 at 12:34 PM, Mikael Nordfeldth <mmn at hethane.se> wrote:
>
>> 2013-03-08 19:27, Hans-Christoph Steiner skrev:
>> > That would be quite useful if you have the time!  Another thing that
>> might the
>> > whole process easier is to 'git bisect', if you are familiar with that..
>> > Right now, Debian squeeze and wheezy have 0.6.2, and Ubuntu has 0.6.1
>> and 0.6.3:
>> >
>> > http://packages.debian.org/search?keywords=olsrd
>> > http://packages.ubuntu.com/search?keywords=olsrd
>> >
>> > So the idea is to find out which version of these we can rely on, and
>> which we
>> > need to use replacements.
>>
>> Gah. This seems way more advanced than what I can explain with my
>> knowledge. Nevertheless, I did find what caused my error, the -O2 gcc
>> optimization switch as patched by Debian package "hardening fixes":
>>
>> 1. I tried compiling various olsrd versions. All worked.
>> 2. I tried compiling 0.6.3-5~quantal from 'apt-get source'. It didn't
>> work.
>> 3. I tried compiling the 0.6.3.orig source (same as above, without
>> debian patches) It worked.
>> 4. None of the patches contained any networking code (except the json
>> plugin, but disabling it didn't have any effect anyway)
>> 5. I found that removing the -O2 switch on line 227 in Makefile.inc, as
>> patched by 310-hardening-fixes.patch resolved my invalid argument
>> sendto(v4) issue:
>>
>>  %.o: %.c
>>         @echo "[CC] $<"
>> -       $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
>> +       $(CC) -O2 $(CFLAGS) $(CPPFLAGS) -fPIE -c -o $@ $<
>>
>>
>> Reverting this (and even leaving the -fPIE there but removing -O2) makes
>> the resulting binary functional.
>>
>>
>> So the specific problem was caused by the -O2 parameter to gcc, I guess
>> making it a compiling/linking issue. I don't know enough about this
>> myself though, so I'm attaching ('O2-opts') the output of what that
>> level of optimizations means if anyone is interested (gcc -c -Q -O2
>> --help=optimizers)
>>
>> More info on my build environment is below:
>>
>> $ gcc -v
>> Using built-in specs.
>> COLLECT_GCC=gcc
>> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
>> Target: x86_64-linux-gnu
>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
>> 4.7.2-2ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
>> --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
>> --program-suffix=-4.7 --enable-shared --enable-linker-build-id
>> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
>> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
>> --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
>> --enable-libstdcxx-debug --enable-libstdcxx-time=yes
>> --enable-gnu-unique-object --enable-plugin --enable-objc-gc
>> --disable-werror --with-arch-32=i686 --with-tune=generic
>> --enable-checking=release --build=x86_64-linux-gnu
>> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
>> Thread model: posix
>> gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1)
>>
>>
>> $ uname -a
>> Linux plexi 3.5.0-25-generic #39-Ubuntu SMP Mon Feb 25 18:26:58 UTC 2013
>> x86_64 x86_64 x86_64 GNU/Linux
>>
>> _______________________________________________
>> Commotion-dev mailing list
>> Commotion-dev at lists.chambana.net
>> https://lists.chambana.net/mailman/listinfo/commotion-dev
>>
>>
>
>
> --
> Ben West
> http://gowasabi.net
> ben at gowasabi.net
> 314-246-9434
>



-- 
Ben West
http://gowasabi.net
ben at gowasabi.net
314-246-9434
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.chambana.net/pipermail/commotion-dev/attachments/20130319/172fccf6/attachment.html>


More information about the Commotion-dev mailing list