Build error on systems without IPV6 support (regression from 1.4.46)
I've configured 1.4.47 with option --disable-ipv6 (my embedded system doesn't have it).
During build I have this error:
/src/lighttpd-1.4.47/src/network.c: In function ‘network_host_normalize_addr_str’: /src/lighttpd-1.4.47/src/network.c:82:23: error: ‘sock_addr’ has no member named ‘ipv6’ Makefile:2346: recipe for target 'lighttpd-network.o' failed
Looking at network.c I see a new function, added with commit 3549fc828005cd5ef5110f44f17b9ff0f5665bb9:
static void network_host_normalize_addr_str(buffer *host, sock_addr *addr)
The offending code is at line 80:
unsigned short port = (addr->plain.sa_family == AF_INET) ? ntohs(addr->ipv4.sin_port) : ntohs(addr->ipv6.sin6_port);
sock_addr struct (in base.h) doesn't contain the ->ipv6 element when --disable-ipv6 option is used.
I've patched it like this (I really want to avoid IPV6 stuff...):
#ifdef HAVE_IPV6 unsigned short port = (addr->plain.sa_family == AF_INET) ? ntohs(addr->ipv4.sin_port) : ntohs(addr->ipv6.sin6_port); #else unsigned short port = ntohs(addr->ipv4.sin_port); #endif buffer_append_string_len(host, CONST_STR_LEN(":")); buffer_append_int(host, (int)port); }
Don't know if it's better to patch base.h instead...
Also available in: Atom