Add better port binding controls

This commit is contained in:
Joseph Henry
2021-05-13 14:17:08 -07:00
parent 22f80797b8
commit 5d404034c3
7 changed files with 212 additions and 65 deletions

View File

@@ -70,7 +70,7 @@ int init_subsystems()
#endif // ZTS_ENABLE_CUSTOM_SIGNAL_HANDLERS
if (! zts_service) {
#if defined(__WINDOWS__)
WSAStartup(MAKEWORD(2, 2), &wsaData);
WSAStartup(MAKEWORD(2, 2), &wsaData);
#endif
zts_service = new NodeService();
zts_service->setUserEventSystem(zts_events);
@@ -130,7 +130,7 @@ int zts_init_blacklist_if(const char* prefix, unsigned int len)
int zts_init_set_roots(const void* roots_data, unsigned int len)
{
ACQUIRE_SERVICE_OFFLINE();
return zts_service->setWorld(roots_data, len);
return zts_service->setRoots(roots_data, len);
}
int zts_init_set_port(unsigned short port)
@@ -140,6 +140,25 @@ int zts_init_set_port(unsigned short port)
return ZTS_ERR_OK;
}
int zts_init_set_random_port_range(unsigned short start_port, unsigned short end_port)
{
ACQUIRE_SERVICE_OFFLINE();
zts_service->setRandomPortRange(start_port, end_port);
return ZTS_ERR_OK;
}
int zts_init_allow_secondary_port(unsigned int allowed)
{
ACQUIRE_SERVICE_OFFLINE();
return zts_service->allowSecondaryPort(allowed);
}
int zts_init_allow_port_mapping(unsigned int allowed)
{
ACQUIRE_SERVICE_OFFLINE();
return zts_service->allowPortMapping(allowed);
}
int zts_init_allow_peer_cache(unsigned int allowed)
{
ACQUIRE_SERVICE_OFFLINE();
@@ -155,7 +174,7 @@ int zts_init_allow_net_cache(unsigned int allowed)
int zts_init_allow_roots_cache(unsigned int allowed)
{
ACQUIRE_SERVICE_OFFLINE();
return zts_service->allowWorldCaching(allowed);
return zts_service->allowRootSetCaching(allowed);
}
int zts_init_allow_id_cache(unsigned int allowed)