If -bind=0.0.0.0
or -bind=::
is specified, it indicates that we can bind to any available address. In this case, the Discover()
function should be executed to retrieve the local addresses. This behavior should also work for “=onion” addresses.
I updated the GetListenPort()
function to also consider ports from onion address. Without this change, when -bind=0.0.0.0:port=onion
is used, the bound port would not match the specified port.
How to test
Prepare the addresses to be found by Discover()
0ip link add name lo_dummy type dummy
1ip addr add 127.0.1.2/8 dev lo_dummy
2ip link set lo_dummy up
3ifconfig lo_dummy:0 1.1.1.1/32 up && ifconfig lo_dummy:1 2.2.2.2/32 up
Execute the test
0./build/test/functional/test_runner.py --ihave1111and2222 feature_bind_port_discover
Undo the changes after the test execution
0ifconfig lo_dummy:0 down && ifconfig lo_dummy:1
1ip link set lo_dummy down
2ip link delete lo_dummy
Fixes #31293
This PR also fixes the test feature_bind_port_discover.py
that was falling.
Fixes #31336