summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2014-03-22 04:32:40 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2014-03-22 04:32:40 +0000
commit187690a3e0724e51c20a94a626cc80a07134107c (patch)
tree3b9da450b7533f38661fc9306e8633e81f691ede
parent4cc6857371113f98a8ac2b75230c3bf093f9b6f7 (diff)
Now tunnel can have multiple listen addresses.
-rw-r--r--usr.sbin/npppd/l2tp/l2tp.h6
-rw-r--r--usr.sbin/npppd/l2tp/l2tp_conf.h41
-rw-r--r--usr.sbin/npppd/l2tp/l2tpd.c25
-rw-r--r--usr.sbin/npppd/npppd/npppd.conf12
-rw-r--r--usr.sbin/npppd/npppd/npppd.conf.53
-rw-r--r--usr.sbin/npppd/npppd/parse.y124
-rw-r--r--usr.sbin/npppd/npppd/ppp.c16
-rw-r--r--usr.sbin/npppd/pptp/pptp.h4
-rw-r--r--usr.sbin/npppd/pptp/pptp_conf.h31
-rw-r--r--usr.sbin/npppd/pptp/pptpd.c30
10 files changed, 196 insertions, 96 deletions
diff --git a/usr.sbin/npppd/l2tp/l2tp.h b/usr.sbin/npppd/l2tp/l2tp.h
index f676273e687..86698f4af40 100644
--- a/usr.sbin/npppd/l2tp/l2tp.h
+++ b/usr.sbin/npppd/l2tp/l2tp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2tp.h,v 1.9 2012/09/18 13:14:08 yasuoka Exp $ */
+/* $OpenBSD: l2tp.h,v 1.10 2014/03/22 04:32:39 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -30,7 +30,7 @@
/*@file
* header file for the L2TP module
*/
-/* $Id: l2tp.h,v 1.9 2012/09/18 13:14:08 yasuoka Exp $ */
+/* $Id: l2tp.h,v 1.10 2014/03/22 04:32:39 yasuoka Exp $ */
/************************************************************************
* Protocol Constants
@@ -466,7 +466,7 @@ l2tp_ctrl *l2tpd_get_ctrl (l2tpd *, u_int);
void l2tpd_add_ctrl (l2tpd *, l2tp_ctrl *);
void l2tpd_ctrl_finished_notify(l2tpd *);
void l2tpd_remove_ctrl (l2tpd *, u_int);
-int l2tpd_add_listener (l2tpd *, int, struct l2tp_conf *);
+int l2tpd_add_listener (l2tpd *, int, struct l2tp_conf *, struct sockaddr *);
void l2tpd_log (l2tpd *, int, const char *, ...) __attribute__((__format__ (__printf__, 3, 4)));
int l2tpd_reload(l2tpd *, struct l2tp_confs *);
void l2tpd_log_access_deny(l2tpd *, const char *, struct sockaddr *);
diff --git a/usr.sbin/npppd/l2tp/l2tp_conf.h b/usr.sbin/npppd/l2tp/l2tp_conf.h
index 4306f993c31..41063cef591 100644
--- a/usr.sbin/npppd/l2tp/l2tp_conf.h
+++ b/usr.sbin/npppd/l2tp/l2tp_conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2tp_conf.h,v 1.1 2012/09/18 13:14:08 yasuoka Exp $ */
+/* $OpenBSD: l2tp_conf.h,v 1.2 2014/03/22 04:32:39 yasuoka Exp $ */
/*
* Copyright (c) 2012 YASUOKA Masahiko <yasuoka@openbsd.org>
@@ -28,23 +28,30 @@
TAILQ_HEAD(l2tp_confs, l2tp_conf);
+struct l2tp_listen_addr {
+ struct sockaddr_storage addr;
+ TAILQ_ENTRY(l2tp_listen_addr)
+ entry;
+};
+
struct l2tp_conf {
- TAILQ_ENTRY(l2tp_conf) entry;
- char name[L2TP_NAME_LEN];
- char *hostname;
- char *vendor_name;
- struct sockaddr_storage address;
- int hello_interval;
- int hello_timeout;
- bool data_use_seq;
- bool require_ipsec;
- bool accept_dialin;
- bool lcp_renegotiation;
- bool force_lcp_renegotiation;
- bool ctrl_in_pktdump;
- bool ctrl_out_pktdump;
- bool data_in_pktdump;
- bool data_out_pktdump;
+ TAILQ_ENTRY(l2tp_conf) entry;
+ char name[L2TP_NAME_LEN];
+ char *hostname;
+ char *vendor_name;
+ TAILQ_HEAD(l2tp_listen_addrs, l2tp_listen_addr)
+ listen;
+ int hello_interval;
+ int hello_timeout;
+ bool data_use_seq;
+ bool require_ipsec;
+ bool accept_dialin;
+ bool lcp_renegotiation;
+ bool force_lcp_renegotiation;
+ bool ctrl_in_pktdump;
+ bool ctrl_out_pktdump;
+ bool data_in_pktdump;
+ bool data_out_pktdump;
};
#endif
diff --git a/usr.sbin/npppd/l2tp/l2tpd.c b/usr.sbin/npppd/l2tp/l2tpd.c
index 2fe1a279aa4..2dd8827ec32 100644
--- a/usr.sbin/npppd/l2tp/l2tpd.c
+++ b/usr.sbin/npppd/l2tp/l2tpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2tpd.c,v 1.13 2013/04/20 23:32:32 yasuoka Exp $ */
+/* $OpenBSD: l2tpd.c,v 1.14 2014/03/22 04:32:39 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -26,7 +26,7 @@
* SUCH DAMAGE.
*/
/**@file L2TP(Layer Two Tunneling Protocol "L2TP") / RFC2661 */
-/* $Id: l2tpd.c,v 1.13 2013/04/20 23:32:32 yasuoka Exp $ */
+/* $Id: l2tpd.c,v 1.14 2014/03/22 04:32:39 yasuoka Exp $ */
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
@@ -139,7 +139,8 @@ l2tpd_init(l2tpd *_this)
* @param bindaddr bind address
*/
int
-l2tpd_add_listener(l2tpd *_this, int idx, struct l2tp_conf *conf)
+l2tpd_add_listener(l2tpd *_this, int idx, struct l2tp_conf *conf,
+ struct sockaddr *addr)
{
l2tpd_listener *plistener, *plsnr;
@@ -167,8 +168,8 @@ l2tpd_add_listener(l2tpd *_this, int idx, struct l2tp_conf *conf)
goto fail;
}
memset(plistener, 0, sizeof(l2tpd_listener));
- L2TPD_ASSERT(sizeof(plistener->bind) >= conf->address.ss_len);
- memcpy(&plistener->bind, &conf->address, conf->address.ss_len);
+ L2TPD_ASSERT(sizeof(plistener->bind) >= addr->sa_len);
+ memcpy(&plistener->bind, addr, addr->sa_len);
if (plistener->bind.sin6.sin6_port == 0)
plistener->bind.sin6.sin6_port = htons(L2TPD_DEFAULT_UDP_PORT);
@@ -550,9 +551,10 @@ l2tpd_stop(l2tpd *_this)
int
l2tpd_reload(l2tpd *_this, struct l2tp_confs *l2tp_conf)
{
- int i;
- struct l2tp_conf *conf;
- l2tpd_listener *listener;
+ int i;
+ struct l2tp_conf *conf;
+ l2tpd_listener *listener;
+ struct l2tp_listen_addr *addr;
if (slist_length(&_this->listener) > 0) {
/*
@@ -574,8 +576,11 @@ l2tpd_reload(l2tpd *_this, struct l2tp_confs *l2tp_conf)
}
i = 0;
- TAILQ_FOREACH(conf, l2tp_conf, entry)
- l2tpd_add_listener(_this, i++, conf);
+ TAILQ_FOREACH(conf, l2tp_conf, entry) {
+ TAILQ_FOREACH(addr, &conf->listen, entry)
+ l2tpd_add_listener(_this, i++, conf,
+ (struct sockaddr *)&addr->addr);
+ }
if (l2tpd_start(_this) != 0)
return -1;
diff --git a/usr.sbin/npppd/npppd/npppd.conf b/usr.sbin/npppd/npppd/npppd.conf
index a08b6e3a1d3..f4d52ff817c 100644
--- a/usr.sbin/npppd/npppd/npppd.conf
+++ b/usr.sbin/npppd/npppd/npppd.conf
@@ -1,4 +1,4 @@
-# $OpenBSD: npppd.conf,v 1.1 2012/09/20 12:51:43 yasuoka Exp $
+# $OpenBSD: npppd.conf,v 1.2 2014/03/22 04:32:39 yasuoka Exp $
# sample npppd configuration file. see npppd.conf(5)
authentication LOCAL type local {
@@ -13,10 +13,8 @@ authentication LOCAL type local {
# }
#}
-tunnel L2TP_ipv4 protocol l2tp {
+tunnel L2TP protocol l2tp {
listen on 0.0.0.0
-}
-tunnel L2TP_ipv6 protocol l2tp {
listen on ::
}
@@ -27,10 +25,8 @@ ipcp IPCP {
# use pppx(4) interface. use an interface per a ppp session.
interface pppx0 address 10.0.0.1 ipcp IPCP
-bind tunnel from L2TP_ipv4 authenticated by LOCAL to pppx0
-bind tunnel from L2TP_ipv6 authenticated by LOCAL to pppx0
+bind tunnel from L2TP authenticated by LOCAL to pppx0
# use tun(4) interface. multiple ppp sessions concentrate one interface.
#interface tun0 address 10.0.0.1 ipcp IPCP
-#bind tunnel from L2TP_ipv4 authenticated by LOCAL to tun0
-#bind tunnel from L2TP_ipv6 authenticated by LOCAL to tun0
+#bind tunnel from L2TP authenticated by LOCAL to tun0
diff --git a/usr.sbin/npppd/npppd/npppd.conf.5 b/usr.sbin/npppd/npppd/npppd.conf.5
index 813f954068b..1b8902eff15 100644
--- a/usr.sbin/npppd/npppd/npppd.conf.5
+++ b/usr.sbin/npppd/npppd/npppd.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: npppd.conf.5,v 1.12 2014/03/22 04:23:17 yasuoka Exp $
+.\" $OpenBSD: npppd.conf.5,v 1.13 2014/03/22 04:32:39 yasuoka Exp $
.\"
.\" Copyright (c) 2012 YASUOKA Masahiko <yasuoka@openbsd.org>
.\"
@@ -85,6 +85,7 @@ If the port is omitted, the default port numbers are used.
The default port numbers are 1723 for PPTP and 1701 for L2TP.
The default value is 0.0.0.0.
This option is for PPTP and L2TP only.
+This option can be used multiple times.
.It Ic listen on interface Ar interface-name
Specify the interface name that this PPPoE tunnel listens on.
The interface must be an Ethernet interface.
diff --git a/usr.sbin/npppd/npppd/parse.y b/usr.sbin/npppd/npppd/parse.y
index c291836b79f..b6a1cadeae8 100644
--- a/usr.sbin/npppd/npppd/parse.y
+++ b/usr.sbin/npppd/npppd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.8 2014/03/22 04:23:17 yasuoka Exp $ */
+/* $OpenBSD: parse.y,v 1.9 2014/03/22 04:32:39 yasuoka Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -68,23 +68,24 @@ int lgetc(int);
int lungetc(int);
int findeol(void);
-static void tunnconf_init (struct tunnconf *, int);
-static void tunnconf_fini (struct tunnconf *);
-static struct tunnconf *tunnconf_find (const char *);
-static void authconf_init (struct authconf *);
-static void authconf_fini (struct authconf *);
-static void radconf_fini (struct radconf *);
-static struct authconf *authconf_find (const char *);
-static void ipcpconf_init (struct ipcpconf *);
-static void ipcpconf_fini (struct ipcpconf *);
-static struct ipcpconf *ipcpconf_find (const char *);
-struct iface *iface_find (const char *);
-
-struct npppd_conf *conf;
-struct ipcpconf *curr_ipcpconf;
-struct tunnconf *curr_tunnconf;
-struct authconf *curr_authconf;
-struct radconf *curr_radconf;
+static void tunnconf_init (struct tunnconf *, int);
+static void tunnconf_fini (struct tunnconf *);
+static struct tunnconf *tunnconf_find (const char *);
+static void authconf_init (struct authconf *);
+static void authconf_fini (struct authconf *);
+static void radconf_fini (struct radconf *);
+static struct authconf *authconf_find (const char *);
+static void ipcpconf_init (struct ipcpconf *);
+static void ipcpconf_fini (struct ipcpconf *);
+static struct ipcpconf *ipcpconf_find (const char *);
+static struct iface *iface_find (const char *);
+static void sa_set_in_addr_any(struct sockaddr *);
+
+struct npppd_conf *conf;
+struct ipcpconf *curr_ipcpconf;
+struct tunnconf *curr_tunnconf;
+struct authconf *curr_authconf;
+struct radconf *curr_radconf;
typedef struct {
union {
@@ -215,12 +216,42 @@ tunnel : TUNNEL STRING PROTOCOL tunnelproto {
switch (curr_tunnconf->protocol) {
#ifdef USE_NPPPD_L2TP
case NPPPD_TUNNEL_L2TP:
+ if (TAILQ_EMPTY(
+ &curr_tunnconf->proto.l2tp.listen)) {
+ struct l2tp_listen_addr *addr;
+
+ if ((addr = malloc(sizeof(struct
+ l2tp_listen_addr))) == NULL) {
+ free(curr_tunnconf);
+ yyerror("out of memory");
+ YYERROR;
+ }
+ sa_set_in_addr_any(
+ (struct sockaddr *)&addr->addr);
+ TAILQ_INSERT_TAIL(&curr_tunnconf->proto.
+ l2tp.listen, addr, entry);
+ }
TAILQ_INSERT_TAIL(&conf->l2tp_confs,
&curr_tunnconf->proto.l2tp, entry);
break;
#endif
#ifdef USE_NPPPD_PPTP
case NPPPD_TUNNEL_PPTP:
+ if (TAILQ_EMPTY(
+ &curr_tunnconf->proto.pptp.listen)) {
+ struct pptp_listen_addr *addr;
+
+ if ((addr = malloc(sizeof(struct
+ pptp_listen_addr))) == NULL) {
+ free(curr_tunnconf);
+ yyerror("out of memory");
+ YYERROR;
+ }
+ sa_set_in_addr_any(
+ (struct sockaddr *)&addr->addr);
+ TAILQ_INSERT_TAIL(&curr_tunnconf->proto.
+ pptp.listen, addr, entry);
+ }
TAILQ_INSERT_TAIL(&conf->pptp_confs,
&curr_tunnconf->proto.pptp, entry);
break;
@@ -254,18 +285,41 @@ tunnopt_l : /* empty */
;
tunnopt : LISTEN ON addressport {
+
switch (curr_tunnconf->protocol) {
case NPPPD_TUNNEL_L2TP:
- curr_tunnconf->proto.l2tp.address = $3;
+ {
+ struct l2tp_listen_addr *l_listen;
+
+ if ((l_listen = malloc(sizeof(
+ struct l2tp_listen_addr))) == NULL) {
+ yyerror("out of memory");
+ YYERROR;
+ }
+ l_listen->addr = $3;
+ TAILQ_INSERT_TAIL(&curr_tunnconf->proto
+ .l2tp.listen, l_listen, entry);
break;
+ }
case NPPPD_TUNNEL_PPTP:
if ($3.ss_family == AF_INET6) {
yyerror("listen on IPv6 address is not "
"supported by pptp tunnel");
YYERROR;
}
- curr_tunnconf->proto.pptp.address = $3;
+ {
+ struct pptp_listen_addr *p_listen;
+
+ if ((p_listen = malloc(sizeof(
+ struct pptp_listen_addr))) == NULL) {
+ yyerror("out of memory");
+ YYERROR;
+ }
+ p_listen->addr = $3;
+ TAILQ_INSERT_TAIL(&curr_tunnconf->proto
+ .pptp.listen, p_listen, entry);
break;
+ }
default:
yyerror("listen on address is not supported "
"for specified protocol.\n");
@@ -1401,21 +1455,39 @@ tunnconf_fini(struct tunnconf *tun)
switch (tun->protocol) {
case NPPPD_TUNNEL_L2TP:
+ {
+ struct l2tp_listen_addr *l_addr, *l_tmp;
+
if (tun->proto.l2tp.hostname != NULL)
free(tun->proto.l2tp.hostname);
tun->proto.l2tp.hostname = NULL;
if (tun->proto.l2tp.vendor_name != NULL)
free(tun->proto.l2tp.vendor_name);
tun->proto.l2tp.vendor_name = NULL;
+ TAILQ_FOREACH_SAFE(l_addr, &tun->proto.l2tp.listen, entry,
+ l_tmp) {
+ TAILQ_REMOVE(&tun->proto.l2tp.listen, l_addr, entry);
+ free(l_addr);
+ }
break;
+ }
case NPPPD_TUNNEL_PPTP:
+ {
+ struct pptp_listen_addr *p_addr, *p_tmp;
+
if (tun->proto.pptp.hostname != NULL)
free(tun->proto.pptp.hostname);
tun->proto.pptp.hostname = NULL;
if (tun->proto.pptp.vendor_name != NULL)
free(tun->proto.pptp.vendor_name);
tun->proto.pptp.vendor_name = NULL;
+ TAILQ_FOREACH_SAFE(p_addr, &tun->proto.pptp.listen, entry,
+ p_tmp) {
+ TAILQ_REMOVE(&tun->proto.pptp.listen, p_addr, entry);
+ free(p_addr);
+ }
break;
+ }
case NPPPD_TUNNEL_PPPOE:
if (tun->proto.pppoe.service_name != NULL)
free(tun->proto.pppoe.service_name);
@@ -1436,9 +1508,11 @@ tunnconf_init(struct tunnconf *tun, int protocol)
switch (protocol) {
case NPPPD_TUNNEL_L2TP:
memcpy(tun, &tunnconf_default_l2tp, sizeof(struct tunnconf));
+ TAILQ_INIT(&tun->proto.l2tp.listen);
break;
case NPPPD_TUNNEL_PPTP:
memcpy(tun, &tunnconf_default_pptp, sizeof(struct tunnconf));
+ TAILQ_INIT(&tun->proto.pptp.listen);
break;
case NPPPD_TUNNEL_PPPOE:
memcpy(tun, &tunnconf_default_pppoe, sizeof(struct tunnconf));
@@ -1548,3 +1622,13 @@ iface_find(const char *name)
return NULL;
}
+
+void
+sa_set_in_addr_any(struct sockaddr *sa)
+{
+ memset(sa, 0, sizeof(struct sockaddr_in));
+
+ sa->sa_family = AF_INET,
+ sa->sa_len = sizeof(struct sockaddr_in);
+ ((struct sockaddr_in *)sa)->sin_addr.s_addr = htonl(INADDR_ANY);
+}
diff --git a/usr.sbin/npppd/npppd/ppp.c b/usr.sbin/npppd/npppd/ppp.c
index 7c22261b37b..19cd85051e8 100644
--- a/usr.sbin/npppd/npppd/ppp.c
+++ b/usr.sbin/npppd/npppd/ppp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ppp.c,v 1.19 2014/03/22 04:30:31 yasuoka Exp $ */
+/* $OpenBSD: ppp.c,v 1.20 2014/03/22 04:32:39 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: ppp.c,v 1.19 2014/03/22 04:30:31 yasuoka Exp $ */
+/* $Id: ppp.c,v 1.20 2014/03/22 04:32:39 yasuoka Exp $ */
/**@file
* This file provides PPP(Point-to-Point Protocol, RFC 1661) and
* {@link :: _npppd_ppp PPP instance} related functions.
@@ -1192,10 +1192,8 @@ struct tunnconf tunnconf_default_l2tp = {
.l2tp = {
.hostname = NULL,
.vendor_name = NULL,
- .address = {
- .ss_family = AF_INET,
- .ss_len = sizeof(struct sockaddr_in)
- },
+ .listen = TAILQ_HEAD_INITIALIZER(
+ tunnconf_default_l2tp.proto.l2tp.listen),
/* .hello_interval, */
/* .hello_timeout, */
.data_use_seq = true,
@@ -1229,10 +1227,8 @@ struct tunnconf tunnconf_default_pptp = {
.pptp = {
.hostname = NULL,
.vendor_name = NULL,
- .address = {
- .ss_family = AF_INET,
- .ss_len = sizeof(struct sockaddr_in)
- },
+ .listen = TAILQ_HEAD_INITIALIZER(
+ tunnconf_default_l2tp.proto.l2tp.listen),
/* .echo_interval, */
/* .echo_timeout, */
}
diff --git a/usr.sbin/npppd/pptp/pptp.h b/usr.sbin/npppd/pptp/pptp.h
index a796523fd07..c759b3e4d04 100644
--- a/usr.sbin/npppd/pptp/pptp.h
+++ b/usr.sbin/npppd/pptp/pptp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pptp.h,v 1.9 2012/11/13 17:10:40 yasuoka Exp $ */
+/* $OpenBSD: pptp.h,v 1.10 2014/03/22 04:32:39 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -333,7 +333,7 @@ int pptpd_start (pptpd *);
void pptpd_stop (pptpd *);
void pptpd_stop_immediatly (pptpd *);
void pptpd_ctrl_finished_notify(pptpd *, pptp_ctrl *);
-int pptpd_add_listener(pptpd *, int, struct pptp_conf *);
+int pptpd_add_listener(pptpd *, int, struct pptp_conf *, struct sockaddr *);
pptp_ctrl *pptp_ctrl_create (void);
int pptp_ctrl_init (pptp_ctrl *);
diff --git a/usr.sbin/npppd/pptp/pptp_conf.h b/usr.sbin/npppd/pptp/pptp_conf.h
index c9c0d6af2b4..1150b991f31 100644
--- a/usr.sbin/npppd/pptp/pptp_conf.h
+++ b/usr.sbin/npppd/pptp/pptp_conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pptp_conf.h,v 1.1 2012/09/18 13:14:08 yasuoka Exp $ */
+/* $OpenBSD: pptp_conf.h,v 1.2 2014/03/22 04:32:39 yasuoka Exp $ */
/*
* Copyright (c) 2012 YASUOKA Masahiko <yasuoka@openbsd.org>
@@ -28,18 +28,25 @@
TAILQ_HEAD(pptp_confs, pptp_conf);
+struct pptp_listen_addr {
+ struct sockaddr_storage addr;
+ TAILQ_ENTRY(pptp_listen_addr)
+ entry;
+};
+
struct pptp_conf {
- TAILQ_ENTRY(pptp_conf) entry;
- char name[PPTP_NAME_LEN];
- char *hostname;
- char *vendor_name;
- int echo_interval;
- int echo_timeout;
- struct sockaddr_storage address;
- bool ctrl_in_pktdump;
- bool ctrl_out_pktdump;
- bool data_in_pktdump;
- bool data_out_pktdump;
+ TAILQ_ENTRY(pptp_conf) entry;
+ char name[PPTP_NAME_LEN];
+ char *hostname;
+ char *vendor_name;
+ int echo_interval;
+ int echo_timeout;
+ TAILQ_HEAD(pptp_listen_addrs, pptp_listen_addr)
+ listen;
+ bool ctrl_in_pktdump;
+ bool ctrl_out_pktdump;
+ bool data_in_pktdump;
+ bool data_out_pktdump;
};
#endif
diff --git a/usr.sbin/npppd/pptp/pptpd.c b/usr.sbin/npppd/pptp/pptpd.c
index 27348185820..fbc095e9f9d 100644
--- a/usr.sbin/npppd/pptp/pptpd.c
+++ b/usr.sbin/npppd/pptp/pptpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pptpd.c,v 1.20 2014/03/22 04:19:54 yasuoka Exp $ */
+/* $OpenBSD: pptpd.c,v 1.21 2014/03/22 04:32:39 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,12 +25,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: pptpd.c,v 1.20 2014/03/22 04:19:54 yasuoka Exp $ */
+/* $Id: pptpd.c,v 1.21 2014/03/22 04:32:39 yasuoka Exp $ */
/**@file
* This file provides a implementation of PPTP daemon. Currently it
* provides functions for PAC (PPTP Access Concentrator) only.
- * $Id: pptpd.c,v 1.20 2014/03/22 04:19:54 yasuoka Exp $
+ * $Id: pptpd.c,v 1.21 2014/03/22 04:32:39 yasuoka Exp $
*/
#include <sys/types.h>
#include <sys/param.h>
@@ -141,7 +141,8 @@ pptpd_init(pptpd *_this)
/* add a listner to pptpd daemon context */
int
-pptpd_add_listener(pptpd *_this, int idx, struct pptp_conf *conf)
+pptpd_add_listener(pptpd *_this, int idx, struct pptp_conf *conf,
+ struct sockaddr *addr)
{
int inaddr_any;
pptpd_listener *plistener, *plstn;
@@ -172,10 +173,9 @@ pptpd_add_listener(pptpd *_this, int idx, struct pptp_conf *conf)
}
memset(plistener, 0, sizeof(pptpd_listener));
- PPTPD_ASSERT(sizeof(plistener->bind_sin) >= conf->address.ss_len);
- memcpy(&plistener->bind_sin, &conf->address, conf->address.ss_len);
- memcpy(&plistener->bind_sin_gre, &conf->address,
- conf->address.ss_len);
+ PPTPD_ASSERT(sizeof(plistener->bind_sin) >= addr->sa_len);
+ memcpy(&plistener->bind_sin, addr, addr->sa_len);
+ memcpy(&plistener->bind_sin_gre, addr, addr->sa_len);
if (plistener->bind_sin.sin_port == 0)
plistener->bind_sin.sin_port = htons(PPTPD_DEFAULT_TCP_PORT);
@@ -566,9 +566,10 @@ pptpd_stop(pptpd *_this)
int
pptpd_reload(pptpd *_this, struct pptp_confs *pptp_conf)
{
- int i;
- struct pptp_conf *conf;
- pptpd_listener *listener;
+ int i;
+ struct pptp_conf *conf;
+ pptpd_listener *listener;
+ struct pptp_listen_addr *addr;
if (slist_length(&_this->listener) > 0) {
/*
@@ -590,8 +591,11 @@ pptpd_reload(pptpd *_this, struct pptp_confs *pptp_conf)
}
i = 0;
- TAILQ_FOREACH(conf, pptp_conf, entry)
- pptpd_add_listener(_this, i++, conf);
+ TAILQ_FOREACH(conf, pptp_conf, entry) {
+ TAILQ_FOREACH(addr, &conf->listen, entry)
+ pptpd_add_listener(_this, i++, conf,
+ (struct sockaddr *)&addr->addr);
+ }
if (pptpd_start(_this) != 0)
return -1;