Index: src/modules/module-rtp-session.c
--- src/modules/module-rtp-session.c.orig
+++ src/modules/module-rtp-session.c
@@ -37,7 +37,7 @@
 #include <module-rtp/apple-midi.h>
 #include <module-rtp/stream.h>
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
 #define ifr_ifindex ifr_index
 #endif
 
@@ -1099,9 +1099,9 @@ static int make_socket(const struct sockaddr_storage* 
 	spa_zero(req);
 	if (ifname) {
 		snprintf(req.ifr_name, sizeof(req.ifr_name), "%s", ifname);
-		res = ioctl(fd, SIOCGIFINDEX, &req);
+		res = pw_if_nametoindex(ifname, fd);
 	        if (res < 0)
-	                pw_log_warn("SIOCGIFINDEX %s failed: %m", ifname);
+	                pw_log_warn("pw_if_nametoindex %s failed: %m", ifname);
 	}
 	res = 0;
 	if (af == AF_INET) {
