From 499677627fb95c6b0de60f94680781dfcdfd2703 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 23 Mar 2025 19:06:07 +0100 Subject: [PATCH] l2tp: Expose a control receive window > 4 The default 4 is really small, and imposes very sequential processing of reconnections in case we lose all sessions. Nowadays we easily have memory for a lot more. --- l2tpns.c | 2 ++ l2tpns.h | 1 + 2 files changed, 3 insertions(+) diff --git a/l2tpns.c b/l2tpns.c index 29c43fc..060f478 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -4759,6 +4759,7 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr, uint16_t indexu controls(c, 7, config->multi_n_hostname[tunnel[t].indexudp][0]?config->multi_n_hostname[tunnel[t].indexudp]:hostname, 1); // host name if (sendchalresponse) controlb(c, 13, sendchalresponse, 16, 1); // Send Challenge response control16(c, 9, t, 1); // assigned tunnel + control16(c, 10, CONTROLWIN, 1); // receive window size controladd(c, 0, t); // send the resply } else @@ -8589,6 +8590,7 @@ void lac_send_SCCRQ(tunnelidt t, uint8_t * auth, unsigned int auth_len) control16(c, 2, version, 1); // protocol version control32(c, 3, 3, 1); // framing Capabilities control16(c, 9, t, 1); // assigned tunnel + control16(c, 10, CONTROLWIN, 1); // receive window size controlb(c, 11, (uint8_t *) auth, auth_len, 1); // CHAP Challenge LOG(3, 0, t, "Sent SCCRQ to REMOTE LNS\n"); controladd(c, 0, t); // send diff --git a/l2tpns.h b/l2tpns.h index bc4e4cb..21c3cbb 100644 --- a/l2tpns.h +++ b/l2tpns.h @@ -42,6 +42,7 @@ #define T_FREE (0) // A tunnel ID that won't ever be used. Mark session as free. #define MAXCONTROL 1000 // max length control message we ever send... +#define CONTROLWIN 128 // receive window size, controls the maximum size of controlr #define MINMTU 576 // minimum recommended MTU (rfc1063) #define MAXMTU 2600 // arbitrary maximum MTU #define PPPoE_MRU 1492 // maximum PPPoE MRU (rfc2516: 1500 less PPPoE header (6) and PPP protocol ID (2))