Remove the commandline option to specify the interface when compiled on
a system that doesn't implement SO_BINDTODEVICE.
---
openbsc/src/ipaccess/ipaccess-find.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/openbsc/src/ipaccess/ipaccess-find.c b/openbsc/src/ipaccess/ipaccess-find.c
index 3f9bf41..2d923fe 100644
--- a/openbsc/src/ipaccess/ipaccess-find.c
+++ b/openbsc/src/ipaccess/ipaccess-find.c
@@ -31,6 +31,14 @@
#include <openbsc/ipaccess.h>
#include <openbsc/gsm_data.h>
+/* SO_BINDTODEVICE is not implemented on BSD */
+#ifdef SO_BINDTODEVICE
+# define SET_SO_BINDTODEVICE(fd, ifname) \
+ (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, ifname, strlen(ifname)))
+#else
+# define SET_SO_BINDTODEVICE(fd, ifname) (-1)
+#endif
+
static int udp_sock(const char *ifname)
{
int fd, rc, bc = 1;
@@ -41,8 +49,7 @@ static int udp_sock(const char *ifname)
return fd;
if (ifname) {
- rc = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, ifname,
- strlen(ifname));
+ rc = SET_SO_BINDTODEVICE(fd, ifname);
if (rc < 0)
goto err;
}
@@ -172,12 +179,14 @@ int main(int argc, char **argv)
printf("ipaccess-find (C) 2009 by Harald Welte\n");
printf("This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY\n\n");
+#ifdef SO_BINDTODEVICE
if (argc < 2) {
fprintf(stdout, "you might need to specify the outgoing\n"
" network interface, e.g. ``%s eth0''\n", argv[0]);
} else {
ifname = argv[1];
}
+#endif
bfd.cb = bfd_cb;
bfd.when = BSC_FD_READ | BSC_FD_WRITE;
--
1.7.10.2 (Apple Git-33)