From 4e6cf832cddf523c233ff0f0f3b244e077d87df3 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Tue, 23 Jul 2013 20:35:14 +0200 Subject: l2tp: Add the ppp-max-mtu option As the maximum acceptable MTU for an L2TP link may vary depending on IP and L2TP packet headers options, it is better to make it configurable so that an administrator can adapt it to its network constraints. Use the original value (1420) as default. Signed-off-by: Guillaume Nault --- accel-pppd/accel-ppp.conf.5 | 4 ++++ accel-pppd/ctrl/l2tp/l2tp.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'accel-pppd') diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5 index 2faf2ab..9f7740a 100644 --- a/accel-pppd/accel-ppp.conf.5 +++ b/accel-pppd/accel-ppp.conf.5 @@ -463,6 +463,10 @@ Specifies if an arbitrary source port is used when replying to a tunnel establishment request. When this option is deactivated, the destination port of the incoming request (SCCRQ) is used as source port for the reply (SCCRP). Default value is 0. +.TP +.BI "ppp-max-mtu=" n +Set the maximun MTU value that can be negociated for PPP over L2TP +sessions. Default value is 1420. .SH [radius] .br Configuration of RADIUS module. diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 29ba76c..b4b20b7 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -48,9 +48,12 @@ #define STATE_FIN 9 #define STATE_CLOSE 0 +#define DEFAULT_PPP_MAX_MTU 1420 + int conf_verbose = 0; int conf_hide_avps = 0; int conf_avp_permissive = 0; +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; @@ -878,7 +881,7 @@ static struct l2tp_sess_t *l2tp_tunnel_alloc_session(struct l2tp_conn_t *conn) sess->ctrl.started = l2tp_ppp_started; sess->ctrl.finished = l2tp_ppp_finished; sess->ctrl.terminate = ppp_terminate; - sess->ctrl.max_mtu = 1420; + sess->ctrl.max_mtu = conf_ppp_max_mtu; sess->ctrl.mppe = conf_mppe; sess->ctrl.calling_station_id = _malloc(17); sess->ctrl.called_station_id = _malloc(17); @@ -3813,6 +3816,12 @@ static void load_config(void) if (opt && atoi(opt) > 0) conf_retransmit = atoi(opt); + opt = conf_get_opt("l2tp", "ppp-max-mtu"); + if (opt && atoi(opt) > 0) + conf_ppp_max_mtu = atoi(opt); + else + conf_ppp_max_mtu = DEFAULT_PPP_MAX_MTU; + opt = conf_get_opt("l2tp", "host-name"); if (opt) conf_host_name = opt; -- cgit v1.2.3