* [PATCH] bpf: cg_skb add get classid helper
@ 2024-08-14 9:50 Feng zhou
2024-08-16 1:06 ` Martin KaFai Lau
0 siblings, 1 reply; 3+ messages in thread
From: Feng zhou @ 2024-08-14 9:50 UTC (permalink / raw)
To: martin.lau, daniel, john.fastabend, ast, andrii, eddyz87, song,
yonghong.song, kpsingh, sdf, haoluo, jolsa, davem, edumazet, kuba,
pabeni
Cc: netdev, linux-kernel, bpf, yangzhenze, wangdongdong.6,
zhoufeng.zf
From: Feng Zhou <zhoufeng.zf@bytedance.com>
At cg_skb hook point, can get classid for v1 or v2, allowing
users to do more functions such as acl.
Signed-off-by: Feng Zhou <zhoufeng.zf@bytedance.com>
---
net/core/filter.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/core/filter.c b/net/core/filter.c
index 78a6f746ea0b..d69ba589882f 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -8111,6 +8111,12 @@ cg_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
return &bpf_get_listener_sock_proto;
case BPF_FUNC_skb_ecn_set_ce:
return &bpf_skb_ecn_set_ce_proto;
+ case BPF_FUNC_get_cgroup_classid:
+ return &bpf_get_cgroup_classid_proto;
+#endif
+#ifdef CONFIG_CGROUP_NET_CLASSID
+ case BPF_FUNC_skb_cgroup_classid:
+ return &bpf_skb_cgroup_classid_proto;
#endif
default:
return sk_filter_func_proto(func_id, prog);
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bpf: cg_skb add get classid helper
2024-08-14 9:50 [PATCH] bpf: cg_skb add get classid helper Feng zhou
@ 2024-08-16 1:06 ` Martin KaFai Lau
2024-08-19 4:25 ` [External] " Feng Zhou
0 siblings, 1 reply; 3+ messages in thread
From: Martin KaFai Lau @ 2024-08-16 1:06 UTC (permalink / raw)
To: Feng zhou
Cc: daniel, john.fastabend, ast, andrii, eddyz87, song, yonghong.song,
kpsingh, sdf, haoluo, jolsa, davem, edumazet, kuba, pabeni,
netdev, linux-kernel, bpf, yangzhenze, wangdongdong.6
On 8/14/24 2:50 AM, Feng zhou wrote:
> From: Feng Zhou <zhoufeng.zf@bytedance.com>
>
> At cg_skb hook point, can get classid for v1 or v2, allowing
> users to do more functions such as acl.
>
> Signed-off-by: Feng Zhou <zhoufeng.zf@bytedance.com>
> ---
> net/core/filter.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 78a6f746ea0b..d69ba589882f 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -8111,6 +8111,12 @@ cg_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
> return &bpf_get_listener_sock_proto;
> case BPF_FUNC_skb_ecn_set_ce:
> return &bpf_skb_ecn_set_ce_proto;
> + case BPF_FUNC_get_cgroup_classid:
> + return &bpf_get_cgroup_classid_proto;
> +#endif
> +#ifdef CONFIG_CGROUP_NET_CLASSID
> + case BPF_FUNC_skb_cgroup_classid:
> + return &bpf_skb_cgroup_classid_proto;
With this bpf_skb_cgroup_classid_proto, is the above
bpf_get_cgroup_classid_proto necessary?
The cg_skb hook must have a skb->sk.
Please add a selftest and tag the subject with bpf-next.
pw-bot: cr
> #endif
> default:
> return sk_filter_func_proto(func_id, prog);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [External] Re: [PATCH] bpf: cg_skb add get classid helper
2024-08-16 1:06 ` Martin KaFai Lau
@ 2024-08-19 4:25 ` Feng Zhou
0 siblings, 0 replies; 3+ messages in thread
From: Feng Zhou @ 2024-08-19 4:25 UTC (permalink / raw)
To: Martin KaFai Lau
Cc: daniel, john.fastabend, ast, andrii, eddyz87, song, yonghong.song,
kpsingh, sdf, haoluo, jolsa, davem, edumazet, kuba, pabeni,
netdev, linux-kernel, bpf, yangzhenze, wangdongdong.6
在 2024/8/16 09:06, Martin KaFai Lau 写道:
> On 8/14/24 2:50 AM, Feng zhou wrote:
>> From: Feng Zhou <zhoufeng.zf@bytedance.com>
>>
>> At cg_skb hook point, can get classid for v1 or v2, allowing
>> users to do more functions such as acl.
>>
>> Signed-off-by: Feng Zhou <zhoufeng.zf@bytedance.com>
>> ---
>> net/core/filter.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/net/core/filter.c b/net/core/filter.c
>> index 78a6f746ea0b..d69ba589882f 100644
>> --- a/net/core/filter.c
>> +++ b/net/core/filter.c
>> @@ -8111,6 +8111,12 @@ cg_skb_func_proto(enum bpf_func_id func_id,
>> const struct bpf_prog *prog)
>> return &bpf_get_listener_sock_proto;
>> case BPF_FUNC_skb_ecn_set_ce:
>> return &bpf_skb_ecn_set_ce_proto;
>> + case BPF_FUNC_get_cgroup_classid:
>> + return &bpf_get_cgroup_classid_proto;
>> +#endif
>> +#ifdef CONFIG_CGROUP_NET_CLASSID
>> + case BPF_FUNC_skb_cgroup_classid:
>> + return &bpf_skb_cgroup_classid_proto;
>
> With this bpf_skb_cgroup_classid_proto, is the above
> bpf_get_cgroup_classid_proto necessary?
> The cg_skb hook must have a skb->sk.
Yes, just add bpf_skb_cgroup_classid_proto.
>
> Please add a selftest and tag the subject with bpf-next.
>
Will do, thanks.
> pw-bot: cr
>
>> #endif
>> default:
>> return sk_filter_func_proto(func_id, prog);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-19 4:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-14 9:50 [PATCH] bpf: cg_skb add get classid helper Feng zhou
2024-08-16 1:06 ` Martin KaFai Lau
2024-08-19 4:25 ` [External] " Feng Zhou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).