Add mp_mrru option

Some equipments seem not able to actually put options in Configure-Reject
messages, so we then have to disable MRRU by hand.
This commit is contained in:
Samuel Thibault 2022-11-03 13:27:51 +01:00
parent b3b5fc5c59
commit 8e7bfa9a77
6 changed files with 29 additions and 4 deletions

View file

@ -233,6 +233,14 @@ MTU of interface for L2TP traffic (default: 1500). Used to set link MRU and adju
\f[R]
.fi
.PP
\f[B]mp_mrru\f[R] (int)
.IP
.nf
\f[C]
MRRU for MP traffic (default: 1614). Can be set to 0 to disable MP negociation.
\f[R]
.fi
.PP
\f[B]l2tp_secret\f[R] (string)
.PP
The secret used by l2tpns for authenticating tunnel request.

View file

@ -150,6 +150,10 @@ should be set by a line like: set configstring \"value\" set ipaddress
: MTU of interface for L2TP traffic (default: `1500`). Used to set
link MRU and adjust TCP MSS.
`mp_mrru` (int)
: MRRU for MP traffic (default: `1614`). Can be set to 0 to disable MP negociation.
`ppp_restart_time` (int); `ppp_max_configure` (int); `ppp_max_failure` (int)
: PPP counter and timer values, as described in §4.1 of

View file

@ -16,6 +16,9 @@ set l2tp_secret "secret"
# MTU of interface for L2TP traffic
#set l2tp_mtu 1500
# MRRU for MP traffic
#set l2tp_mtu 1614
# PPP counter and timer values
#set ppp_restart_time 3
#set ppp_max_configure 10

View file

@ -129,6 +129,7 @@ config_descriptt config_values[] = {
CONFIG("random_device", random_device, STRING),
CONFIG("l2tp_secret", l2tp_secret, STRING),
CONFIG("l2tp_mtu", l2tp_mtu, INT),
CONFIG("mp_mrru", mp_mrru, INT),
CONFIG("ppp_restart_time", ppp_restart_time, INT),
CONFIG("ppp_max_configure", ppp_max_configure, INT),
CONFIG("ppp_max_failure", ppp_max_failure, INT),
@ -3285,8 +3286,11 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr, uint16_t indexu
sess_local[s].ppp_mru = MRU;
// Set multilink options before sending initial LCP packet
sess_local[s].mp_mrru = 1614;
sess_local[s].mp_epdis = ntohl(config->iftun_address ? config->iftun_address : my_address);
sess_local[s].mp_mrru = config->mp_mrru;
if (config->mp_mrru)
sess_local[s].mp_epdis = ntohl(config->iftun_address ? config->iftun_address : my_address);
else
sess_local[s].mp_epdis = 0;
sendlcp(s, t);
change_state(s, lcp, RequestSent);
@ -5393,6 +5397,8 @@ static void update_config()
else if (config->l2tp_mtu < MINMTU) config->l2tp_mtu = MINMTU;
else if (config->l2tp_mtu > MAXMTU) config->l2tp_mtu = MAXMTU;
if (config->mp_mrru < 0) config->mp_mrru = 1614; // default
// reset MRU/MSS globals
MRU = config->l2tp_mtu - L2TP_HDRS;
if (MRU > PPPoE_MRU)

View file

@ -684,6 +684,7 @@ typedef struct
char l2tp_secret[64]; // L2TP shared secret
int l2tp_mtu; // MTU of interface used for L2TP
int mp_mrru; // MRRU of MP
char random_device[256]; // random device path, defaults to RANDOMDEVICE

View file

@ -661,8 +661,11 @@ static void pppoe_recv_PADR(uint8_t *pack, int size)
sess_local[sid].ppp_mru = MRU;
// Set multilink options before sending initial LCP packet
sess_local[sid].mp_mrru = 1614;
sess_local[sid].mp_epdis = ntohl(config->iftun_address ? config->iftun_address : my_address);
sess_local[sid].mp_mrru = config->mp_mrru;
if (config->mp_mrru)
sess_local[sid].mp_epdis = ntohl(config->iftun_address ? config->iftun_address : my_address);
else
sess_local[sid].mp_epdis = 0;
memcpy(session[sid].src_hwaddr, ethhdr->h_source, ETH_ALEN);
pppoe_send_PADS(sid, ethhdr->h_source, host_uniq_tag, relay_sid_tag, service_name_tag);