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

NAT handling for IPv6 formatted IPv4 addresses #255

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

golisai
Copy link
Contributor

@golisai golisai commented Mar 6, 2024

Description:
This patch solves an issue in dual-stack setups where NAT mappings fail to handle IPv4 addresses in IPv6 format properly. Consequently, Kubernetes service names appear as "dest.workload.name" with "dest.resolution.type" set to DNS, rather than the actual backend Kubernetes workload name. This fix ensures that the NAT handler is invoked correctly for IPv6 addresses when they are IPv4 addresses.

Link to tracking Issue: None

Testing: Verified capturing the Metric with Prometheus

Prior to fix:
tcp_bytes{az_equal="true", container="reducer", dest_availability_zone="(unknown)", dest_environment="(unknown)", dest_resolution_type="DNS", dest_workload_name="otel-collector-service.otel.svc.cluster.local", sf_product="network-explorer", source_availability_zone="(unknown)", source_container_name="reducer", source_environment="(unknown)", source_namespace_name="otel-network", source_process_name="opentelemetry-e", source_resolution_type="K8S_CONTAINER", source_workload_name="otel-network-reducer", source_workload_uid="6f7a2e46-a742-4876-8539-f9704e7f49bc"}

After fix:

tcp_bytes{az_equal="true", container="reducer", dest_availability_zone="(unknown)", dest_container_name="otc-container", dest_environment="(unknown)", dest_image_version="23.12.0-1247", dest_namespace_name="otel", dest_process_name="otel-collector", dest_resolution_type="K8S_CONTAINER", dest_workload_name="otel-collector", dest_workload_uid="13a067a2-7eb9-4745-9160-b646789cd2f3", sf_product="network-explorer", source_availability_zone="(unknown)", source_container_name="reducer", source_environment="(unknown)", source_namespace_name="otel-network", source_process_name="opentelemetry-e", source_resolution_type="K8S_CONTAINER", source_workload_name="otel-network-reducer", source_workload_uid="6f7a2e46-a742-4876-8539-f9704e7f49bc"}

Kernel collector logs after the fix:
024-03-06 19:02:16.971037+00:00 trace [p:414024 t:414024] handle_set_state_ipv6: sk:18446628591012088192, ::ffff:10.1.235.218:47274 -> ::ffff:10.152.183.176:24317 (tx_rx=0)
2024-03-06 19:02:16.971039+00:00 trace [p:414024 t:414024] NatHandler::handle_set_state_ipv6: sk=18446628591012088192, src=10.1.235.218:47274, dest=10.152.183.176:24317, tx_rx=0
2024-03-06 19:02:16.971042+00:00 trace [p:414024 t:414024] NatHandler::send_nat_remapping: sk=18446628591012088192, src=10.1.235.218:47274, dst=10.1.36.98:24317

Documentation: None

@yonch
Copy link
Contributor

yonch commented Mar 7, 2024

Hi Sri it’s going to take a few days for me to get around to this, please reach out on cncf slack if this is tied to a deadline

@samiura
Copy link
Contributor

samiura commented Mar 7, 2024

@golisai is it possible for you look at the ci/cd failures?

@golisai
Copy link
Contributor Author

golisai commented Mar 8, 2024

@golisai is it possible for you look at the ci/cd failures?

@samiura Both failed cases timed out while pulling the build-env container. I am not sure how to debug this. Could it be a temporary issue on the registry side?

Copy link
Contributor

@yonch yonch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Thank you for solving this misbehavior! 🥇

@yonch yonch merged commit 0e33f66 into open-telemetry:main Mar 19, 2024
3 of 11 checks passed
@golisai golisai deleted the nat branch March 19, 2024 17:39
@golisai
Copy link
Contributor Author

golisai commented Mar 19, 2024

lgtm. Thank you for solving this misbehavior! 🥇

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants