lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aH4pwa2PmzwRvMA5@strlen.de>
Date: Mon, 21 Jul 2025 13:51:29 +0200
From: Florian Westphal <fw@...len.de>
To: Lorenzo Bianconi <lorenzo@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
	David Ahern <dsahern@...nel.org>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Simon Horman <horms@...nel.org>,
	Pablo Neira Ayuso <pablo@...filter.org>,
	Jozsef Kadlecsik <kadlec@...filter.org>,
	Shuah Khan <shuah@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
	netdev@...r.kernel.org, netfilter-devel@...r.kernel.org,
	coreteam@...filter.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH nf-next v4 1/2] net: netfilter: Add IPIP flowtable SW
 acceleration

Lorenzo Bianconi <lorenzo@...nel.org> wrote:
> > Lorenzo Bianconi <lorenzo@...nel.org> wrote:
> > > +static bool nf_flow_ip4_encap_proto(struct sk_buff *skb, u16 *size)
> > > +{
> > > +	struct iphdr *iph;
> > > +
> > > +	if (!pskb_may_pull(skb, sizeof(*iph)))
> > > +		return false;
> > 
> > Nit: I think this could be 2 * sizeof() and a comment that we will
> > also need the inner ip header later, might save one reallocation.
> 
> nf_flow_ip4_encap_proto() is used even for plain IP traffic but I guess we can
> assume the IP payload is at least 20B, right?

Oh, right, I missed that.  But even if we have a.g. ip header with icmp
header, then the postconditions are the same, no?

as-is:
pskb_may_pull -> ok, then iph->protocol == IPPROTO_IPIP -> return false

with 2*iph:
pskb_may_pull -> return false

... but I'll leave it up to you, if you prefer pskb_may_pull(skb, sizeof(*iph)))
for clarity then lets keep it as-is.

> > > +	iph = (struct iphdr *)skb_network_header(skb);
> > > +	*size = iph->ihl << 2;
> > 
> > I think this should be sanity tested vs. sizeof(iph).
> 
> I guess this is already done in ip_has_options(), agree?

Indeed it is!  Nevermind then :-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