GnuTLS 3, BSD, netinet/ip.h
Phil Pennock
help-gnutls-phil at spodhuis.org
Wed May 23 03:03:25 CEST 2012
On 2012-05-22 at 10:28 +0200, Nikos Mavrogiannopoulos wrote:
[ EOF vs buffer overflow ]
> We have separate error codes for these conditions in gnutls 3.0.x.
Ah, thanks. FreeBSD Ports system and Ubuntu both lack GnuTLS 3, so I
stuck to 2.12.
Building GnuTLS 3 on my dated FreeBSD 7 series install is failing, but
when I check on a more recent (FreeBSD 9) system I see that the relevant
type has been changed to avoid the issue.
----------------------------8< cut here >8------------------------------
CC serv.o
In file included from common.h:31,
from serv.c:28:
/usr/include/netinet/ip.h:162: error: expected specifier-qualifier-list before 'n_long'
serv.c: In function 'tcp_server':
serv.c:1245: warning: cast to pointer from integer of different size
*** Error code 1
----------------------------8< cut here >8------------------------------
----------------------------8< cut here >8------------------------------
149 struct ip_timestamp {
...
161 union ipt_timestamp {
162 n_long ipt_time[1];
163 struct ipt_ta {
164 struct in_addr ipt_addr;
165 n_long ipt_time;
166 } ipt_ta[1];
167 } ipt_timestamp;
----------------------------8< cut here >8------------------------------
Editing src/common.h to #include <netinet/in_systm.h> just before
pulling in <netinet/ip.h> fixes this.
That in_systm.h file really just does:
typedef u_int16_t n_short;
typedef u_int32_t n_long;
typedef u_int32_t n_time;
(and a function definition if inside the kernel).
FreeBSD 9 has replaced n_long with uint32_t.
Browsing:
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netinet/ip.h
the annotated view shows this changed in file revision 1.34 and so is in
FreeBSD 8 onwards. FreeBSD 7.4 is a legacy release.
I just built with:
# if defined(__FreeBSD__) && __FreeBSD__ < 8
# include <netinet/in_systm.h>
# endif
# include <netinet/ip.h>
I see that NetBSD has switched to using "n_time" as the type:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/netinet/ip.h?rev=1.32&content-type=text/x-cvsweb-markup&only_with_tag=MAIN
and n_time seems to still require pulling in <netinet/in_systm.h>.
OpenBSD is also using n_time, I don't have a handy VM for that to grep
over the source tree and confirm that <netinet/in_systm.h> is the only
definition and the only include path in userland.
http://www.openbsd.org/cgi-bin/cvsweb/src/sys/netinet/ip.h?rev=1.13;content-type=text%2Fx-cvsweb-markup
I don't touch autoconf enough to provide a good solution for you, sorry.
-Phil
More information about the Gnutls-help
mailing list