[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5cac050a-d67b-587f-411e-946117ba8324@linux.dev>
Date: Thu, 1 Dec 2022 23:40:20 -0800
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Eyal Birger <eyal.birger@...il.com>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org,
linux-kselftest@...r.kernel.org, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
steffen.klassert@...unet.com, herbert@...dor.apana.org.au,
andrii@...nel.org, daniel@...earbox.net, nicolas.dichtel@...nd.com,
razor@...ckwall.org, mykolal@...com, ast@...nel.org,
song@...nel.org, yhs@...com, john.fastabend@...il.com,
kpsingh@...nel.org, sdf@...gle.com, haoluo@...gle.com,
jolsa@...nel.org, shuah@...nel.org, liuhangbin@...il.com,
lixiaoyan@...gle.com
Subject: Re: [PATCH bpf-next,v3 2/4] xfrm: interface: Add unstable helpers for
setting/getting XFRM metadata from TC-BPF
On 12/1/22 1:14 PM, Eyal Birger wrote:
> +int bpf_skb_get_xfrm_info(struct __sk_buff *skb_ctx, struct bpf_xfrm_info *to)
> +{
> + struct sk_buff *skb = (struct sk_buff *)skb_ctx;
> + struct xfrm_md_info *info;
> +
> + memset(to, 0, sizeof(*to));
This zero-ing is also not needed. verifier ensures "to" is initialized before
calling this kfunc.
> +
> + info = skb_xfrm_md_info(skb);
> + if (!info)
> + return -EINVAL;
> +
> + to->if_id = info->if_id;
> + to->link = info->link;
> + return 0;
> +}
Powered by blists - more mailing lists