diff --git a/libavformat/udp.c b/libavformat/udp.c
index 3f3a9f760bbb7d75a343dcbc394b9465e10ef3e5..ff2885b19b599f86d2ba49497188f90201868dd6 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -28,6 +28,11 @@
 #endif
 #include <netdb.h>
 
+#ifndef IPV6_ADD_MEMBERSHIP
+#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
+#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
+#endif
+
 typedef struct {
     int udp_fd;
     int ttl;