diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-06-07 12:15:19 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-06-07 12:15:19 -0700 |
commit | 9161eebc68a3ed75dad8f68ab83e3751454eb8e4 (patch) | |
tree | 0c4d415efdfc57167d5e6408accc0ca772286757 | |
parent | 683254a0dbd208ed1570d36275e5164b2a8885ad (diff) | |
download | infinitytier-9161eebc68a3ed75dad8f68ab83e3751454eb8e4.tar.gz infinitytier-9161eebc68a3ed75dad8f68ab83e3751454eb8e4.zip |
Carry virtual network routes through to API.
-rw-r--r-- | include/ZeroTierOne.h | 20 | ||||
-rw-r--r-- | node/Network.cpp | 10 |
2 files changed, 28 insertions, 2 deletions
diff --git a/include/ZeroTierOne.h b/include/ZeroTierOne.h index b5e5bfe8..207edce7 100644 --- a/include/ZeroTierOne.h +++ b/include/ZeroTierOne.h @@ -362,7 +362,7 @@ enum ZT_VirtualNetworkStatus ZT_NETWORK_STATUS_PORT_ERROR = 4, /** - * ZeroTier One version too old + * ZeroTier core version too old */ ZT_NETWORK_STATUS_CLIENT_TOO_OLD = 5 }; @@ -727,7 +727,13 @@ enum ZT_Architecture { ZT_ARCHITECTURE_MIPS32 = 5, ZT_ARCHITECTURE_MIPS64 = 6, ZT_ARCHITECTURE_POWER32 = 7, - ZT_ARCHITECTURE_POWER64 = 8 + ZT_ARCHITECTURE_POWER64 = 8, + ZT_ARCHITECTURE_OPENRISC32 = 9, + ZT_ARCHITECTURE_OPENRISC64 = 10, + ZT_ARCHITECTURE_SPARC32 = 11, + ZT_ARCHITECTURE_SPARC64 = 12, + ZT_ARCHITECTURE_DOTNET_CLR = 13, + ZT_ARCHITECTURE_JAVA_JVM = 14 }; /** @@ -830,6 +836,16 @@ typedef struct * virtual network's configuration master. */ struct sockaddr_storage assignedAddresses[ZT_MAX_ZT_ASSIGNED_ADDRESSES]; + + /** + * Number of ZT-pushed routes + */ + unsigned int routeCount; + + /** + * Routes (excluding those implied by assigned addresses and their masks) + */ + ZT_VirtualNetworkRoute routes[ZT_MAX_NETWORK_ROUTES]; } ZT_VirtualNetworkConfig; /** diff --git a/node/Network.cpp b/node/Network.cpp index c1c3414d..7b96f337 100644 --- a/node/Network.cpp +++ b/node/Network.cpp @@ -406,6 +406,16 @@ void Network::_externalConfig(ZT_VirtualNetworkConfig *ec) const memset(&(ec->assignedAddresses[i]),0,sizeof(struct sockaddr_storage)); } } + + ec->routeCount = 0; + for(unsigned int i=0;i<ZT_MAX_NETWORK_ROUTES;++i) { + if (i < _config.routeCount) { + memcpy(&(ec->routes[i]),&(_config.routes[i]),sizeof(ZT_VirtualNetworkRoute)); + ++ec->routeCount; + } else { + memset(&(ec->routes[i]),0,sizeof(ZT_VirtualNetworkRoute)); + } + } } bool Network::_isAllowed(const SharedPtr<Peer> &peer) const |