From 19864a4a085cec256a44134050a6364b1cc1f0ad Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Sat, 25 Aug 2012 18:15:15 +0200 Subject: [PATCH] PPP L2TP, only skip HDLC header 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. --- src/netif/ppp/pppol2tp.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/netif/ppp/pppol2tp.c b/src/netif/ppp/pppol2tp.c index 3a8eb7d8..fe5badf1 100644 --- a/src/netif/ppp/pppol2tp.c +++ b/src/netif/ppp/pppol2tp.c @@ -316,8 +316,16 @@ static void pppol2tp_input(void *arg, struct udp_pcb *pcb, struct pbuf *p, struc PPPDEBUG(LOG_DEBUG, ("pppol2tp: session ID mismatch, assigned=%d, received=%d\n", l2tp->remote_session_id, session_id)); goto free_and_return; } - /* skip address & flags */ - pbuf_header(p, -(s16_t)2); + /* + * 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. + */ + GETSHORT(hflags, inp); + if (hflags == 0xff03) { + pbuf_header(p, -(s16_t)2); + } /* Dispatch the packet thereby consuming it. */ ppp_input(l2tp->ppp, p); return;