diff --git a/src/network/udp.c b/src/network/udp.c
index c1cbd89643cd96e6131820cec0b11728a6be0718..cf4d2b5c9cbf7ea84dd819d9f45d5853cb6c89de 100644
--- a/src/network/udp.c
+++ b/src/network/udp.c
@@ -291,6 +291,7 @@ static int net_SetMcastOut (vlc_object_t *p_this, int fd, int family,
 }
 
 
+#ifdef MCAST_JOIN_GROUP
 static unsigned var_GetIfIndex (vlc_object_t *obj)
 {
     char *ifname = var_InheritString (obj, "miface");
@@ -303,6 +304,7 @@ static unsigned var_GetIfIndex (vlc_object_t *obj)
     free (ifname);
     return ifindex;
 }
+#endif
 
 
 /**