[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7ad2677d-06c9-4bfc-8801-66379005f72e@gmail.com>
Date: Tue, 2 Sep 2025 23:10:09 -0400
From: Daniel Zahka <daniel.zahka@...il.com>
To: Paolo Abeni <pabeni@...hat.com>, Donald Hunter <donald.hunter@...il.com>,
Jakub Kicinski <kuba@...nel.org>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Simon Horman <horms@...nel.org>,
Jonathan Corbet <corbet@....net>, Andrew Lunn <andrew+netdev@...n.ch>
Cc: Saeed Mahameed <saeedm@...dia.com>, Leon Romanovsky <leon@...nel.org>,
Tariq Toukan <tariqt@...dia.com>, Boris Pismenny <borisp@...dia.com>,
Kuniyuki Iwashima <kuniyu@...gle.com>, Willem de Bruijn
<willemb@...gle.com>, David Ahern <dsahern@...nel.org>,
Neal Cardwell <ncardwell@...gle.com>, Patrisious Haddad
<phaddad@...dia.com>, Raed Salem <raeds@...dia.com>,
Jianbo Liu <jianbol@...dia.com>, Dragos Tatulea <dtatulea@...dia.com>,
Rahul Rameshbabu <rrameshbabu@...dia.com>,
Stanislav Fomichev <sdf@...ichev.me>,
Toke Høiland-Jørgensen <toke@...hat.com>,
Alexander Lobakin <aleksander.lobakin@...el.com>,
Kiran Kella <kiran.kella@...adcom.com>,
Jacob Keller <jacob.e.keller@...el.com>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v10 17/19] psp: provide decapsulation and receive
helper for drivers
On 9/2/25 6:28 AM, Paolo Abeni wrote:
> On 8/28/25 6:29 PM, Daniel Zahka wrote:
>> +/* Receive handler for PSP packets.
>> + *
>> + * Presently it accepts only already-authenticated packets and does not
>> + * support optional fields, such as virtualization cookies.
>> + */
>> +int psp_dev_rcv(struct sk_buff *skb, u16 dev_id, u8 generation, bool strip_icv)
>> +{
>> + const struct psphdr *psph;
>> + int depth = 0, end_depth;
>> + struct psp_skb_ext *pse;
>> + struct ipv6hdr *ipv6h;
>> + struct ethhdr *eth;
>> + int encap_bytes;
>> + __be16 proto;
>> +
>> + eth = (struct ethhdr *)(skb->data);
>> + proto = __vlan_get_protocol(skb, eth->h_proto, &depth);
>> + if (proto != htons(ETH_P_IPV6))
>> + return -EINVAL;
>> +
>> + ipv6h = (struct ipv6hdr *)(skb->data + depth);
>> + depth += sizeof(*ipv6h);
>> + end_depth = depth + sizeof(struct udphdr) + sizeof(struct psphdr);
> Why aren't you checking the next hdr being UDP? This could potentially
> match unrelated packets.
This assumes the caller knows the packet is psp transport mode packet,
which I think could be a reasonable API given that all psp
implementations probably involve parsing packets in hw. I will update
this patch to properly support IPv4, though.
>
> Also I guess you need pskb_may_pull() above.
we check for: end_depth > skb_headlen(skb). If you prefer
pskb_may_pull(), I can change it.
Powered by blists - more mailing lists