Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datapath: pass IPv6 NDP traffic to stack without policy check #24919

Merged
merged 1 commit into from
Jun 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions bpf/bpf_lxc.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,19 +743,15 @@ static __always_inline int __tail_handle_ipv6(struct __ctx_buff *ctx,
{
void *data, *data_end;
struct ipv6hdr *ip6;
int ret;

if (!revalidate_data_pull(ctx, &data, &data_end, &ip6))
return DROP_INVALID;

/* Handle special ICMPv6 NDP messages, and all remaining packets
* are subjected to forwarding into the container.
*/
if (unlikely(is_icmp6_ndp(ctx, ip6, ETH_HLEN))) {
ret = icmp6_ndp_handle(ctx, ETH_HLEN, METRIC_EGRESS);
if (IS_ERR(ret))
return ret;
}
if (unlikely(is_icmp6_ndp(ctx, ip6, ETH_HLEN)))
return icmp6_ndp_handle(ctx, ETH_HLEN, METRIC_EGRESS);

if (unlikely(!is_valid_lxc_src_ip(ip6)))
return DROP_INVALID_SIP;
Expand Down Expand Up @@ -1639,6 +1635,11 @@ int tail_ipv6_to_endpoint(struct __ctx_buff *ctx)
goto out;
}

if (unlikely(is_icmp6_ndp(ctx, ip6, ETH_HLEN))) {
ret = CTX_ACT_OK;
goto out;
}

/* Packets from the proxy will already have a real identity. */
if (identity_is_reserved(src_sec_identity)) {
union v6addr *src = (union v6addr *)&ip6->saddr;
Expand Down