summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/accel-ppp.conf.56
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c4
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c13
-rw-r--r--accel-pppd/ctrl/pptp/pptp.c7
4 files changed, 23 insertions, 7 deletions
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5
index dd0d2553..a6c51897 100644
--- a/accel-pppd/accel-ppp.conf.5
+++ b/accel-pppd/accel-ppp.conf.5
@@ -328,6 +328,9 @@ Configuration of PPTP module.
.BI "bind=" x.x.x.x
If this option is given then pptp server will bind to specified IP address.
.TP
+.BI "port=" n
+If this option is given then pptp server will bind to specified port.
+.TP
.BI "verbose=" n
If this option is given and
.B n
@@ -399,6 +402,9 @@ Configuration of L2TP module.
.BI "bind=" x.x.x.x
Specifies IP address to bind.
.TP
+.BI "port=" n
+Specifies port to bind.
+.TP
.BI "host-name=" string
This name will be sent to clients in Host-Name attribute.
.TP
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 7fcfa266..a2991f42 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -692,7 +692,7 @@ static void ipoe_session_started(struct ap_session *s)
{
struct ipoe_session *ses = container_of(s, typeof(*ses), ses);
- log_ppp_debug("ipoe: session started\n");
+ log_ppp_info1("ipoe: session started\n");
if (ses->timer.tpd)
triton_timer_mod(&ses->timer, 0);
@@ -748,7 +748,7 @@ static void ipoe_session_finished(struct ap_session *s)
struct ipoe_session *ses = container_of(s, typeof(*ses), ses);
int serv_close;
- log_ppp_debug("ipoe: session finished\n");
+ log_ppp_info1("ipoe: session finished\n");
pthread_mutex_lock(&ses->serv->lock);
list_del(&ses->entry);
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c
index ffcbb8ac..f109fbc9 100644
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -48,6 +48,7 @@
#define STATE_FIN 9
#define STATE_CLOSE 0
+int conf_port = L2TP_PORT;
int conf_verbose = 0;
int conf_hide_avps = 0;
int conf_avp_permissive = 0;
@@ -2053,7 +2054,7 @@ static int l2tp_recv_SCCRQ(const struct l2tp_serv_t *serv,
host_addr.sin_family = AF_INET;
host_addr.sin_addr = pkt_info->ipi_addr;
- host_addr.sin_port = 0;
+ host_addr.sin_port = htons(conf_port);
conn = l2tp_tunnel_alloc(&pack->addr, &host_addr,
framing_cap->val.uint32, 1, 1,
@@ -3503,7 +3504,6 @@ static int start_udp_server(void)
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
- addr.sin_port = htons(L2TP_PORT);
opt = conf_get_opt("l2tp", "bind");
if (opt)
@@ -3511,6 +3511,11 @@ static int start_udp_server(void)
else
addr.sin_addr.s_addr = htonl(INADDR_ANY);
+ opt = conf_get_opt("l2tp", "port");
+ if (opt && atoi(opt) > 0)
+ conf_port = atoi(opt);
+ addr.sin_port = htons(conf_port);
+
if (setsockopt(udp_serv.hnd.fd, SOL_SOCKET, SO_REUSEADDR,
&udp_serv.hnd.fd, sizeof(udp_serv.hnd.fd)) < 0) {
log_error("l2tp: impossible to start L2TP server:"
@@ -3616,7 +3621,7 @@ static int l2tp_create_tunnel_exec(const char *cmd, char * const *fields,
if (opt)
if (inet_aton(opt, &host.sin_addr) == 0) {
host.sin_family = AF_INET;
- host.sin_port = 0;
+ host.sin_port = htons(conf_port);
}
for (indx = 3; indx + 1 < fields_cnt; ++indx) {
@@ -3644,7 +3649,7 @@ static int l2tp_create_tunnel_exec(const char *cmd, char * const *fields,
} else if (strcmp("host-addr", fields[indx]) == 0) {
host_indx = ++indx;
host.sin_family = AF_INET;
- host.sin_port = 0;
+ host.sin_port = htons(conf_port);
if (inet_aton(fields[indx], &host.sin_addr) == 0) {
cli_sendv(client,
"invalid host address: \"%s\"\r\n",
diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c
index e735c72c..d5b96c1e 100644
--- a/accel-pppd/ctrl/pptp/pptp.c
+++ b/accel-pppd/ctrl/pptp/pptp.c
@@ -778,13 +778,18 @@ static void pptp_init(void)
fcntl(serv.hnd.fd, F_SETFD, fcntl(serv.hnd.fd, F_GETFD) | FD_CLOEXEC);
addr.sin_family = AF_INET;
- addr.sin_port = htons(PPTP_PORT);
opt = conf_get_opt("pptp", "bind");
if (opt)
addr.sin_addr.s_addr = inet_addr(opt);
else
addr.sin_addr.s_addr = htonl(INADDR_ANY);
+
+ opt = conf_get_opt("pptp", "port");
+ if (opt && atoi(opt) > 0)
+ addr.sin_port = htons(atoi(opt));
+ else
+ addr.sin_port = htons(PPTP_PORT);
setsockopt(serv.hnd.fd, SOL_SOCKET, SO_REUSEADDR, &serv.hnd.fd, 4);
if (bind (serv.hnd.fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) {