RE: [PATCH] Bpf Helper Function BPF_FUNC_skb_change_dsfield
From: Tyler Wear (QUIC) <hidden>
Date: 2021-12-21 19:16:45
Also in:
netdev
On Mon, Dec 20, 2021 at 07:18:42PM -0800, Yonghong Song wrote:quoted
On 12/20/21 12:40 PM, Tyler Wear wrote:quoted
New bpf helper function BPF_FUNC_skb_change_dsfield "int bpf_skb_change_dsfield(struct sk_buff *skb, u8 mask, u8 value)". BPF_PROG_TYPE_CGROUP_SKB typed bpf_prog which currently can be attached to the ingress and egress path. The helper is needed because this type of bpf_prog cannot modify the skb directly. Used by a bpf_prog to specify DS field values on egress or ingress.Maybe you can expand a little bit here for your use case? I know DS field might help but a description of your actual use case will make adding this helper more compelling.+1. More details on the use case is needed. Also, having an individual helper for each particular header field is too specific. For egress, there is bpf_setsockopt() for IP_TOS and IPV6_TCLASS and it can be called in other cgroup hooks. e.g. BPF_PROG_TYPE_SOCK_OPS during tcp ESTABLISHED event. There is an example in tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c. Is it enough for egress?
Using bpf_setsockopt() has 2 issues: 1) it changes the userspace visible state 2) won't work with udp sendmsg cmsg