summaryrefslogtreecommitdiff
path: root/service/OneService.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2018-01-25 17:27:08 -0500
committerAdam Ierymenko <adam.ierymenko@gmail.com>2018-01-25 17:27:08 -0500
commit5f5302e59535c988188e3857469c5414014d62c4 (patch)
tree7e3eb5fbda49c8ab4037630598f367d653d9c7f1 /service/OneService.cpp
parent125ec622ca446021ad3d2a707752b11fcb5dd195 (diff)
downloadinfinitytier-5f5302e59535c988188e3857469c5414014d62c4.tar.gz
infinitytier-5f5302e59535c988188e3857469c5414014d62c4.zip
More useful to allow arrays of IPs to bind to.
Diffstat (limited to 'service/OneService.cpp')
-rw-r--r--service/OneService.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp
index a9a8171c..bcdef04f 100644
--- a/service/OneService.cpp
+++ b/service/OneService.cpp
@@ -565,7 +565,7 @@ public:
}
// Read local configuration
- bool bindToWildcard = false;
+ std::vector<InetAddress> explicitBind;
{
std::map<InetAddress,ZT_PhysicalPathConfiguration> ppc;
@@ -635,7 +635,17 @@ public:
_controllerDbPath = cdbp;
// Bind to wildcard instead of to specific interfaces (disables full tunnel capability)
- bindToWildcard = OSUtils::jsonBool(settings["bindToWildcard"],false);
+ json &bind = settings["bind"];
+ if (bind.is_array()) {
+ for(unsigned long i=0;i<bind.size();++i) {
+ const std::string ips(OSUtils::jsonString(bind[i],""));
+ if (ips.length() > 0) {
+ InetAddress ip(ips.c_str());
+ if ((ip.ss_family == AF_INET)||(ip.ss_family == AF_INET6))
+ explicitBind.push_back(ip);
+ }
+ }
+ }
}
// Set trusted paths if there are any
@@ -805,7 +815,7 @@ public:
if (_ports[i])
p[pc++] = _ports[i];
}
- _binder.refresh(_phy,p,pc,bindToWildcard,*this);
+ _binder.refresh(_phy,p,pc,explicitBind,*this);
{
Mutex::Lock _l(_nets_m);
for(std::map<uint64_t,NetworkState>::iterator n(_nets.begin());n!=_nets.end();++n) {