summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2010-03-01 14:57:46 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2010-03-01 14:57:46 (GMT)
commit96f932d0209b23eaf5071be70dda9796f1d1ef39 (patch)
tree4b463161bd1fedfefd1acfae427739d70f65fe0b
parent1592955d3d971dec6ac19643471d60ecb1240bab (diff)
downloadtcl-96f932d0209b23eaf5071be70dda9796f1d1ef39.zip
tcl-96f932d0209b23eaf5071be70dda9796f1d1ef39.tar.gz
tcl-96f932d0209b23eaf5071be70dda9796f1d1ef39.tar.bz2
Refrain from a possibly lengthy reverse-DNS lookup on 0.0.0.0 when
calling [fconfigure -sockname] on an universally-bound (default) server socket.
-rw-r--r--ChangeLog6
-rw-r--r--unix/tclUnixSock.c14
2 files changed, 16 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 33f1ba4..6bf0af1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-01 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
+
+ * unix/tclUnixSock.c: Refrain from a possibly lengthy reverse-DNS
+ lookup on 0.0.0.0 when calling [fconfigure -sockname] on an
+ universally-bound (default) server socket.
+
2010-02-28 Donal K. Fellows <dkf@users.sf.net>
* generic/tclCmdIL.c: More additions of {TCL LOOKUP} error-code
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index 1c852ce..8169357 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixSock.c,v 1.23 2010/01/10 22:58:40 nijtmans Exp $
+ * RCS: @(#) $Id: tclUnixSock.c,v 1.24 2010/03/01 14:57:47 ferrieux Exp $
*/
#include "tclInt.h"
@@ -685,9 +685,13 @@ TcpGetOptionProc(
Tcl_DStringStartSublist(dsPtr);
}
Tcl_DStringAppendElement(dsPtr, inet_ntoa(sockname.sin_addr));
- hostEntPtr = TclpGetHostByAddr( /* INTL: Native. */
- (char *) &sockname.sin_addr,
- sizeof(sockname.sin_addr), AF_INET);
+ if (sockname.sin_addr.s_addr == INADDR_ANY) {
+ hostEntPtr = NULL; /* we don't want to resolve INADDR_ANY */
+ } else {
+ hostEntPtr = TclpGetHostByAddr( /* INTL: Native. */
+ (char *) &sockname.sin_addr,
+ sizeof(sockname.sin_addr), AF_INET);
+ }
if (hostEntPtr != NULL) {
Tcl_DString ds;
@@ -1335,5 +1339,7 @@ TcpAccept(
* mode: c
* c-basic-offset: 4
* fill-column: 78
+ * tab-width: 8
+ * indent-tabs-mode: nil
* End:
*/