summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSam Protsenko <semen.protsenko@linaro.org>2018-12-14 19:59:21 +0200
committerDavid S. Miller <davem@davemloft.net>2018-12-15 23:28:19 -0800
commitc151acc6e9ffa08972aa20d8bc07a66081922c1e (patch)
tree60e9e0d9fc2b5f78eb3102197580254f9aa65479 /net
parent63de273f34b5eeb5ead8440f20516fae9b7b1165 (diff)
downloadlinux-stable-c151acc6e9ffa08972aa20d8bc07a66081922c1e.tar.gz
linux-stable-c151acc6e9ffa08972aa20d8bc07a66081922c1e.tar.bz2
linux-stable-c151acc6e9ffa08972aa20d8bc07a66081922c1e.zip
l2tp: Add protocol field decompression
When Protocol Field Compression (PFC) is enabled, the "Protocol" field in PPP packet will be received without leading 0x00. See section 6.5 in RFC 1661 for details. So let's decompress protocol field if needed, the same way it's done in drivers/net/ppp/pptp.c. In case when "nopcomp" pppd option is not enabled, PFC (pcomp) can be negotiated during LCP handshake, and L2TP driver in kernel will receive PPP packets with compressed Protocol field, which in turn leads to next error: Protocol Rejected (unsupported protocol 0x2145) because instead of Protocol=0x0021 in PPP packet there will be Protocol=0x21. This patch unwraps it back to 0x0021, which fixes the issue. Sending the compressed Protocol field will be implemented in subsequent patch, this one is self-sufficient. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/l2tp/l2tp_ppp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index 04d9946dcdba..c03c6461f236 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -236,6 +236,10 @@ static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int
skb->data[1] == PPP_UI)
skb_pull(skb, 2);
+ /* Decompress protocol field if PFC is enabled */
+ if ((*skb->data) & 0x1)
+ *(u8 *)skb_push(skb, 1) = 0;
+
if (sk->sk_state & PPPOX_BOUND) {
struct pppox_sock *po;