From 51c6548631dab543ecbb903e8644b73c54e5bdcd Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Mon, 19 Oct 2020 00:26:14 +0200 Subject: [PATCH] PPP: allow negotiating MRU with PPP_MRU config option PPP_MRU is now free to be used for what it should have been. Now using it at PPP init stage to set the wanted MRU value, triggering a MRU negotiation at the LCP phase. I doubt anyone needs it anyway, but, well, at least it is fixed and the MRU/MTU config mess is cleaned. And while we are at it, better document PPP MRU config values. --- src/include/netif/ppp/ppp_opts.h | 18 +++++++++++++++--- src/netif/ppp/lcp.c | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/include/netif/ppp/ppp_opts.h b/src/include/netif/ppp/ppp_opts.h index 8fe4a3ee..3d82cbf7 100644 --- a/src/include/netif/ppp/ppp_opts.h +++ b/src/include/netif/ppp/ppp_opts.h @@ -495,21 +495,33 @@ */ /** - * PPP_MRU: Default MRU + * PPP_MRU: MRU value we want to negotiate (peer MTU) + * + * It only affects PPPoS because PPPoE value is derived from the + * Ethernet interface MTU and PPPoL2TP have a separate setting. */ #ifndef PPP_MRU #define PPP_MRU 1500 #endif /** - * PPP_MAXMRU: Normally limit MRU to this (pppd default = 16384) + * PPP_MAXMRU: Normally limit peer MRU to this + * + * This is the upper limit value to which we set our interface MTU. + * If the peer sends a larger number, we will just ignore it as we + * are not required to maximize the use of the peer capacity. + * + * It only affects PPPoS because PPPoE value is derived from the + * Ethernet interface MTU and PPPoL2TP have a separate setting. */ #ifndef PPP_MAXMRU #define PPP_MAXMRU 1500 #endif /** - * PPP_MINMRU: No MRUs below this + * PPP_MINMRU: No peer MRUs below this + * + * Peer must be able to receive at least our minimum MTU. */ #ifndef PPP_MINMRU #define PPP_MINMRU 128 diff --git a/src/netif/ppp/lcp.c b/src/netif/ppp/lcp.c index eefdd314..9c550520 100644 --- a/src/netif/ppp/lcp.c +++ b/src/netif/ppp/lcp.c @@ -373,7 +373,7 @@ static void lcp_init(ppp_pcb *pcb) { BZERO(wo, sizeof(*wo)); wo->neg_mru = 1; - wo->mru = PPP_DEFMRU; + wo->mru = PPP_MRU; wo->neg_asyncmap = 1; wo->neg_magicnumber = 1; wo->neg_pcompression = 1;