Index: Makefile --- Makefile.orig 2003-01-03 19:52:40.000000000 +0100 +++ Makefile 2003-10-21 12:08:03.000000000 +0200 @@ -128,12 +128,12 @@ 386bsd netbsd bsdos: @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \ LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= \ - EXTRA_CFLAGS=VSYSLOG= all + EXTRA_CFLAGS= VSYSLOG= all freebsd: @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \ LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= \ - EXTRA_CFLAGS=VSYSLOG= all + EXTRA_CFLAGS=-I. VSYSLOG= all linux: @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \ Index: tcpd.h --- tcpd.h.orig 2003-01-05 02:15:59.000000000 +0100 +++ tcpd.h 2003-10-21 12:08:03.000000000 +0200 @@ -7,6 +7,8 @@ #ifndef TCP_WRAPPERS_HEADER #define TCP_WRAPPERS_HEADER +#include +#include #include #include Index: fix_options.c --- fix_options.c.orig 2003-01-05 02:27:10.000000000 +0100 +++ fix_options.c 2003-10-21 12:08:31.000000000 +0200 @@ -47,7 +47,14 @@ clean_exit(request); } if (ADDR_FAM(&ss) == AF_INET) { +#if defined(__FreeBSD__) || defined(__sun__) + unsigned char optbuf[BUFFER_SIZE / 3]; + int optlen; + struct in_addr dummy; + unsigned char *ucp; +#else struct ip_opts optbuf; +#endif char lbuf[BUFFER_SIZE], *lp, *cp; struct protoent *ip; int optsize = sizeof(optbuf); @@ -65,9 +72,15 @@ * here was wrong. */ +#if defined(__FreeBSD__) || defined(__sun__) +#define ADDR_LEN sizeof(dummy.s_addr) + for (ucp = optbuf + ADDR_LEN; ucp < optbuf + optsize; ucp += optlen) { + u_char c = ucp[IPOPT_OPTVAL]; +#else for (i = 0; (void *)&optbuf.ip_opts[i] - (void *)&optbuf < optsize; ) { u_char c = (u_char)optbuf.ip_opts[i]; +#endif if (c == IPOPT_LSRR || c == IPOPT_SSRR) { syslog(LOG_WARNING, "refused connect from %s with IP source routing options", @@ -77,7 +90,17 @@ } if (c == IPOPT_EOL) break; +#if defined(__FreeBSD__) || defined(__sun__) + if (c == IPOPT_NOP) + optlen = 1; + else { + optlen = cp[IPOPT_OLEN]; + if (optlen <= 0) /* Do not loop! */ + break; + } +#else i += (c == IPOPT_NOP) ? 1 : (u_char)optbuf.ip_opts[i+1]; +#endif } lp = lbuf; Index: internal.h --- internal.h.orig 2003-01-05 00:37:53.000000000 +0100 +++ internal.h 2003-10-21 12:08:03.000000000 +0200 @@ -7,6 +7,7 @@ #ifndef IMPL_HEADER #define IMPL_HEADER +#include #include #include #include