@@ -2863,7 +2863,31 @@ local doc = {
28632863 method_form = ' udp:bind(host, port, [flags])' ,
28642864 desc = [[
28652865 Bind the UDP handle to an IP address and port. Any `flags` are set with a table
2866- with fields `reuseaddr` or `ipv6only` equal to `true` or `false`.
2866+ with fields `reuseaddr`, `ipv6only`, `linux_recverr`, `reuseport` equal to `true` or `false`.
2867+
2868+ - `reuseaddr`: Indicates if SO_REUSEADDR will be set when binding the handle.
2869+ This sets the SO_REUSEPORT socket flag on the BSDs (except for
2870+ DragonFlyBSD), OS X, and other platforms where SO_REUSEPORTs don't
2871+ have the capability of load balancing, as the opposite of what
2872+ `reuseport` would do. On other Unix platforms, it sets the
2873+ SO_REUSEADDR flag. What that means is that multiple threads or
2874+ processes can bind to the same address without error (provided
2875+ they all set the flag) but only the last one to bind will receive
2876+ any traffic, in effect "stealing" the port from the previous listener.
2877+ - `ipv6only`: Disables dual stack mode.
2878+ - `linux_recverr`: Indicates if IP_RECVERR/IPV6_RECVERR will be set when binding the handle.
2879+ This sets IP_RECVERR for IPv4 and IPV6_RECVERR for IPv6 UDP sockets on
2880+ Linux. This stops the Linux kernel from suppressing some ICMP error messages
2881+ and enables full ICMP error reporting for faster failover.
2882+ This flag is no-op on platforms other than Linux.
2883+ - `reuseport`: Indicates if SO_REUSEPORT will be set when binding the handle.
2884+ This sets the SO_REUSEPORT socket option on supported platforms.
2885+ Unlike `reuseaddr`, this flag will make multiple threads or
2886+ processes that are binding to the same address and port "share"
2887+ the port, which means incoming datagrams are distributed across
2888+ the receiving sockets among threads or processes.
2889+ This flag is available only on Linux 3.9+, DragonFlyBSD 3.6+,
2890+ FreeBSD 12.0+, Solaris 11.4, and AIX 7.2.5+ for now.
28672891 ]] ,
28682892 params = {
28692893 { name = ' udp' , type = ' uv_udp_t' },
@@ -2874,10 +2898,18 @@ local doc = {
28742898 type = opt (table ({
28752899 { ' ipv6only' , opt_bool },
28762900 { ' reuseaddr' , opt_bool },
2901+ { ' linux_recverr' , opt_bool },
2902+ { ' reuseport' , opt_bool },
28772903 })),
28782904 },
28792905 },
28802906 returns = success_ret ,
2907+ notes = {
2908+ [[
2909+ The flag `linux_recverr` is only supported with Libuv >= 1.42.0.
2910+ The flag `reuseport` is only supported with Libuv >= 1.49.0.
2911+ ]] ,
2912+ },
28812913 },
28822914 {
28832915 name = ' udp_getsockname' ,
0 commit comments