summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--win/tclWinSock.c11
2 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 427b3e4..b726d9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-07-19 Reinhard Max <max@suse.de>
+
+ * win/tclWinSock.c (TcpAccept): [Bug: 3545363]: Use a large enough
+ buffer for accept()ing IPv6 connections. Fix conversion of host
+ and port for passing to the accept proc to be independent of the
+ IP version.
+
2012-07-17 Jan Nijtmans <nijtmans@users.sf.net>
* win/makefile.vc: [Bug 3544932]: Visual studio compiler check fails
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 97b10a3..5603ef3 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -1556,18 +1556,19 @@ TcpAccept(
SOCKET newSocket;
SocketInfo *newInfoPtr;
SocketInfo *infoPtr = fds->infoPtr;
- SOCKADDR_IN addr;
+ address addr;
int len;
char channelName[16 + TCL_INTEGER_SPACE];
+ char host[NI_MAXHOST], port[NI_MAXSERV];
ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
/*
* Accept the incoming connection request.
*/
- len = sizeof(SOCKADDR_IN);
+ len = sizeof(address);
- newSocket = accept(fds->fd, (SOCKADDR *) &addr, &len);
+ newSocket = accept(fds->fd, &(addr.sa), &len);
/*
* Protect access to sockets (acceptEventCount, readyEvents) in socketList
@@ -1644,8 +1645,10 @@ TcpAccept(
*/
if (infoPtr->acceptProc != NULL) {
+ getnameinfo(&(addr.sa), len, host, sizeof(host), port, sizeof(port),
+ NI_NUMERICHOST|NI_NUMERICSERV);
infoPtr->acceptProc(infoPtr->acceptProcData, newInfoPtr->channel,
- inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
+ host, atoi(port));
}
}