cloudflare / pingora

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

`TcpSocketOptions::ipv6_only` flag should be optional #279

Closed palant closed 1 week ago

palant commented 2 weeks ago

What is the problem your feature solves, or the need it fulfills?

An application setting TcpSocketOptions::ipv6_only flag will often cause an error to be logged. That might be because the application misinterpreted the address as IPv6 (cannot set the flag on IPv4 addresses), or because the OS doesn’t support this flag (seems to be the case for BSD-based operating systems). This means: the application shouldn’t have to choose if it doesn’t really want to.

This isn’t a problem right now because TcpSocketOptions only contains one field – if an application doesn’t want to set ipv6_only flag, it calls add_tcp instead of add_tcp_with_settings. Should TcpSocketOptions be extended as planned in future, this will become a problem however.

Describe the solution you'd like

This field should have Option<bool> as its type, with None keeping the system’s default behavior. The latter is always safe.

palant commented 2 weeks ago

Correction: this already is an issue. The TcpSocketOptions structure has been extended already, there changes merely aren’t released yet.

drcaramelsyrup commented 1 week ago

Thanks for reporting. This fix will be included in one of the upcoming syncs.