- Linux/glibc-2.1.2 takes a *long* time to look up names for AF_UNSPEC
   addresses using getaddrinfo(). Added a configure switch to make the
   default lookup mode AF_INET
diff --git a/ChangeLog b/ChangeLog
index 6b6dd40..5b7e5fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 20000119
  - SCO compile fixes from Gary E. Miller <gem@rellim.com>
  - Compile fix from Darren_Hall@progressive.com
+ - Linux/glibc-2.1.2 takes a *long* time to look up names for AF_UNSPEC
+   addresses using getaddrinfo(). Added a configure switch to make the
+   default lookup mode AF_INET
 
 20000118
  - Fixed --with-pid-dir option
diff --git a/INSTALL b/INSTALL
index 9ea5a25..95722e4 100644
--- a/INSTALL
+++ b/INSTALL
@@ -150,6 +150,12 @@
 libsocks library isn't installed in a library searched by the compiler,
 add the directory name as the option.
 
+--with-ipv4-default instructs OpenSSH to use IPv4 by default for new
+connections. Normally OpenSSH will try attempt to lookup both IPv6 and
+IPv4 addresses. On Linux/glibc-2.1.2 this causes long delays in name
+resolution. If this option is specified, you can still attempt to 
+connect to IPv6 addresses using the command line option '-6'.
+
 If you need to pass special options to the compiler or linker, you
 can specify these as enviornment variables before running ./configure.
 For example:
diff --git a/acconfig.h b/acconfig.h
index 30a1dc9..f143b1b 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -135,6 +135,9 @@
 /* Specify location of ssh.pid */
 #undef PIDDIR
 
+/* Use IPv4 for connection by default, IPv6 can still if explicity asked */
+#undef IPV4_DEFAULT
+
 @BOTTOM@
 
 /* ******************* Shouldn't need to edit below this line ************** */
diff --git a/configure.in b/configure.in
index d11c519..45df18f 100644
--- a/configure.in
+++ b/configure.in
@@ -662,6 +662,15 @@
 	]
 )
 
+AC_ARG_WITH(ipv4-default,
+	[  --with-ipv4-default     Use IPv4 by connections unless '-6' specified],
+	[
+		if test "x$withval" != "xno" ; then	
+			AC_DEFINE(IPV4_DEFAULT)
+		fi
+	]
+)
+
 piddir=/var/run
 AC_ARG_WITH(pid-dir,
 	[  --with-pid-dir=PATH     Specify location of ssh.pid file],
diff --git a/ssh.c b/ssh.c
index 962aa2d..2a2fb2d 100644
--- a/ssh.c
+++ b/ssh.c
@@ -11,7 +11,7 @@
  */
 
 #include "includes.h"
-RCSID("$Id: ssh.c,v 1.16 2000/01/14 04:45:51 damien Exp $");
+RCSID("$Id: ssh.c,v 1.17 2000/01/19 03:36:49 damien Exp $");
 
 #include "xmalloc.h"
 #include "ssh.h"
@@ -29,7 +29,11 @@
 
 /* Flag indicating whether IPv4 or IPv6.  This can be set on the command line.
    Default value is AF_UNSPEC means both IPv4 and IPv6. */
+#ifdef IPV4_DEFAULT
+int IPv4or6 = AF_INET;
+#else
 int IPv4or6 = AF_UNSPEC;
+#endif
 
 /* Flag indicating whether debug mode is on.  This can be set on the command line. */
 int debug_flag = 0;
diff --git a/sshd.c b/sshd.c
index 316723a..371b2a5 100644
--- a/sshd.c
+++ b/sshd.c
@@ -11,7 +11,7 @@
  */
 
 #include "includes.h"
-RCSID("$Id: sshd.c,v 1.50 2000/01/14 04:45:52 damien Exp $");
+RCSID("$Id: sshd.c,v 1.51 2000/01/19 03:36:50 damien Exp $");
 
 #include "xmalloc.h"
 #include "rsa.h"
@@ -49,7 +49,11 @@
  * Flag indicating whether IPv4 or IPv6.  This can be set on the command line.
  * Default value is AF_UNSPEC means both IPv4 and IPv6.
  */
+#ifdef IPV4_DEFAULT
+int IPv4or6 = AF_INET;
+#else
 int IPv4or6 = AF_UNSPEC;
+#endif
 
 /*
  * Debug mode flag.  This can be set on the command line.  If debug