diff -Nurb l2tpd-0.69.bak/l2tpd.c l2tpd-0.69/l2tpd.c
--- l2tpd-0.69.bak/l2tpd.c.org	Tue Nov 12 11:00:10 2002
+++ l2tpd-0.69/l2tpd.c	Tue Nov 12 14:55:32 2002
@@ -325,6 +325,8 @@
 
         snprintf (tty, sizeof (tty), "/dev/tty%c%c", a, b);
         fd2 = open (tty, O_RDWR);
+	stropt[pos++] = strdup(tty);
+	stropt[pos] = NULL;
 
 #ifdef USE_KERNEL
     }
diff -Nurb l2tpd-0.69.bak/Makefile l2tpd-0.69/Makefile
--- l2tpd-0.69.bak/Makefile	2002-08-10 01:42:22.000000000 +0100
+++ l2tpd-0.69/Makefile	2004-11-05 13:30:44.000000000 +0000
@@ -31,7 +31,8 @@
 #
 # Uncomment the next line for Linux
 #
-OSFLAGS= -DLINUX -I/usr/include
+OSFLAGS= -DLINUX 
+#OSFLAGS= -DLINUX -I/usr/include
 #
 # Uncomment the following to use the kernel interface under Linux
 #
diff -Nurb l2tpd-0.69.bak/call.c l2tpd-0.69/call.c
--- l2tpd-0.69.bak/call.c	2002-08-10 01:47:25.000000000 +0100
+++ l2tpd-0.69/call.c	2004-11-05 13:30:44.000000000 +0000
@@ -193,8 +193,8 @@
         }
     }
     /* I should never get here */
-    log (LOG_WARN, "%s: You should not see this message.  If you do, please
-		       enter a bug report at http://sourceforge.net/projects/l2tpd", __FUNCTION__);
+    log (LOG_WARN, "%s: You should not see this message.  If you do, please " \
+		       "enter a bug report at http://www.l2tpd.org", __FUNCTION__);
     return -EINVAL;
 }
 
diff -Nurb l2tpd-0.69.bak/control.c l2tpd-0.69/control.c
--- l2tpd-0.69.bak/control.c	2002-04-10 21:09:33.000000000 +0100
+++ l2tpd-0.69/control.c	2004-11-05 13:30:07.000000000 +0000
@@ -381,7 +381,7 @@
          c->needclose = -1;
          return -EINVAL;
          }  */
