mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
Network controller cleanup and an extra sanity check.
This commit is contained in:
parent
0bdd56ebd6
commit
f693d4d0c8
2 changed files with 4 additions and 42 deletions
|
@ -243,6 +243,10 @@ NetworkController::ResultCode SqliteNetworkController::doNetworkConfigRequest(co
|
||||||
netconf["error"] = "signing identity invalid or lacks private key";
|
netconf["error"] = "signing identity invalid or lacks private key";
|
||||||
return NetworkController::NETCONF_QUERY_INTERNAL_SERVER_ERROR;
|
return NetworkController::NETCONF_QUERY_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
if (signingId.address().toInt() != (nwid >> 24)) {
|
||||||
|
netconf["error"] = "signing identity address does not match most significant 40 bits of network ID";
|
||||||
|
return NetworkController::NETCONF_QUERY_INTERNAL_SERVER_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
NetworkRecord network;
|
NetworkRecord network;
|
||||||
memset(&network,0,sizeof(network));
|
memset(&network,0,sizeof(network));
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ "$#" -ne "2" ]; then
|
|
||||||
echo 'Usage: controller-api-test.sh <network ID to create> <local TCP port for HTTP API>'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
network_json=$(cat <<EOF
|
|
||||||
{
|
|
||||||
name: "test network",
|
|
||||||
private: true,
|
|
||||||
v4AssignMode: "zt",
|
|
||||||
v6AssignMode: "none",
|
|
||||||
multicastLimit: 100,
|
|
||||||
ipAssignmentPools: [
|
|
||||||
{
|
|
||||||
network: "10.1.2.0",
|
|
||||||
netmaskBits: 24
|
|
||||||
}
|
|
||||||
],
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
ruleId: 100,
|
|
||||||
etherType: 0x0800,
|
|
||||||
action: "accept"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ruleId: 200,
|
|
||||||
etherType: 0x0806,
|
|
||||||
action: "accept"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ruleId: 300,
|
|
||||||
etherType: 0x86dd,
|
|
||||||
action: "accept"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
echo "$network_json" | curl -d - -v "http://127.0.0.1:$2/controller/network/$1"
|
|
Loading…
Add table
Reference in a new issue