From nobody Tue Apr 7 12:52:09 2026 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81AB32EA159 for ; Fri, 13 Mar 2026 03:47:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773373662; cv=none; b=YimuibrGCPJKYXUq3PIuNAaeyGXmMga7B61Bjg0zUKRMRQIRlAfiY2AOlPIf0FrxEIQzabQQA8BNv5m7EvwZ+xFDiL4A/RuXHC53tbBA9A+7BE8W5F2qk42cTp3K45RB4UUnxWjVSxakPx8ftxHAFGDitATmt/6V5cNUluaV8H0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773373662; c=relaxed/simple; bh=/4gcq8LShB8D0c5s2jFOvaAMKwtDoLawyFz3nOQjuLU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=WKVvwKbnQ4u7Yw+pH2zwuFadmfPN1GF79J2/RKTatSvbkwrSQaXyCda68klGexj6OHMfSodmZpRq91vYqD6n9mBOhq6mBXID83QtwvC/v6x2C1rxZybBcEYVYQhSnPsXxLxMdgUIqBT8nXeSPjFz+5e3njo6DP2OYxHRS/vingE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VIxO6L4v; arc=none smtp.client-ip=209.85.208.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VIxO6L4v" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-662b933f8d1so2893465a12.2 for ; Thu, 12 Mar 2026 20:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773373660; x=1773978460; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=INglkRyjzET0z5aJCRl/lBzILAwHGEvu+nMDhJsrwlg=; b=VIxO6L4vyy3roWMrX2etPjhzkvIe9/K98Yo3iA/gQSQwVzuoOA6JD+dOOVaViStjge kedSqrEK3qiY+blXlZHfzrapJZGoNvb/QCXeQ30fDXZYh0e66+mIBxMqKMwOuPemGK3W mWcsCEyIpauB+8GX+mCeiCfzOLy+6dsNWhTIuKBFEMDt9zFIGkJDSn2eHXNpd9fY3UXN clFMruJEsFSu1a0zMDqxSZ/bxKmrO3R/TmPYW7UBKTquuwzTegbuU7iXuixYGS3W/dxH xh6JiYQ2p2hul0CAyOJLlhYpXANYsxWO+MmF66Cip/PuXzLDrSHVEyUUl3yQjMAK29GG dDAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773373660; x=1773978460; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=INglkRyjzET0z5aJCRl/lBzILAwHGEvu+nMDhJsrwlg=; b=Rr0S+5NsurfE5NRddS/CuHxttDayRNKLuygAmAwesXlh2oMXHjFWg02N+sbzArx1Hg pM4yOdAn72Amp7RNW9XMgsAMpMfCKR6Qp/YQ0+CN5lRKBiqXnvMNHXJp3b5hsW4C5ivS 3umcBboI7kuiiDKLnsThOlAAK8fb6tciVtdQXVjx54D/tX1EHIrr5Y4dhp9LtojrfuvA vpRpe5ZHggEV35j9xH+O1q/JNPlWFJJySrN76l3Wxhn3fQM/5SCNENTMZKQ++V/PjXiT Yag+upPleeUoB4/Bj5UdBDGIKXKRvTty9qfAC5dkiGcxMunx2SaEzSVwzQep4o+yqTHw BIEA== X-Forwarded-Encrypted: i=1; AJvYcCX7rGAfNmTlauxPYG2pPkvuJXaCPlGxNT2eU16R8AZQC8sIngAPoUcWjlBDfNPRYs3w6QKzuassZsSZlUE=@vger.kernel.org X-Gm-Message-State: AOJu0YyoSfbnDO1g8B83cdhYP1qAIVL1t+OZXkRuWzRxKyQY8e5JhOIK tqLe1YK5rvucBj35xsregfHvNfEudbz3QbxIy3EdHFCjDlSllrimvGYo X-Gm-Gg: ATEYQzyRqa6sfdPG0iI9INEIROwsEndByUgXXHMc3f0nNzM/6c5T8ESRocPKBGvzQ86 dNPH4ppM07Pcv9rYbhvYA6NjnMk31S5L6SaDlt5IT1pCW7OUDyCe8pdskc3YxZ/g87MMmjtvIYz h9tQHEktrDyd5aCI6YwpelOIHNHMd6R9RTWwZYUYXtDhJe2GRfjQDFK0sqMOHXgodznbR3yXNbJ VDKzh1zY2OUkdvb2Cp62ffAHO2AZiL84QtyjaPpKMngYdf10SQhyXhEETpVrKD0SywMYCUUtAdW tyP6GVN+8AmxRF4vM5E4zOTaYaryvlyJlhjlsr30G2ISHDqihdQkw/9ty8Eoao7XzX3p117ki3n oqTfYTWHYtsjJpmICcbS1bzaPJUw/v+mmWKHgb3ykIjr2koyFB4Jsx10Jsyas8SMkWosH+ZlbcF 6vCDI= X-Received: by 2002:a05:6402:1ec8:b0:660:eabc:9c70 with SMTP id 4fb4d7f45d1cf-663bac0452amr977150a12.29.1773373659478; Thu, 12 Mar 2026 20:47:39 -0700 (PDT) Received: from gmail.com ([2a09:bac5:4e25:2e3c::49b:47]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6635088ffb8sm924271a12.22.2026.03.12.20.47.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2026 20:47:39 -0700 (PDT) From: Qingfang Deng To: linux-ppp@vger.kernel.org, James Chapman , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net] l2tp: ppp: use max L2TP header size for PPP channel hdrlen Date: Fri, 13 Mar 2026 11:47:31 +0800 Message-ID: <20260313034732.209792-1-dqfext@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" chan.hdrlen is read once at channel registration by ppp_register_net_channel(), and used to set the PPP net device's hard_header_len. It was set to PPPOL2TP_L2TP_HDR_SIZE_NOSEQ (6), which is 4 bytes too small if sequence numbers are later enabled via setsockopt(PPPOL2TP_SO_SENDSEQ), causing unnecessary skb reallocations on the TX path. The setsockopt handler attempted to change netdev's hard_header_len by updating chan.hdrlen, but the PPP layer never re-reads it after the registration, so the update had no effect. Set chan.hdrlen to PPPOL2TP_L2TP_HDR_SIZE_SEQ (10) unconditionally at registration and remove the ineffective update in setsockopt. Fixes: 3557baabf280 ("[L2TP]: PPP over L2TP driver core") Signed-off-by: Qingfang Deng --- net/l2tp/l2tp_ppp.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index ae4543d5597b..99d6582f41de 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -787,11 +787,12 @@ static int pppol2tp_connect(struct socket *sock, stru= ct sockaddr_unsized *userva goto out_no_ppp; } =20 - /* The only header we need to worry about is the L2TP - * header. This size is different depending on whether - * sequence numbers are enabled for the data channel. + /* Reserve enough headroom for the L2TP header with sequence numbers, + * which is the largest possible. This is used by the PPP layer to set + * the net device's hard_header_len at registration, which must be + * sufficient regardless of whether sequence numbers are enabled later. */ - po->chan.hdrlen =3D PPPOL2TP_L2TP_HDR_SIZE_NOSEQ; + po->chan.hdrlen =3D PPPOL2TP_L2TP_HDR_SIZE_SEQ; =20 po->chan.private =3D sk; po->chan.ops =3D &pppol2tp_chan_ops; @@ -1176,12 +1177,6 @@ static int pppol2tp_session_setsockopt(struct sock *= sk, break; } session->send_seq =3D !!val; - { - struct pppox_sock *po =3D pppox_sk(sk); - - po->chan.hdrlen =3D val ? PPPOL2TP_L2TP_HDR_SIZE_SEQ : - PPPOL2TP_L2TP_HDR_SIZE_NOSEQ; - } l2tp_session_set_header_len(session, session->tunnel->version, session->tunnel->encap); break; --=20 2.43.0