aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/ipaccess/ipaccess-find.c
diff options
context:
space:
mode:
authorNikola Kolev <koue@chaosophia.net>2014-05-08 12:45:20 +0300
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-05-09 04:40:23 +0200
commit10bad1031e8d45b3833abb42171d4a7527bca8f1 (patch)
treed7a5efa9646797d73e6fcee69f4bb254913bfcc6 /openbsc/src/ipaccess/ipaccess-find.c
parentb9f45987b3ca9e450e3b9ea2d009dfa127009dc7 (diff)
ipa: Fix the compilation of ipaccess-find on FreeBSD
FreeBSD does not offer the SO_BINDTODEVICE option. The closest thing is the IP_RECVIF option and this is used here now.
Diffstat (limited to 'openbsc/src/ipaccess/ipaccess-find.c')
-rw-r--r--openbsc/src/ipaccess/ipaccess-find.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/openbsc/src/ipaccess/ipaccess-find.c b/openbsc/src/ipaccess/ipaccess-find.c
index bb9819ed1..c8de157b9 100644
--- a/openbsc/src/ipaccess/ipaccess-find.c
+++ b/openbsc/src/ipaccess/ipaccess-find.c
@@ -41,8 +41,13 @@ static int udp_sock(const char *ifname)
return fd;
if (ifname) {
+#ifdef __FreeBSD__
+ rc = setsockopt(fd, SOL_SOCKET, IP_RECVIF, ifname,
+ strlen(ifname));
+#else
rc = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, ifname,
strlen(ifname));
+#endif
if (rc < 0)
goto err;
}