On Fri, 2007-04-27 at 09:30 -0700, Patrick McCarty wrote:
> Hi all,
> 
> I'm experiencing some minor problems during compilation under a stock
> OpenBSD 4.0 install. I've managed in the end to get a compiled version
> which executes and seems to work, but I thought I'd report my findings
> for others experiencing similar.
> 
> First error: Bison refuses to generate parse.c
> 
> gmake -C src/cfgparser
> gmake[1]: Entering directory `/root/olsrtest/olsrd-0.5.0/src/cfgparser'
> cc -Wall -Wmissing-prototypes -Wstrict-prototypes
> -Wmissing-declarations -Wsign-compare -O2 -g -MD -Isrc -I../../src
> -D__OpenBSD__ -DMAKELIB   -c -o olsrd_conf.o olsrd_conf.c
> bison -d -ooparse.c oparse.y
> gmake[1]: *** [oparse.c] Broken pipe
> gmake[1]: Leaving directory `/root/olsrtest/olsrd-0.5.0/src/cfgparser'
> gmake: *** [cfgparser] Error 2
> 
> In case anyone cares, Its bison (GNU Bison) 2.1

Funny, bison-1.35 and bison-1.875d have no problem with it.

> My action:
> 
> Copied cfgparser directory contents from an already compiled copy from
> a Linux machine.

copying the generated oparse.c should be enough and work.

> (This is probably a very bad idea, and it doesnt identify the cause of
> the problem)
> 
> --------------------
> 
> Second error:
> cc -DVERSION=\"0.5.0\" -MD -Isrc -I./src  -D__OpenBSD__   -c -o
> src/bsd/net.o src/bsd/net.c
> src/bsd/net.c: In function `set_sysctl_int':
> src/bsd/net.c:141: warning: passing arg 4 of `sysctl' from
> incompatible pointer type
> src/bsd/net.c: In function `get_ipv6_address':
> src/bsd/net.c:538: error: storage size of `ifr6' isn't known
> src/bsd/net.c:549: error: dereferencing pointer to incomplete type
> src/bsd/net.c:551: error: dereferencing pointer to incomplete type
> src/bsd/net.c:552: error: dereferencing pointer to incomplete type
> src/bsd/net.c:554: error: dereferencing pointer to incomplete type
> src/bsd/net.c:564: error: `SIOCGIFAFLAG_IN6' undeclared (first use in
> this function)
> src/bsd/net.c:564: error: (Each undeclared identifier is reported only once
> src/bsd/net.c:564: error: for each function it appears in.)
> src/bsd/net.c:572: error: `IN6_IFF_ANYCAST' undeclared (first use in
> this function)
> src/bsd/net.c: In function `olsr_recvfrom':
> src/bsd/net.c:728: error: storage size of `iov' isn't known
> gmake: *** [src/bsd/net.o] Error 1

That needs a patch from the "BSD world". I have no access to *BSD ...

> Next, I was left with the iov size error... after a quick grep of
> /usr/include, I found it referenced in sys/uio.h.
> 
> I added in the OpenBSD include section:
> #include <sys/uio.h>

In bsd/src/net.c (if I understand it correctly)?
I can add that without patch;-)

> This left me with only several warnings:
> 
> src/bsd/net.c: In function `set_sysctl_int':
> src/bsd/net.c:142: warning: passing arg 4 of `sysctl' from
> incompatible pointer type
> 
> src/link_set.o(.text+0x6dc): In function `add_new_entry':
> : warning: strcpy() is almost always misused, please use strlcpy()

Yes, that's (and similar things) on my cleanup list. I'm more thinking
on using snprintf() since that seems to be more widespread available.
But I have no strong feelings for this.
FWIW I ran olsrd compiled with a bounds-checking-patched gcc
(http://sourceforge.net/projects/boundschecking/ - alas, only 4.0.2 is
the most recent) for months (0.4.9 + patched versions) and it never hit
a buffer overrun AFAICT. However, there are statically sized buffers in
there which are filled and - judging from the function in question only
- may overrun.

[...]
> I am however experiencing regular messages as above, stating that its
> trying to send packets to an unreachable network. I suspect this is
> not serious, however intend to investigate soon.

Yes, suchh error messages also an open/uninvestigated issue on Linux.
But AFAICS everything works .....

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services



