From da2319578555e56eafab0141505ce943f954d859 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 31 Mar 2021 08:29:27 +0200 Subject: [PATCH] BUILD: tcp: use IPPROTO_IPV6 instead of SOL_IPV6 on FreeBSD/MacOS Lukas reported in issue #1203 that the previous fix for silent-drop in commit ab79ee8b1 ("BUG/MINOR: tcp: fix silent-drop workaround for IPv6") breaks the build on FreeBSD/MacOS due to SOL_IPV6 not being defined. On these platforms, IPPROTO_IPV6 must be used instead, so this should fix it. This needs to be backported to whatever version the fix above is backported to. --- src/tcp_act.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tcp_act.c b/src/tcp_act.c index 3bb4ab86c..fa0a9898b 100644 --- a/src/tcp_act.c +++ b/src/tcp_act.c @@ -211,8 +211,13 @@ static enum act_return tcp_exec_action_silent_drop(struct act_rule *rule, struct setsockopt(conn->handle.fd, SOL_IP, IP_TTL, &one, sizeof(one)); #endif #ifdef IPV6_UNICAST_HOPS +#if defined(SOL_IPV6) if (conn->src && conn->src->ss_family == AF_INET6) setsockopt(conn->handle.fd, SOL_IPV6, IPV6_UNICAST_HOPS, &one, sizeof(one)); +#elif defined(IPPROTO_IPV6) + if (conn->src && conn->src->ss_family == AF_INET6) + setsockopt(conn->handle.fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &one, sizeof(one)); +#endif #endif out: /* kill the stream if any */