Skip to content

[confighttp] Fix parseIP to support IPv6 addresses with zone IDs#14590

Open
RoryGlenn wants to merge 1 commit intoopen-telemetry:mainfrom
RoryGlenn:fix/14545-ipv6-zone-parseip
Open

[confighttp] Fix parseIP to support IPv6 addresses with zone IDs#14590
RoryGlenn wants to merge 1 commit intoopen-telemetry:mainfrom
RoryGlenn:fix/14545-ipv6-zone-parseip

Conversation

@RoryGlenn
Copy link

Description

Fix parseIP in config/confighttp to correctly handle IPv6 addresses with zone identifiers (e.g., fe80::1%eth0).

The previous implementation used net.ParseIP, which does not support zone IDs in IPv6 addresses. When a client connects using a link-local IPv6 address with a zone (common for %eth0, %en0, etc.), parseIP returned nil, leaving client.Info.Addr unset in the request context.

This fix replaces net.ParseIP with netip.ParseAddr from the net/netip package, which correctly handles IPv6 zone identifiers. The Zone field is now properly propagated to the returned *net.IPAddr.

Link to tracking issue

Fixes #14545

Testing

  • Updated existing TestParseIP test cases to use the canonical 4-byte IPv4 representation returned by netip.ParseAddr
  • Added 4 new test cases covering:
    • IPv6 address without port (::1)
    • IPv6 address with port ([::1]:12345)
    • IPv6 address with zone ID (fe80::1%eth0)
    • IPv6 address with zone ID and port ([fe80::1%eth0]:12345)
  • Updated TestContextWithClient expectation to match the 4-byte IPv4 form
  • All config/confighttp tests pass

Documentation

No documentation changes needed.

Use netip.ParseAddr instead of net.ParseIP to correctly handle
IPv6 addresses with zone identifiers (e.g., fe80::1%eth0).
net.ParseIP does not support zone IDs, causing parseIP to return
nil for link-local IPv6 connections with zones, leaving
client.Info.Addr unset.

Fixes open-telemetry#14545

Assisted-by: Claude Opus 4
@RoryGlenn RoryGlenn requested a review from a team as a code owner February 15, 2026 00:47
@RoryGlenn RoryGlenn requested a review from dmathieu February 15, 2026 00:47
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.

Unable to parse IPv6 addresses with zones when populating the context with client information

1 participant