diff --git a/thirdparty/misc/ifaddrs-android.h b/thirdparty/misc/ifaddrs-android.h
index e7d81e813f..04ff2ca58b 100644
--- a/thirdparty/misc/ifaddrs-android.h
+++ b/thirdparty/misc/ifaddrs-android.h
@@ -34,6 +34,9 @@
 // Fills out a list of ifaddr structs (see below) which contain information
 // about every network interface available on the host.
 // See 'man getifaddrs' on Linux or OS X (nb: it is not a POSIX function).
+#ifdef __cplusplus
+extern "C" {
+#endif
 struct ifaddrs {
   struct ifaddrs* ifa_next;
   char* ifa_name;
@@ -42,7 +45,17 @@ struct ifaddrs {
   struct sockaddr* ifa_netmask;
   // Real ifaddrs has broadcast, point to point and data members.
   // We don't need them (yet?).
+  // We never initialize the following members. We only define them to match the ifaddrs struct.
+  union
+  {
+    struct sockaddr *ifu_broadaddr;
+    struct sockaddr *ifu_dstaddr;
+  } ifa_ifu;
+  void *ifa_data;
 };
+#ifdef __cplusplus
+}
+#endif
 
 int getifaddrs(struct ifaddrs** result);
 void freeifaddrs(struct ifaddrs* addrs);