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/ctrl/l2tp/l2tp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'accel-pppd/ctrl') 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