mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-10 14:48:46 +02:00
Merge bitcoin/bitcoin#35439: test: Improve loopback address check in rpc_bind.py
c8b8c275fatest: Improve loopback address check in `rcp_bind.py` (xyzconstant) Pull request description: A [loopback address](https://www.geeksforgeeks.org/computer-networks/what-is-a-loopback-address/) can range from `127.0.0.0` to `127.255.255.255`. This commit relaxes the loopback check in `rpc_bind.py` by checking whether an IP address (from `all_interfaces()`) starts with `'127.'` instead of strictly matching `'127.0.0.1'`. Programs like VPNs might add an extra loopback address (e.g., 127.1.130.83), which failed under the previous state. These addresses will now pass with this update. --- **For context:** I found this while running tests with the Mullvad daemon active. Mullvad adds a custom lo0 interface like `inet 127.141.11.239 netmask 0xff000000` that failed with `--nonloopback`, which should not be the case since the address is a valid loopback IP. ACKs for top commit: maflcko: lgtm ACKc8b8c275fawillcl-ark: ACKc8b8c275faTree-SHA512: 3b82002d6bc90cfc4023dd0274a40970abb2dc6a9ced77dd97e275b31340bb657d5222bb55a768ebf71047ac1521dd4ba77fb427398f7cc9857738bcd16c5818
This commit is contained in:
@@ -109,7 +109,7 @@ class RPCBindTest(BitcoinTestFramework):
|
||||
raise AssertionError("all_interfaces() returned no IPv4 interfaces")
|
||||
self.non_loopback_ip = None
|
||||
for name,ip in interfaces:
|
||||
if ip != '127.0.0.1':
|
||||
if not ip.startswith('127.'):
|
||||
self.non_loopback_ip = ip
|
||||
break
|
||||
if self.non_loopback_ip is None and self.options.run_nonloopback:
|
||||
|
||||
Reference in New Issue
Block a user