cloudflare / pingora

A library for building fast, reliable and evolvable network services.
Apache License 2.0
20.25k stars 1.1k forks source link

Make ipv6_only in TcpSocketOptions optional when not required. #249

Closed Object905 closed 1 month ago

Object905 commented 1 month ago

Describe the bug

Now TcpSocketOptions supports more flags, while ipv6_only is a boolean, while not all networks support setting this flag, even to false. I'm running pingora inside kubernetes with calico and ipv6 disabled.

Pingora info

Pingora version: 0.2.0 Rust version: i.e. cargo 1.78.0 (54d8815d0 2024-03-26) Operating system version: Ubuntu 22.04,

Steps to reproduce

Calling service.add_tcp_with_settings("0.0.0.0:8080", TcpSocketOptions { ipv6_only: false }); inside kubernetes with ipv6 disabled.

Expected results

Possible to skip set_only_v6(opt.ipv6_only) when specifying options with add_tcp_with_settings. Either this bool should be Option, or should be called only when it's true (in apply_tcp_socket_options), because it's false by default.

Observed results

Error on startup: Listen() failed: BindError context: failed to set IPV6_V6ONLY cause: Protocol not available (os error 92)

Object905 commented 1 month ago

Oops, nvm. I's already fixed on main