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
parent
commit
d7654397a8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/edge.c
  2. 3
      src/edge_utils.c
  3. 2
      src/n2n.c
  4. 4
      src/sn_utils.c
  5. 5
      win32/wintap.c
  6. 1
      win32/wintap.h

7
src/edge.c

@ -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);
}

3
src/edge_utils.c

@ -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;

2
src/n2n.c

@ -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;
}

4
src/sn_utils.c

@ -351,6 +351,10 @@ void sn_term(n2n_sn_t *sss)
}
free(re);
}
#ifdef WIN32
destroyWin32();
#endif
}
/** Determine the appropriate lifetime for new registrations.

5
win32/wintap.c

@ -20,6 +20,11 @@ void initWin32() {
}
}
void destroyWin32() {
WSACleanup();
}
struct win_adapter_info {
HANDLE handle;
char adapterid[1024];

1
win32/wintap.h

@ -64,6 +64,7 @@
#define TAP_COMPONENT_ID "tap0801"
extern void initWin32();
extern void destroyWin32();
extern void win_print_available_adapters();
#endif
Loading…
Cancel
Save