diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2013-06-06 14:25:08 +0200 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2013-06-06 17:26:40 +0400 |
commit | 0b4e47b70a46ecbb1cdceae2cf2396f26e2ee99d (patch) | |
tree | 9282f3aeb71ca17e74d46b45ece1a94b5af709f5 | |
parent | d630170ae867239b6898e3330d20f77d620a9c96 (diff) | |
download | accel-ppp-0b4e47b70a46ecbb1cdceae2cf2396f26e2ee99d.tar.gz accel-ppp-0b4e47b70a46ecbb1cdceae2cf2396f26e2ee99d.zip |
l2tp: Revert to automatic source port selection
Commit 05bb6859 "pptp,l2tp: bind to port options" assigns fixed source
port for every L2TP tunnel. This removes support for ephemeral ports
(as described in RFC 2661 section 8.1) and statically sets the source
port when accel-ppp initiates tunnel connections.
This patch reverts to the previous behaviour (automatic source port
selection) while keeping the ability to listen for incoming
connections on a port different from 1701 (which was the purpose of
commit 05bb6859).
Support for disabling usage of ephemeral ports and for manual port
selection upon tunnel creation will be added later on by means of
configuration options.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 8f76388..46c0be6 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -2054,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 = htons(conf_port); + host_addr.sin_port = 0; conn = l2tp_tunnel_alloc(&pack->addr, &host_addr, framing_cap->val.uint32, 1, 1, @@ -3621,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 = htons(conf_port); + host.sin_port = 0; } for (indx = 3; indx + 1 < fields_cnt; ++indx) { @@ -3649,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 = htons(conf_port); + host.sin_port = 0; if (inet_aton(fields[indx], &host.sin_addr) == 0) { cli_sendv(client, "invalid host address: \"%s\"\r\n", |