From 72d9132ecf758b32fb0ce6294654ecd5bf8e2209 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Fri, 23 Oct 2020 17:21:02 +0200 Subject: [PATCH] PPP, PPPoL2TP: skip address & flags for PPP control packets This is already what we inherently have always done for IPv4/IPv6 packets, so it works. Receivers must handle both cases anyway because both behaviors are seen in the wild. --- src/netif/ppp/pppol2tp.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/netif/ppp/pppol2tp.c b/src/netif/ppp/pppol2tp.c index 56838696..2a9a9b18 100644 --- a/src/netif/ppp/pppol2tp.c +++ b/src/netif/ppp/pppol2tp.c @@ -172,6 +172,9 @@ static err_t pppol2tp_write(ppp_pcb *ppp, void *ctx, struct pbuf *p) { LWIP_UNUSED_ARG(ppp); #endif /* MIB2_STATS */ + /* skip address & flags */ + pbuf_remove_header(p, 2); + ph = pbuf_alloc(PBUF_TRANSPORT, (u16_t)(PPPOL2TP_OUTPUT_DATA_HEADER_LEN), PBUF_RAM); if(!ph) { LINK_STATS_INC(link.memerr); @@ -463,8 +466,16 @@ static void pppol2tp_input(void *arg, struct udp_pcb *pcb, struct pbuf *p, const /* * skip address & flags if necessary * - * RFC 2661 does not specify whether the PPP frame in the L2TP payload should - * have a HDLC header or not. We handle both cases for compatibility. + * RFC 2661 (L2TPv2) does not specify whether the PPP frame in the L2TP payload + * should have a HDLC header or not, both behaviors are seen in the wild. + * + * On the other hand, L2TPv3 draft-ietf-l2tpext-l2tp-ppp versions 00 and 01 say + * it must be included, versions 02 to 05 say it must be omitted, and versions + * 06 and onwards say it should be omitted so it changed along the path when + * L2TPv3 was designed. Latest versions state that receivers must handle both + * cases. + * + * We handle both cases for compatibility. */ if (p->len >= 2) { GETSHORT(hflags, inp);