diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2014-12-16 11:51:02 -0330 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2014-12-16 11:51:02 -0330 |
commit | a624d5f07d2befbf94a5f4a299d96ebf88ba54a4 (patch) | |
tree | cf441f8c2a4825f30adeb1d3e8a9c73ca6812e19 /cpp/src/Ice/Network.cpp | |
parent | ICE-6168 IceStorm clock demo subscriber doesn't flush output? (diff) | |
download | ice-a624d5f07d2befbf94a5f4a299d96ebf88ba54a4.tar.bz2 ice-a624d5f07d2befbf94a5f4a299d96ebf88ba54a4.tar.xz ice-a624d5f07d2befbf94a5f4a299d96ebf88ba54a4.zip |
ICE-6130 filter out all link local addresses in published endpoints
Diffstat (limited to 'cpp/src/Ice/Network.cpp')
-rw-r--r-- | cpp/src/Ice/Network.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index c2a3fc69ca3..64d45f9244b 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -457,6 +457,20 @@ getLocalAddresses(ProtocolSupport protocol, bool includeLoopback) } bool +isLinklocal(const Address& addr) +{ + if (addr.saStorage.ss_family == AF_INET6) + { + return IN6_IS_ADDR_LINKLOCAL(&addr.saIn6.sin6_addr); + } + else if (addr.saStorage.ss_family == AF_INET) + { + return inetAddrToString(addr).find("169.254.") == 0; + } + return false; +} + +bool isWildcard(const string& host, ProtocolSupport protocol, bool& ipv4) { try @@ -1454,10 +1468,11 @@ IceInternal::getHostsForEndpointExpand(const string& host, ProtocolSupport proto for(vector<Address>::const_iterator p = addrs.begin(); p != addrs.end(); ++p) { // - // NOTE: We don't publish link-local IPv6 addresses as these addresses can only - // be accessed in general with a scope-id. + // NOTE: We don't publish link-local addresses as in most cases + // these are not desired to be published and in some cases + // will not work without extra configuration. // - if(p->saStorage.ss_family != AF_INET6 || !IN6_IS_ADDR_LINKLOCAL(&p->saIn6.sin6_addr)) + if(!isLinklocal(*p)) { hosts.push_back(inetAddrToString(*p)); } |