Hi Lorenzo,
On Fri, Nov 07, 2025 at 12:14:47PM +0100, Lorenzo Bianconi wrote: [...]
@@ -565,8 +622,9 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb, dir = tuplehash->tuple.dir; flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
- other_tuple = &flow->tuplehash[!dir].tuple;
- if (nf_flow_encap_push(skb, &flow->tuplehash[!dir].tuple) < 0)
- if (nf_flow_encap_push(state->net, skb, other_tuple)) return NF_DROP;
switch (tuplehash->tuple.xmit_type) { @@ -577,7 +635,9 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb, flow_offload_teardown(flow); return NF_DROP; }
neigh = ip_neigh_gw4(rt->dst.dev, rt_nexthop(rt, flow->tuplehash[!dir].tuple.src_v4.s_addr));
dest = other_tuple->tun_num ? other_tuple->tun.src_v4.s_addr: other_tuple->src_v4.s_addr;
I think this can be simplified if my series use the ip_hdr(skb)->daddr for rt_nexthop(), see attached patch. This would be fetched _before_ pushing the tunnel and layer 2 encapsulation headers. Then, there is no need to fetch other_tuple and check if tun_num is greater than zero.
See my sketch patch, I am going to give this a try, if this is correct, I would need one more iteration from you.