summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fastd_config.h.in1
-rw-r--r--src/socket.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/fastd_config.h.in b/src/fastd_config.h.in
index 4402139..7426baf 100644
--- a/src/fastd_config.h.in
+++ b/src/fastd_config.h.in
@@ -33,6 +33,7 @@
#cmakedefine USE_BINDTODEVICE
+#cmakedefine USE_FREEBIND
#cmakedefine USE_PMTU
#cmakedefine USE_PKTINFO
#cmakedefine USE_PACKET_MARK
diff --git a/src/socket.c b/src/socket.c
index 526e63f..4f5ac0f 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -69,6 +69,11 @@ static int bind_socket(fastd_context_t *ctx, const fastd_bind_address_t *addr, b
}
#endif
+#ifdef USE_FREEBIND
+ if (setsockopt(fd, IPPROTO_IP, IP_FREEBIND, &one, sizeof(one)))
+ pr_warn_errno(ctx, "setsockopt: unable to set IP_FREEBIND");
+#endif
+
if (af == AF_INET6) {
if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &one, sizeof(one))) {
pr_error_errno(ctx, "setsockopt: unable to set IPV6_RECVPKTINFO");