Linux: network: ip: socket option: IP_BIND_ADDRESS_NO_PORT

参考

https://www.man7.org/linux/man-pages/man7/ip.7.html

IP_BIND_ADDRESS_NO_PORT (since Linux 4.2)

Inform the kernel to not reserve an ephemeral port when using bind(2) with a port number of 0. The port will later be automatically chosen at connect(2) time, in a way that allows sharing a source port as long as the 4-tuple is unique.
因为在bind的时,有些信息还不知道,比如对方的地址和port,这样对本地源port的选择就是一个问题,还需要判断是否可以reuse。所以建议将这个选项打开,以使用这个新功能。

这个选项的引入:

commit 90c337da1524863838658078ec34241f45d8394d
Author: Eric Dumazet

猜你喜欢

转载自blog.csdn.net/qq_36428903/article/details/133075883