Browse Source
Fix the problem of running edge, IP or domain name resolution failure under Windows system. (#527)
pull/536/head
fengdaolong
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with
18 additions and
4 deletions
-
src/edge.c
-
src/edge_utils.c
-
src/n2n.c
-
src/sn_utils.c
-
win32/wintap.c
-
win32/wintap.h
|
|
@ -771,6 +771,9 @@ int main(int argc, char* argv[]) { |
|
|
|
#ifdef HAVE_LIBCAP |
|
|
|
cap_t caps; |
|
|
|
#endif |
|
|
|
#ifdef WIN32 |
|
|
|
initWin32(); |
|
|
|
#endif |
|
|
|
|
|
|
|
/* Defaults */ |
|
|
|
edge_init_conf_defaults(&conf); |
|
|
@ -955,6 +958,10 @@ int main(int argc, char* argv[]) { |
|
|
|
tuntap_close(&eee->device); |
|
|
|
edge_term(eee); |
|
|
|
|
|
|
|
#ifdef WIN32 |
|
|
|
destroyWin32(); |
|
|
|
#endif |
|
|
|
|
|
|
|
return(rc); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -191,9 +191,6 @@ n2n_edge_t* edge_init(const n2n_edge_conf_t *conf, int *rv) { |
|
|
|
goto edge_init_error; |
|
|
|
} |
|
|
|
|
|
|
|
#ifdef WIN32 |
|
|
|
initWin32(); |
|
|
|
#endif |
|
|
|
|
|
|
|
memcpy(&eee->conf, conf, sizeof(*conf)); |
|
|
|
eee->curr_sn = eee->conf.supernodes; |
|
|
|
|
|
@ -277,7 +277,7 @@ int supernode2sock(n2n_sock_t * sn, const n2n_sn_name_t addrIn) { |
|
|
|
freeaddrinfo(ainfo); /* free everything allocated by getaddrinfo(). */ |
|
|
|
ainfo = NULL; |
|
|
|
} else { |
|
|
|
traceEvent(TRACE_WARNING, "Failed to resolve supernode host %s", supernode_host); |
|
|
|
traceEvent(TRACE_WARNING, "Failed to resolve supernode host %s, %d: %s", supernode_host, nameerr, gai_strerror(nameerr)); |
|
|
|
rv = -2; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -351,6 +351,10 @@ void sn_term(n2n_sn_t *sss) |
|
|
|
} |
|
|
|
free(re); |
|
|
|
} |
|
|
|
|
|
|
|
#ifdef WIN32 |
|
|
|
destroyWin32(); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
/** Determine the appropriate lifetime for new registrations.
|
|
|
|
|
|
@ -20,6 +20,11 @@ void initWin32() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void destroyWin32() { |
|
|
|
WSACleanup(); |
|
|
|
} |
|
|
|
|
|
|
|
struct win_adapter_info { |
|
|
|
HANDLE handle; |
|
|
|
char adapterid[1024]; |
|
|
|
|
|
@ -64,6 +64,7 @@ |
|
|
|
#define TAP_COMPONENT_ID "tap0801" |
|
|
|
|
|
|
|
extern void initWin32(); |
|
|
|
extern void destroyWin32(); |
|
|
|
extern void win_print_available_adapters(); |
|
|
|
|
|
|
|
#endif |