diff --git a/library/zitilib.c b/library/zitilib.c index 73645e53..30e1b61d 100644 --- a/library/zitilib.c +++ b/library/zitilib.c @@ -299,6 +299,16 @@ static const char * fmt_win32err(int err) { } #endif +#ifdef __MINGW32__ +static const IN_ADDR in4addr_loopback; +static void init_in4addr_loopback() { + IN_ADDR *lo = (IN_ADDR *)&in4addr_loopback; + lo->S_un.S_addr = htonl(INADDR_LOOPBACK); +} +#else +#define init_in4addr_loopback() {} +#endif + static int make_socketpair(int type, ziti_socket_t *fd0, ziti_socket_t *fd1) { int rc = 0; #if _WIN32 @@ -872,6 +882,7 @@ void process_on_loop(uv_async_t *async) { } static void internal_init() { + init_in4addr_loopback(); uv_key_create(&err_key); uv_mutex_init(&q_mut); lib_loop = uv_loop_new();