Skip to content

Comments

wg: make [$HOST]:$PORT notation for an endpoint imply AF_INET6.#31

Open
klihub wants to merge 1 commit intoWireGuard:masterfrom
klihub:wg/devel/notation-implied-ipv6
Open

wg: make [$HOST]:$PORT notation for an endpoint imply AF_INET6.#31
klihub wants to merge 1 commit intoWireGuard:masterfrom
klihub:wg/devel/notation-implied-ipv6

Conversation

@klihub
Copy link

@klihub klihub commented Feb 8, 2026

parse_endpoint() for wg lets users specify an endpoint using a [$HOSTNAME]:$PORT notation. However, it has no effect on the address family chosen for hostname resolution. Update parse_endpoint to pass an AF_INET6 hint to getaddrinfo when such a notation is used which allows users to force selecting an IPv6 address.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
@zx2c4
Copy link
Member

zx2c4 commented Feb 23, 2026

Will this have weird interactions with [hostname] resolving to ipv6 when the [] notion is actually meant for IP addresses only?

@klihub
Copy link
Author

klihub commented Feb 24, 2026

Will this have weird interactions with [hostname] resolving to ipv6 when the [] notion is actually meant for IP addresses only?

@zx2c4 Sorry, for not stating the intent of the PR clearly in the original description. So that is exactly my intent with this PR. To allow forcing hostname to be resolved to an IPv6 address if the used endpoint notation is [$HOSTNAME]:$PORT.

The syntax is already allowed/there, it just does not have any effect when a hostname is used. And I haven't found an existing way in the current implementation to force wg to pick and IPv6 address in the case of an IPv4/IPv6 multihomed host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants