Skip to content

Commit

Permalink
bpf: nodeport: handle result from encap ctx_redirect() in revDNAT path
Browse files Browse the repository at this point in the history
When redirecting a packet into the tunnel, return the result of that
operation. Right now we're not reporting potential errors from the helper
call.

This will become more relevant with native XDP encapsulation, where
ctx_redirect() can also turn the CTX_REDIRECT into a XDP_TX.

Fixes: ff44164 ("bpf: Align rev_nodeport_lb{4,6} wrt egress GW tunnel mode")
Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
  • Loading branch information
julianwiedmann committed Apr 26, 2023
1 parent 5d0ee60 commit f41d69c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bpf/lib/nodeport.h
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ static __always_inline int rev_nodeport_lb6(struct __ctx_buff *ctx, __s8 *ext_er
ret = __encap_with_nodeid(ctx, tunnel_endpoint, SECLABEL, dst_id,
NOT_VTEP_DST, reason, monitor, &ifindex);
if (ret == CTX_ACT_REDIRECT)
ctx_redirect(ctx, ifindex, 0);
ret = ctx_redirect(ctx, ifindex, 0);
return ret;
#endif
}
Expand Down Expand Up @@ -2444,7 +2444,7 @@ static __always_inline int rev_nodeport_lb4(struct __ctx_buff *ctx, __s8 *ext_er
ret = __encap_with_nodeid(ctx, tunnel_endpoint, SECLABEL, dst_id,
NOT_VTEP_DST, reason, monitor, &ifindex);
if (ret == CTX_ACT_REDIRECT)
ctx_redirect(ctx, ifindex, 0);
ret = ctx_redirect(ctx, ifindex, 0);
return ret;
#endif
}
Expand Down

0 comments on commit f41d69c

Please sign in to comment.