Article View: linux.kernel.netdev
Article #3967Re: [PATCH net-next v2 6/7] net: add ip4_parse()
From: Björn Töpel
Date: Fri, 16 Oct 2026 11:56
Date: Fri, 16 Oct 2026 11:56
15 lines
6640 bytes
6640 bytes
"Michael S. Tsirkin" <mst@redhat.com> writes: > Multiple places in the net stack open-code the same minimal IPv4 header > validation: pull the fixed header, check version 4 and IHL >= 5 (where 5 > is the fixed header size in 32-bit units) - and locate the transport > header at IHL * 4 past the network header. > > Add a helper for doing that: it returns the validated header and > the transport header offset, or NULL if truncated or malformed. > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > Assisted-by: LLM Reviewed-by: Björn Töpel <bjorn@kernel.org>
Technical Details
Message-ID:
<87h5il506b.fsf@all.your.base.are.belong.to.us>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347315-linux-kernel-netdev=dewy.ruReferences:
<cover.1792067836.git.mst@redhat.com> <2645c102b2f73292d1973b82c95def24e48064e1.1792067836.git.mst@redhat.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347315-linux-kernel-netdev=dewy.ru From: bjorn@kernel.org (Björn Töpel) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 6/7] net: add ip4_parse() Date: Fri, 16 Oct 2026 13:56:12 +0200 Organization: Usenet Network Message-ID: <87h5il506b.fsf@all.your.base.are.belong.to.us> References: <cover.1792067836.git.mst@redhat.com> <2645c102b2f73292d1973b82c95def24e48064e1.1792067836.git.mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="2754712"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:kEw1E4gWe3EyiNJ31MG8yqYE/4M= sha256:kY8QQ3RE2P62g2Tm0vvfA2pufZ4Oz0TWzNI9KN37voo= sha1:3j57IayZsHkmCWj7fyrkmSCbMN8= sha256:UDP7ZDo3HXVaAr2D7o8FceXXRL9Ud3mIeh3gBIh2Idw= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id A7D46110510; Fri, 16 Oct 2026 14:56:33 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -1.34 X-Spam-Status: No, score=-1.34 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XnLgP3tpU77u; Fri, 16 Oct 2026 14:56:31 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-347315-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 8C2F81104FA; Fri, 16 Oct 2026 14:56:21 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sin.lore.kernel.org (Postfix) with ESMTP id 6445D2A8F4; Fri, 16 Oct 2026 11:56:18 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 699654772BF; Fri, 16 Oct 2026 11:56:16 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="D8d8CjKV" X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 682CA2367B8; Fri, 16 Oct 2026 11:56:15 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792151776; cv=none; b=eAyZ17W8/Ftvh2fIGqq4Gb/eQYDwTMubLOnjgwbtnL1hK1x7QH0t1GxoH7QVsTPc5dWF8n7Z9e0jpI+AhBemibw18+08esuSBOHtwjw5CYX6lSs9drtifRVr1PPmhmcDwoZAcY00QpIiVAUMN283JvnqDA86mNqndSy1G/t1Rio= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792151776; c=relaxed/simple; bh=HyzdCibjmBuu+Mz4LlCW22CV/VlkMRvQdGIUrWUb808=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=Fvkkkbk1gZjiOtANUxkEUTV3v2gByYmvPu0WUWiqb+L4pgpXV4wVdu+67zebqVud0d+TaOn95vm12To8Ap87sNRaLHNDqsUjp7DWHfqMwRafuYlK1TkrycofcxZ0+Ql15ede8OH+d56bsAPttK6zhzj3exw6MkSJwi29Zq9UxYo= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=D8d8CjKV; arc=none smtp.client-ip=100.103.45.18 X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B6E11F000C4; Fri, 16 Oct 2026 11:56:14 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792151775; bh=HyzdCibjmBuu+Mz4LlCW22CV/VlkMRvQdGIUrWUb808=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=D8d8CjKVNhFOL0ZW1vZLe5n6wQ26trtMwAg7EsG7zapwri+Lvwj4ZOE4hvFVMQmae uMoWfwfoupMlrD2ucAt7Sb9Ir/vw8aWgvP9YS9YaZdfUrcuWVi2spo7Yv4Z3jUa+ww Q14d6WGAlfruoisaThHdRqgl7y/bIm2dnYy4kmUwrNwmS0R97jLrjB6HOio6fLFOlb 9NQvrHi8gKQWFpGPU/anFZRUBWpwyBLvRX/5w37LnJ/+W7Tm0yt9ZeMNxI/YxrGx0O FOnNVlLlIVBEP+gJyGCU3i3dDiY35OtyGMC7McI+O/NZBteKjHyNdeW+BxOgW2d1zT tPHSuBr9nTxZA== X-Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>, Jason Wang <jasowangio@gmail.com>, Eugenio Pérez <eperezma@redhat.com>, Xuan Zhuo <xuanzhuo@linux.alibaba.com>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org, virtualization@lists.linux.dev, Rusty Russell <rusty@rustcorp.com.au>, Max Krasnyansky <maxk@qualcomm.com>, Pablo Neira Ayuso <pablo@netfilter.org>, Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>, Nikolay Aleksandrov <razor@blackwall.org>, Ido Schimmel <idosch@nvidia.com>, Simon Horman <horms@kernel.org>, David Ahern <dsahern@kernel.org>, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, bridge@lists.linux.dev X-In-Reply-To: <2645c102b2f73292d1973b82c95def24e48064e1.1792067836.git.mst@redhat.com> X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>