selftests/bpf: reserve flags in bpf_skb_net_shrink
Subsystems (4)
PATCH 1/1 selftests/bpf: reserve flags in bpf_skb_net_shrink
From: Willem de Bruijn <[email protected]>
The ENCAP flags in bpf_skb_adjust_room are ignored on decap with bpf_skb_net_shrink. Reserve these bits for future use.
--- net/core/filter.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/filter.c +3 -0
@@ -3069,6 +3069,9 @@ static int bpf_skb_net_shrink(struct sk_buff *skb, u32 off, u32 len_diff, {int ret; +if (flags & ~BPF_F_ADJ_ROOM_FIXED_GSO ) +return -EINVAL ; +if (skb_is_gso (skb) && !skb_is_gso_tcp (skb)) {/* udp gso_size delineates datagrams, only allow if fixed */ if (!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) ||
Signature · 1 line
2.21.0.392.gf8f6787159e-goog
Quoted 7 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
The ENCAP flags in
bpf_skb_adjust_roomare ignored on decap withbpf_skb_net_shrink. Reserve these bits for future use.Fixes 868d523535c2d ("bpf: add bpf_skb_adjust_room encap flags")Signed-off-by Willem de Bruijn <[email protected]>
One thought; should we add a line to the growth-only flags in the description of bpf_skb_adjust_room (ENCAP_L[234]) in bpf.h; something like:
"This flag is valid for use with positive len_diff values only."
? Don't want to delay this patch with that suggestion though, I can spin that up later.
Quoted 22 lines
--- net/core/filter.c | 3 +++ 1 file changed, 3 insertions(+)net/core/filter.c +3
-0@@ -3069,6 +3069,9 @@ static int bpf_skb_net_shrink(struct sk_buff *skb, u32 off, u32 len_diff, {int ret; +if (flags & ~BPF_F_ADJ_ROOM_FIXED_GSO ) +return -EINVAL ; +if (skb_is_gso (skb) && !skb_is_gso_tcp (skb)) {/* udp gso_size delineates datagrams, only allow if fixed */ if (!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) ||Signature · 1 line
2.21.0.392.gf8f6787159e-goog
Quoted 5 lines · Alan Maguire
Quoted 2 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
Quoted 7 lines
Quoted 5 lines
The ENCAP flags in
bpf_skb_adjust_roomare ignored on decap withbpf_skb_net_shrink. Reserve these bits for future use.Fixes 868d523535c2d ("bpf: add bpf_skb_adjust_room encap flags")Signed-off-by Willem de Bruijn <[email protected]>Reviewed-by Alan Maguire <[email protected]>
Thanks Alan.
Quoted 5 lines
One thought; should we add a line to the growth-only flags in the description of
bpf_skb_adjust_room(ENCAP_L[234]) inbpf.h; something like:"This flag is valid for use with positive
len_diffvalues only."
That is easily gleaned from reading the code. I'm not a fan of documentation that duplicates concise readable code.
Plus, we'd add it and then remove again before long. We just need to implement the decap behavior. I actually maintain TC ingress decap code in C from that I wrote before eBPF and want to deprecate one day. But it will take some time to do properly.
Daniel Borkmann
maintainerQuoted 7 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
The ENCAP flags in
bpf_skb_adjust_roomare ignored on decap withbpf_skb_net_shrink. Reserve these bits for future use.Fixes 868d523535c2d ("bpf: add bpf_skb_adjust_room encap flags")Signed-off-by Willem de Bruijn <[email protected]>
Applied, thanks! I fixed up $SUBJECT since it's not selftests. ;-)
Quoted 19 lines
--- net/core/filter.c | 3 +++ 1 file changed, 3 insertions(+)net/core/filter.c +3
-0@@ -3069,6 +3069,9 @@ static int bpf_skb_net_shrink(struct sk_buff *skb, u32 off, u32 len_diff, {int ret; +if (flags & ~BPF_F_ADJ_ROOM_FIXED_GSO ) +return -EINVAL ; +if (skb_is_gso (skb) && !skb_is_gso_tcp (skb)) {/* udp gso_size delineates datagrams, only allow if fixed */ if (!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) ||
Quoted 11 lines · Daniel Borkmann
Quoted 7 lines · Willem de Bruijn
From: Willem de Bruijn <[email protected]>
The ENCAP flags in
bpf_skb_adjust_roomare ignored on decap withbpf_skb_net_shrink. Reserve these bits for future use.Fixes 868d523535c2d ("bpf: add bpf_skb_adjust_room encap flags")Signed-off-by Willem de Bruijn <[email protected]>Applied, thanks! I fixed up $SUBJECT since it's not selftests. ;-)
Ai, sorry about that :/ Thanks!