summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2014-04-08 23:16:13 +0200
committerDmitry Kozlov <xeb@mail.ru>2014-04-11 06:47:58 +0400
commite2de83e82fa9fac5d0dcaab634fa6b5b5a8a1b2d (patch)
tree790b86bf4a99db4fd01b3a33055c4b14c7453d57
parent2e442ae523415591b087f34ece859b666f88567b (diff)
downloadaccel-ppp-e2de83e82fa9fac5d0dcaab634fa6b5b5a8a1b2d.tar.gz
accel-ppp-e2de83e82fa9fac5d0dcaab634fa6b5b5a8a1b2d.zip
l2tp: improve configuration of retransmission options
* Set default retransmission timeout to 1 second. Since we now have exponential backoff, we can afford a smaller value. * Add the rtimeout-cap option to set the maximum value the retransmission timer has to respect during exponential backoff. * Store the maximun number of retransmissions in tunnel's structure (like other retransmission parameters). * Describe all these changes in man page and reset them to their default values if they're removed from configuration file before a reload. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
-rw-r--r--accel-pppd/accel-ppp.conf3
-rw-r--r--accel-pppd/accel-ppp.conf.512
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c29
3 files changed, 39 insertions, 5 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf
index e7daf62..f399361 100644
--- a/accel-pppd/accel-ppp.conf
+++ b/accel-pppd/accel-ppp.conf
@@ -82,7 +82,8 @@ verbose=1
#dictionary=/usr/local/share/accel-ppp/l2tp/dictionary
#hello-interval=60
#timeout=60
-#rtimeout=5
+#rtimeout=1
+#rtimeout-cap=16
#retransmit=5
#recv-window=16
#host-name=accel-ppp
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5
index 9cabada..1b626ca 100644
--- a/accel-pppd/accel-ppp.conf.5
+++ b/accel-pppd/accel-ppp.conf.5
@@ -488,6 +488,18 @@ Specifies timeout (in seconds) to wait peer completes tunnel and session negotia
.TP
.BI "rtimeout=" n
Specifies timeout (in seconds) to wait message acknowledge, if elapsed message retransmition will be performed.
+Timeout is multiplied by two after each retransmission. So if
+.BR rtimeout " is set to 1, first retransmission will occur after one second,"
+second retransmission two seconds later, third one four seconds later, and so
+on, until a reply is received or the
+.BR retransmit " value is reached. Default value is 1."
+.TP
+.BI "rtimeout-cap=" n
+Set the maximum interval between retransmissions. The exponential backoff
+.RB "interval used by " rtimeout " will never grow above " rtimeout-cap .
+.BR rtimeout-cap " must be higher than " rtimeout " and, according to RFC 2661,
+must be no less than 8 (though accel-ppp doesn't enforce this rule).
+Default value is 16.
.TP
.BI "retransmit=" n
Specifies maximum number of message retransmission, if exceeds connection will be terminated.
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c
index 2c8c90a..b80595f 100644
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -69,7 +69,9 @@
#define DEFAULT_RECV_WINDOW 16
#define DEFAULT_PPP_MAX_MTU 1420
+#define DEFAULT_RTIMEOUT 1
#define DEFAULT_RTIMEOUT_CAP 16
+#define DEFAULT_RETRANSMIT 5
int conf_verbose = 0;
int conf_hide_avps = 0;
@@ -79,8 +81,9 @@ static int conf_ppp_max_mtu = DEFAULT_PPP_MAX_MTU;
static int conf_port = L2TP_PORT;
static int conf_ephemeral_ports = 0;
static int conf_timeout = 60;
-static int conf_rtimeout = 5;
-static int conf_retransmit = 5;
+static int conf_rtimeout = DEFAULT_RTIMEOUT;
+static int conf_rtimeout_cap = DEFAULT_RTIMEOUT_CAP;
+static int conf_retransmit = DEFAULT_RETRANSMIT;
static int conf_hello_interval = 60;
static int conf_dir300_quirk = 0;
static const char *conf_host_name = "accel-ppp";
@@ -145,6 +148,7 @@ struct l2tp_conn_t
struct triton_timer_t hello_timer;
int rtimeout;
int rtimeout_cap;
+ int max_retransmit;
struct sockaddr_in peer_addr;
struct sockaddr_in host_addr;
@@ -1686,7 +1690,8 @@ static struct l2tp_conn_t *l2tp_tunnel_alloc(const struct sockaddr_in *peer,
conn->hello_timer.period = conf_hello_interval * 1000;
conn->rtimeout = conf_rtimeout * 1000;
- conn->rtimeout_cap = DEFAULT_RTIMEOUT_CAP * 1000;
+ conn->rtimeout_cap = conf_rtimeout_cap * 1000;
+ conn->max_retransmit = conf_retransmit;
conn->sessions = NULL;
conn->sess_count = 0;
@@ -2026,7 +2031,7 @@ static void l2tp_rtimeout(struct triton_timer_t *tm)
pack = list_first_entry(&conn->rtms_queue, typeof(*pack), entry);
- if (++conn->retransmit > conf_retransmit) {
+ if (++conn->retransmit > conn->max_retransmit) {
log_tunnel(log_warn, conn,
"no acknowledgement from peer after %i retransmissions,"
" deleting tunnel\n", conn->retransmit - 1);
@@ -4745,10 +4750,26 @@ static void load_config(void)
opt = conf_get_opt("l2tp", "rtimeout");
if (opt && atoi(opt) > 0)
conf_rtimeout = atoi(opt);
+ else
+ conf_rtimeout = DEFAULT_RTIMEOUT;
+
+ opt = conf_get_opt("l2tp", "rtimeout-cap");
+ if (opt && atoi(opt) > 0)
+ conf_rtimeout_cap = atoi(opt);
+ else
+ conf_rtimeout_cap = DEFAULT_RTIMEOUT_CAP;
+ if (conf_rtimeout_cap < conf_rtimeout) {
+ log_warn("l2tp: rtimeout-cap (%i) is smaller than rtimeout (%i),"
+ " resetting rtimeout-cap to %i\n",
+ conf_rtimeout_cap, conf_rtimeout, conf_rtimeout);
+ conf_rtimeout_cap = conf_rtimeout;
+ }
opt = conf_get_opt("l2tp", "retransmit");
if (opt && atoi(opt) > 0)
conf_retransmit = atoi(opt);
+ else
+ conf_retransmit = DEFAULT_RETRANSMIT;
opt = conf_get_opt("l2tp", "recv-window");
if (opt && atoi(opt) > 0 && atoi(opt) <= RECV_WINDOW_SIZE_MAX)