diff options
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | config.h.in | 1 | ||||
-rw-r--r-- | src/config.c | 15 |
3 files changed, 22 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 606ce93..5c617b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,12 @@ set(USE_BINDTODEVICE ${LINUX}) set(USE_PMTU ${LINUX}) set(USE_PKTINFO ${LINUX}) +if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") + set(USE_MULTIAF_BIND FALSE) +else() + set(USE_MULTIAF_BIND TRUE) +endif() + set(WITH_CAPABILITIES ${LINUX} CACHE BOOL "Include support for POSIX capabilities") set(WITH_CMDLINE_USER TRUE CACHE BOOL "Include support for setting user/group related options on the command line") diff --git a/config.h.in b/config.h.in index 676a180..5be4660 100644 --- a/config.h.in +++ b/config.h.in @@ -35,6 +35,7 @@ #cmakedefine USE_BINDTODEVICE #cmakedefine USE_PMTU #cmakedefine USE_PKTINFO +#cmakedefine USE_MULTIAF_BIND #cmakedefine WITH_CAPABILITIES diff --git a/src/config.c b/src/config.c index ed1c332..7dd3e7f 100644 --- a/src/config.c +++ b/src/config.c @@ -218,6 +218,21 @@ bool fastd_config_bind_address(fastd_context_t *ctx UNUSED, fastd_config_t *conf return false; #endif +#ifndef USE_MULTIAF_BIND + if (address->sa.sa_family == AF_UNSPEC) { + fastd_peer_address_t addr4 = { .in = { .sin_family = AF_INET, .sin_port = address->in.sin_port } }; + fastd_peer_address_t addr6 = { .in6 = { .sin6_family = AF_INET6, .sin6_port = address->in.sin_port } }; + + if (!fastd_config_bind_address(ctx, conf, &addr4, bindtodev, default_v4, default_v6)) + return false; + + if (!fastd_config_bind_address(ctx, conf, &addr6, bindtodev, default_v4, default_v6)) + return false; + + return true; + } +#endif + fastd_bind_address_t *addr = malloc(sizeof(fastd_bind_address_t)); addr->next = conf->bind_addrs; conf->bind_addrs = addr; |