Exclude loopback from valid IP addresses (#29992)
Excludes loopback IP addresses from being valid IP addresses unless private addresses are explicitly allowed
This commit is contained in:
parent
27e8af9621
commit
b29a50a55e
|
@ -74,10 +74,12 @@ source multinode-demo/common.sh --prebuild
|
|||
|
||||
nodes=(
|
||||
"multinode-demo/bootstrap-validator.sh \
|
||||
--allow-private-addr \
|
||||
--no-restart \
|
||||
--init-complete-file init-complete-node0.log \
|
||||
--dynamic-port-range 8000-8050"
|
||||
"multinode-demo/validator.sh \
|
||||
--allow-private-addr \
|
||||
--no-restart \
|
||||
--dynamic-port-range 8050-8100
|
||||
--init-complete-file init-complete-node1.log \
|
||||
|
@ -90,6 +92,7 @@ if [[ extraNodes -gt 0 ]]; then
|
|||
portEnd=$((portStart + 49))
|
||||
nodes+=(
|
||||
"multinode-demo/validator.sh \
|
||||
--allow-private-addr \
|
||||
--no-restart \
|
||||
--dynamic-port-range $portStart-$portEnd
|
||||
--label dyn$i \
|
||||
|
@ -317,7 +320,7 @@ while [[ $iteration -le $iterations ]]; do
|
|||
set -x
|
||||
client_keypair=/tmp/client-id.json-$$
|
||||
$solana_keygen new --no-passphrase -fso $client_keypair || exit $?
|
||||
$solana_gossip spy -n 127.0.0.1:8001 --num-nodes-exactly $numNodes || exit $?
|
||||
$solana_gossip --allow-private-addr spy -n 127.0.0.1:8001 --num-nodes-exactly $numNodes || exit $?
|
||||
rm -rf $client_keypair
|
||||
) || flag_error
|
||||
|
||||
|
|
|
@ -75,6 +75,13 @@ NDEBUG=1 SOLANA_CUDA=1 ./multinode-demo/bootstrap-validator.sh
|
|||
NDEBUG=1 SOLANA_CUDA=1 ./multinode-demo/validator.sh
|
||||
```
|
||||
|
||||
To run multiple nodes on the same machine using loopback IP address, pass parameter to allow private addresses
|
||||
|
||||
```bash
|
||||
NDEBUG=1 ./multinode-demo/bootstrap-validator.sh --allow-private-addr
|
||||
NDEBUG=1 ./multinode-demo/validator-x.sh --allow-private-addr
|
||||
```
|
||||
|
||||
### Testnet Client Demo
|
||||
|
||||
Now that your singlenode or multinode testnet is up and running let's send it some transactions!
|
||||
|
|
|
@ -24,15 +24,14 @@ impl SocketAddrSpace {
|
|||
match addr.ip() {
|
||||
IpAddr::V4(addr) => {
|
||||
// TODO: Consider excluding:
|
||||
// addr.is_loopback() || addr.is_link_local()
|
||||
// || addr.is_broadcast() || addr.is_documentation()
|
||||
// || addr.is_unspecified()
|
||||
!addr.is_private()
|
||||
// addr.is_link_local() || addr.is_broadcast()
|
||||
// || addr.is_documentation() || addr.is_unspecified()
|
||||
!(addr.is_private() || addr.is_loopback())
|
||||
}
|
||||
IpAddr::V6(_) => {
|
||||
IpAddr::V6(addr) => {
|
||||
// TODO: Consider excluding:
|
||||
// addr.is_loopback() || addr.is_unspecified(),
|
||||
true
|
||||
// addr.is_unspecified(),
|
||||
!addr.is_loopback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue