GnuTLS 2.6.6/2.7.8 assumes AF_INET6 is available

Tom G. Christensen tgc at jupiterrise.com
Wed May 6 19:34:28 CEST 2009


On Wed, May 06, 2009 at 10:01:20AM +0200, Simon Josefsson wrote:
> "Tom G. Christensen" <tgc at jupiterrise.com> writes:
> 
> >> Interesting.  Does adding this to the top of serv.c work:
> >> 
> >> #ifndef HAVE_IPV6
> >> # define sockaddr_storage sockaddr_in
> >> #endif
> >> 
> > This causes another error:
> >
> > gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I..  -I../includes -I../includes
> > -I../lgl -I../lgl -I../gl -I../gl -I./cfg -I/usr/tgcware/include
> > -I/usr/tgcware/include -g -O2 -Wno-pointer-sign -MT serv.o -MD -MP -MF
> > .deps/serv.Tpo -c -o serv.o serv.c
> > serv.c: In function 'get_port':
> > serv.c:789: error: 'const struct sockaddr_in' has no member named
> > 'ss_family'
> > make[3]: *** [serv.o] Error 1
> 
> Oops, try this instead:
> 
> #ifndef HAVE_IPV6
> # define sockaddr_storage sockaddr
> #endif
> 
> There is another more complex work around mentioned at the end of:
> 
> http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html
> 
> Maybe the above won't work, and then maybe we need something like that.
> 
If I'm reading the referenced manpage correctly struct sockaddr is not
expected to have an ss_family member so the above define will not work
as is.
Instead I replaced the reference to ss_family with sa_family and now it
builds to completion.
I also ran the testsuite and it passes all tests.
The full log from running the testsuite is available at
http://jupiterrise.com/tmp

I noticed that the compiler complained when building some of the test
programs:
x509self.c: In function 'server_start':
x509self.c:360: warning: passing argument 4 of 'setsockopt' from
incompatible pointer type
x509self.c: In function 'server':
x509self.c:434: warning: implicit declaration of function 'bzero'
x509self.c:434: warning: incompatible implicit declaration of built-in
function 'bzero'

-tgc





More information about the Gnutls-devel mailing list