Re: [PATCH net-next v1 07/15] bpf: don't redirect decrypted skbs from egress to ingress
From: Daniel Borkmann
Date: Wed Nov 18 2026 - 13:27:23 EST
On 11/18/26 6:46 PM, Todd Bert Freed wrote:
+ /* On transmit, decrypted asks the device to encrypt the packet. Sent
+ * to ingress, the packet would read as decrypted by the device.
+ */
+ if (unlikely((flags & BPF_F_INGRESS) && !skb_at_tc_ingress(skb) &&
+ skb_is_decrypted(skb))) {
+ kfree_skb(skb);
+ return -EINVAL;
This check should rather live in the bpf_redirect (and friends) helper e.g. after
we check for invalid params, etc, rather than here which feels off. Also, it would
probably make sense to refactor this condition into a small inline helper so you
don't have to open code it multiple times.
Sounds good I will move this check into the two callers
(bpf_clone_redirect() and
skb_do_redirect()) under a helper.
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;
/* 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;
ri = bpf_net_ctx_get_ri();
ri->flags = flags;
FYI this patch was moved to the net series "net: don't redirect
decrypted skbs to
ingress, psp time-wait validator", so you will see this applied to v3 there.
-Todd