Re: [PATCH net-next v1 07/15] bpf: don't redirect decrypted skbs from egress to ingress
From: Todd Bert Freed
Date: Wed Nov 18 2026 - 14:15:33 EST
> But why under skb_do_redirect? I meant just here:
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 532405988fd9..ba112111de22 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -2471,6 +2471,8 @@ BPF_CALL_3(bpf_clone_redirect, struct sk_buff *, skb, u32, ifindex, u64, flags)
>
> if (unlikely(flags & (~(BPF_F_INGRESS) | BPF_F_REDIRECT_INTERNAL)))
> return -EINVAL;
> + if (...cond...)
> + return -EOPNOTSUPP;
Yep we are on the same page for this one.
> /* BPF test infra's convert___skb_to_skb() can create type-less
> * GSO packets. gso_features_check() will detect this as a bad
> @@ -2563,6 +2565,8 @@ BPF_CALL_2(bpf_redirect, u32, ifindex, u64, flags)
> if (unlikely(!bpf_net_ctx_get() ||
> (flags & (~(BPF_F_INGRESS) | BPF_F_REDIRECT_INTERNAL))))
> return TC_ACT_SHOT;
> + if (...cond...)
> + return TC_ACT_SHOT;
bpf_redirect() does not see the skb, so it can't check skb->decrypted.
After the program has returned TC_ACT_REDIRECT and
skb_do_redirect() is called, is the earliest point at which the policy
can be enforced.
-Todd