diff options
author | Ruslan Ermilov <ru@FreeBSD.org> | 2003-04-16 13:53:27 +0000 |
---|---|---|
committer | Ruslan Ermilov <ru@FreeBSD.org> | 2003-04-16 13:53:27 +0000 |
commit | 5b063c85811b32dcea3c665c7a32d68f2eac04e4 (patch) | |
tree | bd443f96bdb55506cff2332ff11444080a32f796 /net/l2tpd | |
parent | a56dd6faec6c189cd483125c17e61de7e7c7a5e6 (diff) | |
download | ports-5b063c85811b32dcea3c665c7a32d68f2eac04e4.tar.gz ports-5b063c85811b32dcea3c665c7a32d68f2eac04e4.zip |
When l2tpd(8) runs on a multi-homed machine, and you attempt to
establish an L2TP VPN connection to its external IP address from
the Windows XP box on your LAN, l2tpd(8) will reply (UDP) from
its local IP address, and not external IP address.
Implement the new global option "address" to aid in overcoming
this problem. Also helps in environments with complex NAT
configurations.
Bump PORTREVISION.
Approved by: sobomax
Notes
Notes:
svn path=/head/; revision=79082
Diffstat (limited to 'net/l2tpd')
-rw-r--r-- | net/l2tpd/Makefile | 2 | ||||
-rw-r--r-- | net/l2tpd/files/patch-doc::l2tpd.conf.5 | 12 | ||||
-rw-r--r-- | net/l2tpd/files/patch-doc::l2tpd.conf.sample | 12 | ||||
-rw-r--r-- | net/l2tpd/files/patch-file.c | 40 | ||||
-rw-r--r-- | net/l2tpd/files/patch-file.h | 10 | ||||
-rw-r--r-- | net/l2tpd/files/patch-l2tpd.c | 25 | ||||
-rw-r--r-- | net/l2tpd/files/patch-network.c | 23 |
7 files changed, 102 insertions, 22 deletions
diff --git a/net/l2tpd/Makefile b/net/l2tpd/Makefile index 2f46028f17b7..8ba1da7a2a39 100644 --- a/net/l2tpd/Makefile +++ b/net/l2tpd/Makefile @@ -7,7 +7,7 @@ PORTNAME= l2tpd PORTVERSION= 0.69 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net MASTER_SITES= http://www.l2tpd.org/downloads/ diff --git a/net/l2tpd/files/patch-doc::l2tpd.conf.5 b/net/l2tpd/files/patch-doc::l2tpd.conf.5 index 21a73aeb8103..1b76668b38bb 100644 --- a/net/l2tpd/files/patch-doc::l2tpd.conf.5 +++ b/net/l2tpd/files/patch-doc::l2tpd.conf.5 @@ -1,18 +1,22 @@ $FreeBSD$ ---- doc/l2tpd.conf.5 2002/10/23 13:39:50 1.1 -+++ doc/l2tpd.conf.5 2002/10/23 13:40:38 -@@ -15,7 +15,7 @@ +--- doc/l2tpd.conf.5.orig Tue Aug 13 21:23:13 2002 ++++ doc/l2tpd.conf.5 Wed Apr 16 16:41:33 2003 +@@ -15,7 +15,11 @@ .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 %%PREFIX%%/etc/l2tp/l2tp\-secrets. ++ ++.TP ++.B Address ++Specify which IP address l2tpd should use. The default is all addresses. .TP .B Port -@@ -141,7 +141,7 @@ +@@ -141,7 +145,7 @@ .SH "FILES" diff --git a/net/l2tpd/files/patch-doc::l2tpd.conf.sample b/net/l2tpd/files/patch-doc::l2tpd.conf.sample index ba417a9d06ac..2e4377e31f30 100644 --- a/net/l2tpd/files/patch-doc::l2tpd.conf.sample +++ b/net/l2tpd/files/patch-doc::l2tpd.conf.sample @@ -1,14 +1,16 @@ $FreeBSD$ ---- doc/l2tpd.conf.sample 2002/10/22 09:59:52 1.1 -+++ doc/l2tpd.conf.sample 2002/10/22 10:00:14 -@@ -10,7 +10,7 @@ +--- doc/l2tpd.conf.sample.orig Sat Aug 10 03:42:22 2002 ++++ doc/l2tpd.conf.sample Wed Apr 16 16:13:48 2003 +@@ -9,8 +9,9 @@ + ; You most definitely don't have to spell out everything as it is done here ; ; [global] ; Global parameters: ++; address = 0.0.0.0 ; * Bind to IP address ; port = 1701 ; * Bind to port 1701 -; auth file = /etc/l2tp/l2tp-secrets ; * Where our challenge secrets are +; auth file = %%PREFIX%%/etc/l2tp/l2tp-secrets ; * Where our challenge secrets are ; access control = yes ; * Refuse connections without IP match - ; - ; [lns default] ; Our fallthrough LNS definition + ; rand source = dev ; Source for entropy for random + ; ; numbers, options are: diff --git a/net/l2tpd/files/patch-file.c b/net/l2tpd/files/patch-file.c index d76f4381b637..912697df2f04 100644 --- a/net/l2tpd/files/patch-file.c +++ b/net/l2tpd/files/patch-file.c @@ -2,7 +2,7 @@ $FreeBSD$ --- file.c.orig Sat Aug 10 03:55:14 2002 -+++ file.c Wed Oct 23 16:33:17 2002 ++++ file.c Wed Apr 16 16:07:19 2003 @@ -18,10 +18,7 @@ #include <unistd.h> #include <stdlib.h> @@ -14,3 +14,41 @@ $FreeBSD$ #include "l2tp.h" +@@ -207,6 +204,29 @@ + return 0; + } + ++int set_address (char *word, char *value, int context, void *item) ++{ ++ switch (context & ~CONTEXT_DEFAULT) ++ { ++ case CONTEXT_GLOBAL: ++#ifdef DEBUG_FILE ++ log (LOG_DEBUG, "set_address: Setting global IP address to %s\n", ++ value); ++#endif ++ if (!inet_aton(value, &(((struct global *) item)->addr))) ++ { ++ snprintf (filerr, sizeof (filerr), "invalid address given\n"); ++ return -1; ++ } ++ break; ++ default: ++ snprintf (filerr, sizeof (filerr), "'%s' not valid in this context\n", ++ word); ++ return -1; ++ } ++ return 0; ++} ++ + int set_port (char *word, char *value, int context, void *item) + { + switch (context & ~CONTEXT_DEFAULT) +@@ -1196,6 +1216,7 @@ + } + + struct keyword words[] = { ++ {"address", &set_address}, + {"port", &set_port}, + {"rand source", &set_rand_source}, + {"auth file", &set_authfile}, diff --git a/net/l2tpd/files/patch-file.h b/net/l2tpd/files/patch-file.h index f2c68b6ac00d..42b75003d0d3 100644 --- a/net/l2tpd/files/patch-file.h +++ b/net/l2tpd/files/patch-file.h @@ -2,7 +2,7 @@ $FreeBSD$ --- file.h.orig Wed Apr 10 23:09:33 2002 -+++ file.h Wed Oct 23 16:34:37 2002 ++++ file.h Wed Apr 16 16:07:19 2003 @@ -49,10 +49,10 @@ #define SENSE_ALLOW -1 #define SENSE_DENY 0 @@ -18,3 +18,11 @@ $FreeBSD$ #define DEFAULT_PID_FILE "/var/run/l2tpd.pid" /* Definition of an LNS */ +@@ -130,6 +130,7 @@ + + struct global + { ++ struct in_addr addr; /* Address to listen on */ + int port; /* Port number to listen to */ + char authfile[STRLEN]; /* File containing authentication info */ + char altauthfile[STRLEN]; /* File containing authentication info */ diff --git a/net/l2tpd/files/patch-l2tpd.c b/net/l2tpd/files/patch-l2tpd.c index 9de98f1ab8c8..fd3b948e4a8a 100644 --- a/net/l2tpd/files/patch-l2tpd.c +++ b/net/l2tpd/files/patch-l2tpd.c @@ -1,5 +1,5 @@ --- l2tpd.c.orig Mon Aug 19 17:12:17 2002 -+++ l2tpd.c Sat Nov 23 19:12:09 2002 ++++ l2tpd.c Wed Apr 16 16:07:19 2003 @@ -34,8 +34,6 @@ #include <netdb.h> #include <string.h> @@ -17,7 +17,7 @@ char *args; char *dial_no_tmp; /* jz: Dialnumber for Outgoing Call */ -@@ -384,6 +384,7 @@ +@@ -384,6 +383,7 @@ /* close the control pipe fd */ close (control_fd); @@ -25,7 +25,7 @@ execv (PPPD, stropt); log (LOG_WARN, "%s: Exec of %s failed!\n", __FUNCTION__, PPPD); -@@ -764,8 +765,8 @@ +@@ -764,8 +764,8 @@ struct lac *lac; int call; int tunl; @@ -36,7 +36,7 @@ { cnt = read (control_fd, buf, sizeof (buf)); if (cnt > 0) -@@ -920,7 +921,9 @@ +@@ -920,7 +920,9 @@ } /* Otherwise select goes nuts */ close (control_fd); @@ -46,7 +46,7 @@ } void usage(void) { -@@ -985,6 +988,7 @@ +@@ -985,6 +987,7 @@ char buf[STRLEN]; int pidfilewritten=0; @@ -54,7 +54,7 @@ if((pid = fork()) < 0) { log(LOG_LOG, "%s: Unable to fork ()\n",__FUNCTION__); close(server_socket); -@@ -998,6 +1002,12 @@ +@@ -998,6 +1001,12 @@ to do a proper fix for this */ close(1); close(2); @@ -67,7 +67,7 @@ /* Read previous pid file. */ if ((i = open(gconfig.pidfile,O_RDONLY)) > 0) { -@@ -1075,6 +1085,7 @@ +@@ -1075,6 +1084,7 @@ init_scheduler (); mkfifo (CONTROL_PIPE, 0600); control_fd = open (CONTROL_PIPE, O_RDONLY | O_NONBLOCK, 0600); @@ -75,3 +75,14 @@ if (control_fd < 0) { log (LOG_CRIT, "%s: Unable to open " CONTROL_PIPE " for reading.", +@@ -1087,8 +1097,8 @@ + "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); ++ log (LOG_LOG, "%s version %s on a %s, addr %s, port %d\n", uts.sysname, ++ uts.release, uts.machine, inet_ntoa(gconfig.addr), gconfig.port); + lac = laclist; + while (lac) + { diff --git a/net/l2tpd/files/patch-network.c b/net/l2tpd/files/patch-network.c index 6943e0458ec2..5f52352c1fb7 100644 --- a/net/l2tpd/files/patch-network.c +++ b/net/l2tpd/files/patch-network.c @@ -1,9 +1,9 @@ $FreeBSD$ ---- network.c 2002/10/22 09:41:27 1.1 -+++ network.c 2002/10/22 09:43:55 -@@ -13,9 +13,6 @@ +--- network.c.orig Wed Apr 10 23:09:33 2002 ++++ network.c Wed Apr 16 16:07:19 2003 +@@ -14,9 +14,6 @@ #include <stdio.h> #include <errno.h> #include <string.h> @@ -13,3 +13,20 @@ $FreeBSD$ #include <netdb.h> #include <fcntl.h> #include <unistd.h> +@@ -25,7 +22,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 +43,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 = gconfig.addr; + server.sin_port = htons (gconfig.port); + if ((server_socket = socket (PF_INET, SOCK_DGRAM, 0)) < 0) + { |