From cb8dd19c5dc2e3c38df2d40a615d94dbcd7a69bc Mon Sep 17 00:00:00 2001 From: Daniel Collins Date: Sun, 24 Apr 2011 01:37:25 +0000 Subject: [PATCH] Updated getsockopt() --- src/winsock.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/winsock.c b/src/winsock.c index 9b54142..680d21e 100644 --- a/src/winsock.c +++ b/src/winsock.c @@ -520,8 +520,8 @@ int WSAAPI getsockopt(SOCKET fd, int level, int optname, char FAR *optval, int F return -1; } - memset(ipxdata->netnum, 0, 4); - memcpy(ipxdata->nodenum, nic->hwaddr, 6); + memcpy(ipxdata->netnum, nic->ipx_net, 4); + memcpy(ipxdata->nodenum, nic->ipx_node, 6); /* TODO: LAN/WAN detection, link speed detection */ ipxdata->wan = FALSE; @@ -532,6 +532,11 @@ int WSAAPI getsockopt(SOCKET fd, int level, int optname, char FAR *optval, int F RETURN(0); } + /* NOTE: IPX_MAX_ADAPTER_NUM implies it may be the maximum index + * for referencing an IPX interface. This behaviour makes no sense + * and a code example in MSDN implies it should be the number of + * IPX interfaces, this code follows the latter. + */ if(optname == IPX_MAX_ADAPTER_NUM) { CHECK_OPTLEN(sizeof(int));