Skip to content

Bind IPv6 listeners and sockets#149

Merged
benoitc merged 1 commit into
mainfrom
fix/ipv6-listener
May 30, 2026
Merged

Bind IPv6 listeners and sockets#149
benoitc merged 1 commit into
mainfrom
fix/ipv6-listener

Conversation

@benoitc
Copy link
Copy Markdown
Owner

@benoitc benoitc commented May 30, 2026

Listeners could not start on IPv6: the server socket paths hard-coded the inet family, so an IPv6 bind crashed init with badarg and an inet6 entry in extra_socket_opts was ignored.

The address family is now inferred from extra_socket_opts: inet6 when an inet6 atom or an 8-tuple {ip, V6} is present, inet otherwise (IPv4 default unchanged). This covers the gen_udp listener, the gen_udp client/server send sockets, and the OTP socket backend. Capability detection probes the inferred family so an IPv6-only host keeps the socket backend, and the socket backend now binds a specific {ip, Addr} instead of always any.

quic_listener:start_link(0, Opts#{extra_socket_opts => [inet6]}).
quic_listener:start_link(0, Opts#{extra_socket_opts => [{ip, {0,0,0,0,0,0,0,1}}]}).

Fixes #146

- Derive UDP family from extra_socket_opts (inet6 atom or {ip, V6}); default IPv4
- Make capability detection family-aware so IPv6-only hosts keep the socket backend
- Honor {ip, Addr} as the bind address on the OTP socket backend

Fixes #146
@benoitc benoitc merged commit 558fe45 into main May 30, 2026
10 checks passed
@benoitc benoitc deleted the fix/ipv6-listener branch May 30, 2026 07:57
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.

Cannot start listener on ipv6

1 participant