Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1881356imu; Sun, 16 Dec 2018 10:56:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/WODEZkVSAB7vIgqu7sE6fNulF1RNdxmXK0WJGp5K6yBLBAssxJqKeKoh51EWplP9rbnXp8 X-Received: by 2002:a17:902:4523:: with SMTP id m32mr10087611pld.53.1544986587985; Sun, 16 Dec 2018 10:56:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544986587; cv=none; d=google.com; s=arc-20160816; b=iiZgLIJgX0bcWlF7SHBDBdcPw2eDdAKdtfXQwlPCg7ynys0z4c6TkjfpQOq+5gnV/V CahG+BsbHI0rF5J+CDL1TXPLATuVxhvcueVzClDPYJJIdVs8+tXaxBzJSnzA/sXhKAeg TbR5CCvkPmJ4yc0ZRO0BBMMLKGfnYDw1qtgOa/1DGuhths9Cmvd+jEZSwyfRVqH5LAas rCVs9ngPiSX4p6dyxIVVHvx3XHH5cPMkJsCVYYKjXHIE+sYNPmZSOti3fTwUN6Ue2NQA ApooOCEW3dYzJuvINFSbNSP8h+c1SQUCWe23ENw7dBTwPT7YYb6KQvymRED4VF+JjvCX bOdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/qlCi1o59RtrnMq0dOxwqY3nCkhq9IXpKKbQNPLrpY4=; b=sNIm9OVAnu3ud2j9LqpiPOdfULEiomi4I9kOvMpcMJhqkqpPucqqqfiJrGCZ/OBGA8 iRIfet68dN55tBrK1FgXex0qixh0kmffM4M82uZWnQXr7lPkKkYfEy/Vw7LMRsN4misA vHdkf9sY+t1rTcgJMmVpOOLhOI7jsMnnXQOPdvgv9thfm3EXNcpBJOecosqNEAoTVSDD yg3rlS32OEgFbR/CaeXFfsZ/Mh4UbwE+W7tzO8l11gcf9Z7iZeSrjAUajRtVScX6djbQ gRYdU92aYH9VqANLFw+V2B716wFupK4BSjQT7fpJpoJ+4tyWyBsarOgguH0/OdpkDeJa a6Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SmfLzAnO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v25si9412485pfg.135.2018.12.16.10.56.13; Sun, 16 Dec 2018 10:56:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SmfLzAnO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730790AbeLPSg4 (ORCPT + 99 others); Sun, 16 Dec 2018 13:36:56 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:35261 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730686AbeLPSgz (ORCPT ); Sun, 16 Dec 2018 13:36:55 -0500 Received: by mail-wr1-f66.google.com with SMTP id 96so10106690wrb.2 for ; Sun, 16 Dec 2018 10:36:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/qlCi1o59RtrnMq0dOxwqY3nCkhq9IXpKKbQNPLrpY4=; b=SmfLzAnOVSxeqQBmKVTdWxo4BmpWklSmPFQBRCs9eVjVDYCHqfL1WG5FxuI77LfgCY cM2jbV3d15nBH0+U5cNvwZ3TKH+N3fehQUr/iOMeOY5+eEG1v0zzsCcpv/65yR0fBoEP ag69JeYdvfnMLA7G1wCMCsY/LeZnAziiGW5E8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/qlCi1o59RtrnMq0dOxwqY3nCkhq9IXpKKbQNPLrpY4=; b=GDxbZ7mrVeeDUQt73R5gnJeR0JvFwV3REy1bsYGVGZZmHR+44H2EZCTQV7bqWfb0lX MmrKJVbRNRYjoxgfzKwm60xv8g3zcDKW2FXVTzRyvfebIN3vkMTQFAo8mpREMs+OhI8V i+ek7axC4b4azDCWVHu+38vOHYOS6OOjVWmGVvylIMYmw2z7mcW7UBdiHfymc0/RFOEX +BrMCDBMA5r+xMoAV3wRz8+PSIJhCQV7oZf+4vzQUshBN5K676hS84tVoid6mr1AOz26 sspAR4ICbhPu7WSOCJe4f7bvv2DI4FLS4qbdwY2/gbJSXIBK1njBUcMdMxaD1tAEr2SS KVvQ== X-Gm-Message-State: AA+aEWbzrAREE3jNF446GXf6DamcAdPVD19Bzl7yJ7Y6YNRVYMzEy4c5 gushL2Bq1DQF/95jKpJiGDIlz0Dy8F2ml7CzZTayAQ== X-Received: by 2002:adf:9422:: with SMTP id 31mr9018031wrq.106.1544985413254; Sun, 16 Dec 2018 10:36:53 -0800 (PST) MIME-Version: 1.0 References: <20181214175921.6859-1-semen.protsenko@linaro.org> <20181216162605.qn2jjbyb2bgcbxgq@kdev> In-Reply-To: <20181216162605.qn2jjbyb2bgcbxgq@kdev> From: Sam Protsenko Date: Sun, 16 Dec 2018 20:36:42 +0200 Message-ID: Subject: Re: [PATCH] l2tp: Add protocol field decompression To: Guillaume Nault Cc: James Chapman , "David S. Miller" , netdev@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Guillaume, On Sun, Dec 16, 2018 at 6:29 PM Guillaume Nault wrote: > > On Fri, Dec 14, 2018 at 07:59:21PM +0200, Sam Protsenko wrote: > > 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 > > --- > > net/l2tp/l2tp_ppp.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > 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; > > + > Sorry, but PFC is PPP stuff. It's absolutely independent from the > transport layer. Therefore, it belongs to ppp_generic.c and L2TP has > nothing do with it. > > I know some other transports got it wrong, but let's stop > re-implementing PPP features in every lower layer. Teaching ppp_input() > about PFC is all that is needed to get the feature work correctly on > all transports. As a bonus, it'd bring PFC support to PPPoE and would > let us drop the duplicated code from pptp.c, ppp_async.c and > ppp_synctty.c. > > As an example of the problems caused by mixing the PPP and L2TP > layers, consider the case of L2TP sockets that aren't PPPOX_BOUND. > They're supposed to receive the original PPP frames. Now with your > patch if the protocol was compressed, the L2TP socket receives a fake > header. User space didn't ask for that and has no way to figure out > what was the original packet. To make things worse, that behaviour now > changes depending on the kernel version. > > If you all agree, can we please revert this patch and properly > implement PFC in ppp_generic.c? How about instead of reverting I will try to provide the patch extracting duplicated PFC code (from L2TP, PPTP, etc) to ppp_generic.c? This one fixes actual problem, and if we are going to add it to ppp_generic anyway, why not do it in one patch? I'm willing to do this work in next few days. Hope there is no rush with revert?