[Olsr-dev] olsrd-0.6.4 host emulation mode socket error

Vigneswaran R (spam-protected)
Mon Feb 11 09:14:43 CET 2013


[resending as plain text]

When I ran olsrd (0.6.4) in host emulation mode with olsr_switch, I got 
the error "sendto(v4): Socket operation on non-socket".

To reproduce the error, (after doing 'make' and 'make switch')

     ./olsrd -f olsrd.emu.conf -hemu

To debug, I ran olsrd with 'strace' and found that socket information 
(the variable 'send_socket') provided to sendto was '0' which caused the 
above error. On exploring the code, realized that in host emulation mode 
the 'send_socket' was not set.

Following is a small patch to resolve this problem. Thank you.



diff -aur olsrd-0.6.4/src/unix/ifnet.c olsrd-0.6.4-patched/src/unix/ifnet.c
--- olsrd-0.6.4/src/unix/ifnet.c	2012-10-31 00:29:44.000000000 +0530
+++ olsrd-0.6.4-patched/src/unix/ifnet.c	2013-02-07 11:17:22.000000000 +0530
@@ -452,7 +452,7 @@
       *on what interface the message is transmitted

-    ifp->olsr_socket = gethemusocket(&sin);
+    ifp->send_socket = ifp->olsr_socket = gethemusocket(&sin);

      if (ifp->olsr_socket < 0) {
        fprintf(stderr, "Could not initialize socket... exiting!\n\n");

More information about the Olsr-dev mailing list