Logan oos Even
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
2 deletions
-
src/n2n.c
|
@ -712,14 +712,18 @@ extern int str2mac (uint8_t * outmac /* 6 bytes */, const char * s) { |
|
|
extern char * sock_to_cstr (n2n_sock_str_t out, |
|
|
extern char * sock_to_cstr (n2n_sock_str_t out, |
|
|
const n2n_sock_t * sock) { |
|
|
const n2n_sock_t * sock) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(NULL == out) { |
|
|
if(NULL == out) { |
|
|
return NULL; |
|
|
return NULL; |
|
|
} |
|
|
} |
|
|
memset(out, 0, N2N_SOCKBUF_SIZE); |
|
|
memset(out, 0, N2N_SOCKBUF_SIZE); |
|
|
|
|
|
|
|
|
if(AF_INET6 == sock->family) { |
|
|
if(AF_INET6 == sock->family) { |
|
|
/* INET6 not written yet */ |
|
|
char tmp[sizeof(n2n_sock_str_t)]; |
|
|
snprintf(out, N2N_SOCKBUF_SIZE, "XXXX:%hu", sock->port); |
|
|
|
|
|
|
|
|
tmp[0] = '\0'; |
|
|
|
|
|
inet_ntop(AF_INET6, sock->addr.v6, tmp, sizeof(n2n_sock_str_t)); |
|
|
|
|
|
snprintf(out, N2N_SOCKBUF_SIZE, "%s:%hu", tmp[0] ? tmp : "", sock->port); |
|
|
return out; |
|
|
return out; |
|
|
} else { |
|
|
} else { |
|
|
const uint8_t * a = sock->addr.v4; |
|
|
const uint8_t * a = sock->addr.v4; |
|
|