-        if (!strlen (t->hostname))
+        if ((!strlen (t->hostname)) && ((t->chal_us.state) || ((t->lns->challenge))))
         {
             if (DEBUG)
                 log (LOG_DEBUG,
@@ -494,7 +494,7 @@
          c->needclose = -1;
          return -EINVAL;
          } */
-        if (!strlen (t->hostname))
+        if ((!strlen (t->hostname)) && ((t->chal_them.state) || ((t->chal_us.state))))
         {
             if (DEBUG)
                 log (LOG_DEBUG,
diff -Nurb l2tpd-0.69.bak/doc/l2tp-secrets.5 l2tpd-0.69/doc/l2tp-secrets.5
--- l2tpd-0.69.bak/doc/l2tp-secrets.5	2002-08-19 18:14:34.000000000 +0100
+++ l2tpd-0.69/doc/l2tp-secrets.5	2004-11-05 13:30:14.000000000 +0000
@@ -27,7 +27,7 @@
 
 .SH "FILES"
 
-\fB\fR/etc/l2tp/l2tpd.conf \fB\fR/etc/l2tp/l2tp\-secrets 
+\fB\fR/etc/l2tpd/l2tpd.conf \fB\fR/etc/l2tpd/l2tp\-secrets 
 \fB\fR/var/run/l2tp\-control
 .SH "BUGS"
 
diff -Nurb l2tpd-0.69.bak/doc/l2tpd.8 l2tpd-0.69/doc/l2tpd.8
--- l2tpd-0.69.bak/doc/l2tpd.8	2002-08-19 16:44:45.000000000 +0100
+++ l2tpd-0.69/doc/l2tpd.8	2004-11-05 13:30:14.000000000 +0000
@@ -30,7 +30,7 @@
 
 .SH "FILES"
 
-\fB\fR/etc/l2tp/l2tpd.conf \fB\fR/etc/l2tp/l2tp\-secrets 
+\fB\fR/etc/l2tpd/l2tpd.conf \fB\fR/etc/l2tpd/l2tp\-secrets 
 \fB\fR/var/run/l2tp\-control
 .SH "BUGS"
 
diff -Nurb l2tpd-0.69.bak/doc/l2tpd.conf.5 l2tpd-0.69/doc/l2tpd.conf.5
--- l2tpd-0.69.bak/doc/l2tpd.conf.5	2002-08-13 19:23:13.000000000 +0100
+++ l2tpd-0.69/doc/l2tpd.conf.5	2004-11-05 13:30:32.000000000 +0000
@@ -15,11 +15,16 @@
 .TP 
 .B auth file
 Specify where to find the authentication file used to authenticate
-l2tp tunnels. The default is /etc/l2tp/l2tp\-secrets.
+l2tp tunnels. The default is /etc/l2tpd/l2tp\-secrets.
 
 .TP 
-.B Port
-Specify which udp port l2tpd should use. The default is 1701.
+.B listen-addr
+The IP address of the interface on which the daemon listens.  By default,
+it listens on INADDR_ANY (0.0.0.0), meaning it listens on all interfaces.
+
+.TP 
+.B port
+Specify which UDP port l2tpd should use. The default is 1701.
 
 .TP 
 .B access control
@@ -141,7 +146,7 @@
 
 .SH "FILES"
 
-\fB\fR/etc/l2tp/l2tpd.conf \fB\fR/etc/l2tp/l2tp\-secrets 
+\fB\fR/etc/l2tpd/l2tpd.conf \fB\fR/etc/l2tpd/l2tp\-secrets 
 \fB\fR/var/run/l2tp\-control
 .SH "BUGS"
 
diff -Nurb l2tpd-0.69.bak/doc/l2tpd.conf.sample l2tpd-0.69/doc/l2tpd.conf.sample
--- l2tpd-0.69.bak/doc/l2tpd.conf.sample	2002-08-10 01:42:22.000000000 +0100
+++ l2tpd-0.69/doc/l2tpd.conf.sample	2004-11-05 13:30:14.000000000 +0000
@@ -10,7 +10,7 @@
 ;
 ; [global]								; Global parameters:
 ; port = 1701						 	; * Bind to port 1701
-; auth file = /etc/l2tp/l2tp-secrets 	; * Where our challenge secrets are
+; auth file = /etc/l2tpd/l2tp-secrets 	; * Where our challenge secrets are
 ; access control = yes					; * Refuse connections without IP match
 ; rand source = dev                     ; Source for entropy for random
 ;                                       ; numbers, options are:
diff -Nurb l2tpd-0.69.bak/file.c l2tpd-0.69/file.c
--- l2tpd-0.69.bak/file.c	2002-08-10 01:55:14.000000000 +0100
+++ l2tpd-0.69/file.c	2004-11-05 13:30:32.000000000 +0000
@@ -41,6 +41,7 @@
     int returnedValue;
 
     gconfig.port = UDP_LISTEN_PORT;
+    gconfig.listenaddr = htonl(INADDR_ANY); /* Default is to bind (listen) to all interfaces */
     lnslist = NULL;
     laclist = NULL;
     deflac = (struct lac *) malloc (sizeof (struct lac));
@@ -821,6 +822,26 @@
     return 0;
 }
 
+int set_listenaddr (char *word, char *value, int context, void *item)
+{
+    switch (context & ~CONTEXT_DEFAULT)
+    {
+    case CONTEXT_GLOBAL:
+#ifdef DEBUG_FILE
+        log (LOG_DEBUG, "set_listenaddr: Setting listen address to %s\n",
+             value);
+#endif
+        if (set_ip (word, value, &(((struct global *) item)->listenaddr)))
+		return -1;
+	break;
+    default:
+        snprintf (filerr, sizeof (filerr), "'%s' not valid in this context\n",
+                  word);
+        return -1;
+    }
+    return 0;
+}
+
 int set_localaddr (char *word, char *value, int context, void *item)
 {
     struct lac *l;
@@ -1196,6 +1217,7 @@
 }
 
 struct keyword words[] = {
+    {"listen-addr", &set_listenaddr},
     {"port", &set_port},
     {"rand source", &set_rand_source},
     {"auth file", &set_authfile},
diff -Nurb l2tpd-0.69.bak/file.h l2tpd-0.69/file.h
--- l2tpd-0.69.bak/file.h	2002-04-10 21:09:33.000000000 +0100
+++ l2tpd-0.69/file.h	2004-11-05 13:30:32.000000000 +0000
@@ -49,10 +49,10 @@
 #define SENSE_ALLOW -1
 #define SENSE_DENY 0
 
-#define DEFAULT_AUTH_FILE "/etc/l2tp/l2tp-secrets"
-#define ALT_DEFAULT_AUTH_FILE "/etc/l2tpd/l2tp-secrets"
-#define DEFAULT_CONFIG_FILE "/etc/l2tp/l2tpd.conf"
-#define ALT_DEFAULT_CONFIG_FILE "/etc/l2tpd/l2tpd.conf"
+#define DEFAULT_AUTH_FILE "/etc/l2tpd/l2tp-secrets"
+#define ALT_DEFAULT_AUTH_FILE "/etc/l2tp/l2tp-secrets"
+#define DEFAULT_CONFIG_FILE "/etc/l2tpd/l2tpd.conf"
+#define ALT_DEFAULT_CONFIG_FILE "/etc/l2tp/l2tpd.conf"
 #define DEFAULT_PID_FILE "/var/run/l2tpd.pid"
 
 /* Definition of an LNS */
@@ -130,6 +130,7 @@
 
 struct global
 {
+    unsigned int listenaddr;    /* IP address to bind to */ 
     int port;                   /* Port number to listen to */
     char authfile[STRLEN];      /* File containing authentication info */
     char altauthfile[STRLEN];   /* File containing authentication info */
diff -Nurb l2tpd-0.69.bak/l2tpd.c l2tpd-0.69/l2tpd.c
--- l2tpd-0.69.bak/l2tpd.c	2002-08-19 15:12:17.000000000 +0100
+++ l2tpd-0.69/l2tpd.c	2004-11-05 13:30:40.000000000 +0000
@@ -321,6 +321,7 @@
         tcgetattr (c->fd, &ptyconf);
         *(c->oldptyconf) = ptyconf;
         ptyconf.c_cflag &= ~(ICANON | ECHO);
+        ptyconf.c_lflag &= ~ECHO;
         tcsetattr (c->fd, TCSANOW, &ptyconf);
 
         snprintf (tty, sizeof (tty), "/dev/tty%c%c", a, b);
@@ -993,9 +994,7 @@
     else if (pid)
         exit(0);
 
-    /* close(0); */   /* This is a hack to "fix" problems with the
-                         daemonization code...more work will be forthcoming 
-                         to do a proper fix for this */
+    close(0);
     close(1);
     close(2);
 
@@ -1048,6 +1047,8 @@
 void init (int argc,char *argv[])
 {
     struct lac *lac;
+    struct in_addr listenaddr;
+
     init_args (argc,argv);
     rand_source = 0;
     init_addr ();
@@ -1087,8 +1088,9 @@
          "Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.\n");
     log (LOG_LOG, "Forked by Scott Balmos and David Stipp, (C) 2001\n");
     log (LOG_LOG, "Inhereted by Jeff McAdams, (C) 2002\n");
-    log (LOG_LOG, "%s version %s on a %s, port %d\n", uts.sysname,
-         uts.release, uts.machine, gconfig.port);
+    listenaddr.s_addr = gconfig.listenaddr;
+    log (LOG_LOG, "%s version %s on a %s, listening on IP address %s, port %d\n", uts.sysname,
+       uts.release, uts.machine, inet_ntoa(listenaddr), gconfig.port);
     lac = laclist;
     while (lac)
     {
diff -Nurb l2tpd-0.69.bak/network.c l2tpd-0.69/network.c
--- l2tpd-0.69.bak/network.c	2002-04-10 21:09:33.000000000 +0100
+++ l2tpd-0.69/network.c	2004-11-05 13:30:44.000000000 +0000
@@ -25,7 +25,6 @@
 #include "l2tp.h"
 
 char hostname[256];
-unsigned int listen_addy = INADDR_ANY;  /* Address to listen on */
 struct sockaddr_in server, from;        /* Server and transmitter structs */
 int server_socket;              /* Server socket */
 #ifdef USE_KERNEL
@@ -47,7 +46,7 @@
     int length = sizeof (server);
     gethostname (hostname, sizeof (hostname));
     server.sin_family = AF_INET;
-    server.sin_addr.s_addr = htonl (listen_addy);
+    server.sin_addr.s_addr = gconfig.listenaddr; 
     server.sin_port = htons (gconfig.port);
     if ((server_socket = socket (PF_INET, SOCK_DGRAM, 0)) < 0)
     {
@@ -364,8 +363,8 @@
                 extract (buf->start, &tunnel, &call);
                 if (debug_network)
                 {
-                    log (LOG_DEBUG, "%s: recv packet from %s, size = %d,
-tunnel = %d, call = %d\n", __FUNCTION__, inet_ntoa (from.sin_addr), recvsize, tunnel, call);
+                    log (LOG_DEBUG, "%s: recv packet from %s, size = %d," \
+"tunnel = %d, call = %d\n", __FUNCTION__, inet_ntoa (from.sin_addr), recvsize, tunnel, call);
                 }
                 if (packet_dump)
                 {
