summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl
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 /accel-pppd/ctrl
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>
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c29
1 files changed, 25 insertions, 4 deletions
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)