FSCORE-440

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14882 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West 2009-09-16 13:55:23 +00:00
parent edf521301f
commit 45ecc4b0d3
1 changed files with 7 additions and 2 deletions

View File

@ -831,6 +831,7 @@ static int get_netmask(struct sockaddr_in *me, int *mask)
INTERFACE_INFO interfaces[20];
unsigned long bytes;
int interface_count, x;
int r = -1;
*mask = 0;
@ -839,7 +840,8 @@ static int get_netmask(struct sockaddr_in *me, int *mask)
}
if (WSAIoctl(sock, SIO_GET_INTERFACE_LIST, 0, 0, &interfaces, sizeof(interfaces), &bytes, 0, 0) == SOCKET_ERROR) {
return -1;
r = -1;
goto end;
}
interface_count = bytes / sizeof(INTERFACE_INFO);
@ -850,11 +852,14 @@ static int get_netmask(struct sockaddr_in *me, int *mask)
if (addr->sin_addr.s_addr == me->sin_addr.s_addr) {
struct sockaddr_in *netmask = (struct sockaddr_in *) & (interfaces[x].iiNetmask);
*mask = netmask->sin_addr.s_addr;
r = 0;
break;
}
}
return 0;
end:
closesocket(sock);
return r;
}
#else