summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2014-04-08 23:07:15 +0200
committerDmitry Kozlov <xeb@mail.ru>2014-04-11 06:47:42 +0400
commit19cff977b7c249e69626bce816baac3eb7a71d3f (patch)
tree9f0afe55073ca935c5ee60458c02b6e954daaf12
parent6677ca651c0c014375b71acda296c7f565878336 (diff)
downloadaccel-ppp-xebd-19cff977b7c249e69626bce816baac3eb7a71d3f.tar.gz
accel-ppp-xebd-19cff977b7c249e69626bce816baac3eb7a71d3f.zip
l2tp: configure receive window in accel-ppp.conf
Add the recv-window option in accel-ppp.conf. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
-rw-r--r--accel-pppd/accel-ppp.conf1
-rw-r--r--accel-pppd/accel-ppp.conf.56
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c9
3 files changed, 15 insertions, 1 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf
index a5f7e80..e7daf62 100644
--- a/accel-pppd/accel-ppp.conf
+++ b/accel-pppd/accel-ppp.conf
@@ -84,6 +84,7 @@ verbose=1
#timeout=60
#rtimeout=5
#retransmit=5
+#recv-window=16
#host-name=accel-ppp
#dir300_quirk=0
#secret=
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5
index 01ca869..9cabada 100644
--- a/accel-pppd/accel-ppp.conf.5
+++ b/accel-pppd/accel-ppp.conf.5
@@ -477,6 +477,12 @@ This name will be sent to clients in Host-Name attribute.
.BI "hello-interval=" n
Specifies interval (in seconds) to send Hello control message. Its used for keep alive connection. If peer will not respond to Hello connection will be terminated.
.TP
+.BI "recv-window=" n
+Set the size of the local receive window. Only received messages whose sequence
+number is in the range [last-Nr + 1, last-Nr + recv-window] are accepted
+(where last-Nr is the sequence number of the last acknowledged message).
+Minimum value is 1, maximum is 32768, default is 16.
+.TP
.BI "timeout=" n
Specifies timeout (in seconds) to wait peer completes tunnel and session negotiation.
.TP
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c
index a61694d..9716474 100644
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -73,6 +73,7 @@
int conf_verbose = 0;
int conf_hide_avps = 0;
int conf_avp_permissive = 0;
+static uint16_t conf_recv_window = DEFAULT_RECV_WINDOW;
static int conf_ppp_max_mtu = DEFAULT_PPP_MAX_MTU;
static int conf_port = L2TP_PORT;
static int conf_ephemeral_ports = 0;
@@ -1624,7 +1625,7 @@ static struct l2tp_conn_t *l2tp_tunnel_alloc(const struct sockaddr_in *peer,
goto err_conn_fd;
}
- conn->recv_queue_sz = DEFAULT_RECV_WINDOW;
+ conn->recv_queue_sz = conf_recv_window;
conn->recv_queue = _malloc(conn->recv_queue_sz *
sizeof(*conn->recv_queue));
if (conn->recv_queue == NULL) {
@@ -4697,6 +4698,12 @@ static void load_config(void)
if (opt && atoi(opt) > 0)
conf_retransmit = atoi(opt);
+ opt = conf_get_opt("l2tp", "recv-window");
+ if (opt && atoi(opt) > 0 && atoi(opt) <= RECV_WINDOW_SIZE_MAX)
+ conf_recv_window = atoi(opt);
+ else
+ conf_recv_window = DEFAULT_RECV_WINDOW;
+
opt = conf_get_opt("l2tp", "ppp-max-mtu");
if (opt && atoi(opt) > 0)
conf_ppp_max_mtu = atoi(opt);