From e6fa347e7e436f0a52f5e313f55b7d1ef47a3767 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Tue, 18 Jul 2017 15:52:33 -0700 Subject: [PATCH] Support if_indextoname in the socket portability header Summary: Windows doesn't have `net/if.h` and instead needs `iphlpapi.h` included, and `ntddndis.h` is ultimately needed to get the definition of `IF_NAMESIZE`. Reviewed By: yfeldblum Differential Revision: D5438188 fbshipit-source-id: 48a786f7d10ca4b8479bb20b257ed1e857431654 --- CMakeLists.txt | 1 + folly/IPAddressV6.cpp | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f717039..c067fb7c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,6 +144,7 @@ set(FOLLY_LINK_LIBRARIES ${LIBEVENT_LIB} ${LIBGFLAGS_LIBRARY} ${LIBGLOG_LIBRARY} + Iphlpapi.lib Ws2_32.lib ${FOLLY_SHINY_DEPENDENCIES} diff --git a/folly/IPAddressV6.cpp b/folly/IPAddressV6.cpp index 70428f3a..3490669d 100644 --- a/folly/IPAddressV6.cpp +++ b/folly/IPAddressV6.cpp @@ -19,14 +19,25 @@ #include #include -#include - #include #include #include #include #include +#if !_WIN32 +#include +#else +// Because of the massive pain that is libnl, this can't go into the socket +// portability header as you can't include and in +// the same translation unit without getting errors -_-... +#include +#include + +// Alias the max size of an interface name to what posix expects. +#define IFNAMSIZ IF_NAMESIZE +#endif + using std::ostream; using std::string; -- 2.34.1