[PATCH 2/2] In BSD IP_RECVIF can be used as analogue of the Linux socket option SO_BINDTODEVICE.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Nikola Kolev koue at chaosophia.net
Thu May 8 09:45:20 UTC 2014


---
 openbsc/src/ipaccess/ipaccess-find.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/openbsc/src/ipaccess/ipaccess-find.c b/openbsc/src/ipaccess/ipaccess-find.c
index bb9819e..c8de157 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;
 	}
-- 
1.9.2





More information about the OpenBSC mailing list