mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +02:00
Fix bug in returned interface address
This commit is contained in:
parent
7b77950352
commit
4f9a7d31d3
|
@ -43,8 +43,7 @@ struct tunread_arg {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern HANDLE startTunReadThread (struct tunread_arg *arg);
|
extern HANDLE startTunReadThread (struct tunread_arg *arg);
|
||||||
int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t ip_addr);
|
int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t *ip_addr);
|
||||||
|
|
||||||
|
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
|
|
|
@ -1184,7 +1184,7 @@ static void check_join_multicast_group (n2n_edge_t *eee) {
|
||||||
mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP);
|
mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
dec_ip_str_t ip_addr;
|
dec_ip_str_t ip_addr;
|
||||||
get_best_interface_ip(eee, ip_addr);
|
get_best_interface_ip(eee, &ip_addr);
|
||||||
mreq.imr_interface.s_addr = inet_addr(ip_addr);
|
mreq.imr_interface.s_addr = inet_addr(ip_addr);
|
||||||
#else
|
#else
|
||||||
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
||||||
|
|
|
@ -51,7 +51,7 @@ HANDLE startTunReadThread (struct tunread_arg *arg) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t ip_addr){
|
int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t *ip_addr){
|
||||||
DWORD interface_index = -1;
|
DWORD interface_index = -1;
|
||||||
DWORD dwRetVal = 0;
|
DWORD dwRetVal = 0;
|
||||||
PIP_ADAPTER_INFO pAdapterInfo = NULL, pAdapter = NULL;
|
PIP_ADAPTER_INFO pAdapterInfo = NULL, pAdapter = NULL;
|
||||||
|
@ -94,7 +94,7 @@ int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t ip_addr){
|
||||||
traceEvent(TRACE_DEBUG, "IP Address: %s\n", pAdapter->IpAddressList.IpAddress.String);
|
traceEvent(TRACE_DEBUG, "IP Address: %s\n", pAdapter->IpAddressList.IpAddress.String);
|
||||||
traceEvent(TRACE_DEBUG, "IP Mask: %s\n", pAdapter->IpAddressList.IpMask.String);
|
traceEvent(TRACE_DEBUG, "IP Mask: %s\n", pAdapter->IpAddressList.IpMask.String);
|
||||||
traceEvent(TRACE_DEBUG, "Gateway: %s\n", pAdapter->GatewayList.IpAddress.String);
|
traceEvent(TRACE_DEBUG, "Gateway: %s\n", pAdapter->GatewayList.IpAddress.String);
|
||||||
strncpy(ip_addr, pAdapter->IpAddressList.IpAddress.String, sizeof(dec_ip_str_t)-1);
|
strncpy(ip_addr, pAdapter->IpAddressList.IpAddress.String, sizeof(*ip_addr));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
traceEvent(TRACE_WARNING, "GetAdaptersInfo failed with error: %d\n", dwRetVal);
|
traceEvent(TRACE_WARNING, "GetAdaptersInfo failed with error: %d\n", dwRetVal);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user