Skip to content

Commit

Permalink
bpf: host: add drop notify for do_netdev_encrypt()
Browse files Browse the repository at this point in the history
do_netdev_encrypt_encap() can return various errors, but its caller doesn't
raise the corresponding drop notification.

Also clean up the one case in do_netdev_encrypt_encap() where we currently
*do* raise a drop notification.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
  • Loading branch information
julianwiedmann authored and aanm committed May 12, 2023
1 parent f601b4c commit 9788f53
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bpf/bpf_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,9 +957,7 @@ static __always_inline int do_netdev_encrypt_encap(struct __ctx_buff *ctx, __u32
# endif /* ENABLE_IPV4 */
}
if (!ep)
return send_drop_notify_error(ctx, src_id,
DROP_NO_TUNNEL_ENDPOINT,
CTX_ACT_DROP, METRIC_EGRESS);
return DROP_NO_TUNNEL_ENDPOINT;

ctx->mark = 0;
bpf_clear_meta(ctx);
Expand Down Expand Up @@ -1018,7 +1016,11 @@ do_netdev(struct __ctx_buff *ctx, __u16 proto, const bool from_host)
send_trace_notify(ctx, TRACE_FROM_STACK, identity, 0, 0,
ctx->ingress_ifindex, TRACE_REASON_ENCRYPTED,
TRACE_PAYLOAD_LEN);
return do_netdev_encrypt(ctx, identity);
ret = do_netdev_encrypt(ctx, identity);
if (IS_ERR(ret))
return send_drop_notify_error(ctx, identity, ret,
CTX_ACT_DROP, METRIC_EGRESS);
return ret;
}
#endif

Expand Down

0 comments on commit 9788f53

Please sign in to comment.