summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysdep/cf/bsd-v6.h1
-rw-r--r--sysdep/cf/bsd.h1
-rw-r--r--sysdep/unix/io.c9
3 files changed, 11 insertions, 0 deletions
diff --git a/sysdep/cf/bsd-v6.h b/sysdep/cf/bsd-v6.h
index 3403299f..47a7c7ff 100644
--- a/sysdep/cf/bsd-v6.h
+++ b/sysdep/cf/bsd-v6.h
@@ -13,6 +13,7 @@
#define CONFIG_MULTIPLE_TABLES
#define CONFIG_SKIP_MC_BIND
+#define CONFIG_NO_IFACE_BIND
/*
Link: sysdep/unix
diff --git a/sysdep/cf/bsd.h b/sysdep/cf/bsd.h
index 1101b228..5e6d03e8 100644
--- a/sysdep/cf/bsd.h
+++ b/sysdep/cf/bsd.h
@@ -11,6 +11,7 @@
#define CONFIG_MULTIPLE_TABLES
#define CONFIG_SKIP_MC_BIND
+#define CONFIG_NO_IFACE_BIND
/*
Link: sysdep/unix
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index fcf5dd1d..51c6c0c1 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -1181,6 +1181,15 @@ sk_open(sock *s)
port = s->sport;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) < 0)
ERR("SO_REUSEADDR");
+
+#ifdef CONFIG_NO_IFACE_BIND
+ /* Workaround missing ability to bind to an iface */
+ if ((type == SK_UDP) && s->iface && ipa_zero(s->saddr))
+ {
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one)) < 0)
+ ERR("SO_REUSEPORT");
+ }
+#endif
}
fill_in_sockaddr(&sa, s->saddr, s->iface, port);
if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0)