Added isPrefixEqual, fixed unit test bug, fixed ipv6 bind bug

This commit is contained in:
Joseph Henry
2017-05-03 21:12:26 -07:00
parent bb6d9d5f8c
commit 64f2634960
7 changed files with 50 additions and 30 deletions

View File

@@ -412,7 +412,7 @@ int zts_connect(ZT_CONNECT_SIG) {
inet_ntop(AF_INET6,
(const void *)&((struct sockaddr_in6 *)addr)->sin6_addr.s6_addr, ipstr, INET6_ADDRSTRLEN);
}
iaddr.fromString(ipstr);
iaddr.fromString(ipstr+std::string("/88"));
//DEBUG_INFO("ipstr= %s", ipstr);
//DEBUG_INFO("iaddr= %s", iaddr.toString().c_str());
tap = zt1Service->getTap(iaddr);
@@ -524,20 +524,14 @@ int zts_bind(ZT_BIND_SIG) {
ZeroTier::InetAddress iaddr;
if(conn->socket_family == AF_INET) {
printf("parsing ipv4 str\n");
inet_ntop(AF_INET,
(const void *)&((struct sockaddr_in *)addr)->sin_addr.s_addr, ipstr, INET_ADDRSTRLEN);
}
if(conn->socket_family == AF_INET6) {
printf("parsing ipv6 str\n");
inet_ntop(AF_INET6,
(const void *)&((struct sockaddr_in6 *)addr)->sin6_addr.s6_addr, ipstr, INET6_ADDRSTRLEN);
}
iaddr.fromString(ipstr);
DEBUG_INFO("ipstr= %s", ipstr);
DEBUG_INFO("iaddr= %s", iaddr.toString().c_str());
tap = zt1Service->getTap(iaddr);
if(!tap) {