From e8013077389e9b4744f15a4cb1bac3e56c45485e Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Tue, 20 Oct 2020 02:53:46 +0200 Subject: [PATCH] PPP: set mtu6 too when setting PPP netif MTU PPP peer can negotiate its MRU, therefore we don't know the MTU we are going to use before starting PPP. This is an issue because netif_add function assume that the netif init callback function will set the MTU, netif_add will then copy mtu to mtu6. We have then to update mtu6 each time we update mtu to keep them in sync. Doing so is fine because PPP netif MTU is only updated when the netif is in link down state. --- src/netif/ppp/ppp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index 56b4f724..7d16f7fa 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -1323,6 +1323,9 @@ int sifnpmode(ppp_pcb *pcb, int proto, enum NPmode mode) { void ppp_netif_set_mtu(ppp_pcb *pcb, int mtu) { pcb->netif->mtu = mtu; +#if PPP_IPV6_SUPPORT && LWIP_ND6_ALLOW_RA_UPDATES + pcb->netif->mtu6 = mtu; +#endif /* PPP_IPV6_SUPPORT && LWIP_ND6_ALLOW_RA_UPDATES */ PPPDEBUG(LOG_INFO, ("ppp_netif_set_mtu[%d]: mtu=%d\n", pcb->netif->num, mtu)); }