From: Alan T. DeKok Date: Thu, 17 Feb 2011 11:05:54 +0000 (+0100) Subject: Better fixes for bug #141 X-Git-Tag: release_2_1_11~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8de105749d7a4b50dbd947d92c6776569c7d9db7;p=thirdparty%2Ffreeradius-server.git Better fixes for bug #141 --- diff --git a/src/lib/udpfromto.c b/src/lib/udpfromto.c index 9dc1d3366c4..bfb2a3a6b70 100644 --- a/src/lib/udpfromto.c +++ b/src/lib/udpfromto.c @@ -68,13 +68,24 @@ RCSID("$Id$") # define IPV6_RECVPKTINFO IPV6_2292PKTINFO # define IPV6_PKTINFO IPV6_2292PKTINFO # endif -# else -# undef IPV6_PKTINFO -# define IPV6_PKTINFO IPV6_RECVPKTINFO # endif # endif #endif +/* + * Linux requires IPV6_RECVPKTINFO for the setsockopt() call, + * but sendmsg() and recvmsg() require IPV6_PKTINFO. + * + * We want all *other* (i.e. sane) systems to use IPV6_PKTINFO + * for all three calls. + */ +#ifdef IPV6_PKTINFO +#ifdef __linux__ +#define FR_IPV6_RECVPKTINFO IPV6_RECVPKTINFO +#else +#define FR_IPV6_RECVPKTINFO IPV6_PKTINFO +#endif +#endif int udpfromto_init(int s) { @@ -115,15 +126,11 @@ int udpfromto_init(int s) * This should actually be standard IPv6 */ proto = IPPROTO_IPV6; -#ifdef __linux__ + /* - * Requires this for "setsockopt" but not for - * recv/sendmsg() + * Work around Linux-specific hackery. */ - flag = IPV6_RECVPKTINFO -#else - flag = IPV6_PKTINFO; -#endif + flag = FR_IPV6_RECVPKTINFO; #endif #endif } else {