diff --git a/libavformat/network.h b/libavformat/network.h
index 0fbcbbb22787252b5fabda7e796c9ebe67153b79..d1f3d29455be9c8f4485e75f447b5159b0525102 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -151,4 +151,8 @@ const char *ff_gai_strerror(int ecode);
 #define gai_strerror ff_gai_strerror
 #endif
 
+#ifndef INET6_ADDRSTRLEN
+#define INET6_ADDRSTRLEN INET_ADDRSTRLEN
+#endif
+
 #endif /* AVFORMAT_NETWORK_H */
diff --git a/libavformat/os_support.h b/libavformat/os_support.h
index 1330d3dc04c4ff55331894836283ad84e7d94c8c..5c9e81b340ca6bde2b6eccbeea9b0b29aa8eabbb 100644
--- a/libavformat/os_support.h
+++ b/libavformat/os_support.h
@@ -55,10 +55,6 @@ typedef int socklen_t;
 #define closesocket close
 #endif
 
-#ifndef INET6_ADDRSTRLEN
-#define INET6_ADDRSTRLEN INET_ADDRSTRLEN
-#endif
-
 #if CONFIG_FFSERVER
 #if !HAVE_POLL_H
 typedef unsigned long nfds_t;