summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-10-09 14:51:38 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-10-09 14:51:38 -0700
commita95fa379cca0ddbce98d476b143c3606f3ae7bce (patch)
tree8de46dc858d1ab19c44e929f10c9fae4daabd032 /node
parent97dee9de36a69ed0aba4baf0cce03b9c4f11b30d (diff)
downloadinfinitytier-a95fa379cca0ddbce98d476b143c3606f3ae7bce.tar.gz
infinitytier-a95fa379cca0ddbce98d476b143c3606f3ae7bce.zip
Circuit tests basically work but need some tweaks, and fix some issues found with valgrind.
Diffstat (limited to 'node')
-rw-r--r--node/InetAddress.hpp72
-rw-r--r--node/Node.cpp2
2 files changed, 45 insertions, 29 deletions
diff --git a/node/InetAddress.hpp b/node/InetAddress.hpp
index 6970e92d..50db272a 100644
--- a/node/InetAddress.hpp
+++ b/node/InetAddress.hpp
@@ -100,74 +100,88 @@ struct InetAddress : public sockaddr_storage
inline InetAddress &operator=(const InetAddress &a)
throw()
{
- memcpy(this,&a,sizeof(InetAddress));
+ if (&a != this)
+ memcpy(this,&a,sizeof(InetAddress));
return *this;
}
inline InetAddress &operator=(const InetAddress *a)
throw()
{
- memcpy(this,a,sizeof(InetAddress));
+ if (a != this)
+ memcpy(this,a,sizeof(InetAddress));
return *this;
}
inline InetAddress &operator=(const struct sockaddr_storage &ss)
throw()
{
- memcpy(this,&ss,sizeof(InetAddress));
+ if (reinterpret_cast<const InetAddress *>(&ss) != this)
+ memcpy(this,&ss,sizeof(InetAddress));
return *this;
}
inline InetAddress &operator=(const struct sockaddr_storage *ss)
throw()
{
- memcpy(this,ss,sizeof(InetAddress));
+ if (reinterpret_cast<const InetAddress *>(ss) != this)
+ memcpy(this,ss,sizeof(InetAddress));
return *this;
}
inline InetAddress &operator=(const struct sockaddr_in &sa)
throw()
{
- memset(this,0,sizeof(InetAddress));
- memcpy(this,&sa,sizeof(struct sockaddr_in));
+ if (reinterpret_cast<const InetAddress *>(&sa) != this) {
+ memset(this,0,sizeof(InetAddress));
+ memcpy(this,&sa,sizeof(struct sockaddr_in));
+ }
return *this;
}
inline InetAddress &operator=(const struct sockaddr_in *sa)
throw()
{
- memset(this,0,sizeof(InetAddress));
- memcpy(this,sa,sizeof(struct sockaddr_in));
+ if (reinterpret_cast<const InetAddress *>(sa) != this) {
+ memset(this,0,sizeof(InetAddress));
+ memcpy(this,sa,sizeof(struct sockaddr_in));
+ }
return *this;
}
inline InetAddress &operator=(const struct sockaddr_in6 &sa)
throw()
{
- memset(this,0,sizeof(InetAddress));
- memcpy(this,&sa,sizeof(struct sockaddr_in6));
+ if (reinterpret_cast<const InetAddress *>(&sa) != this) {
+ memset(this,0,sizeof(InetAddress));
+ memcpy(this,&sa,sizeof(struct sockaddr_in6));
+ }
return *this;
}
inline InetAddress &operator=(const struct sockaddr_in6 *sa)
throw()
{
- memset(this,0,sizeof(InetAddress));
- memcpy(this,sa,sizeof(struct sockaddr_in6));
+ if (reinterpret_cast<const InetAddress *>(sa) != this) {
+ memset(this,0,sizeof(InetAddress));
+ memcpy(this,sa,sizeof(struct sockaddr_in6));
+ }
return *this;
}
inline InetAddress &operator=(const struct sockaddr &sa)
throw()
{
- memset(this,0,sizeof(InetAddress));
- switch(sa.sa_family) {
- case AF_INET:
- memcpy(this,&sa,sizeof(struct sockaddr_in));
- break;
- case AF_INET6:
- memcpy(this,&sa,sizeof(struct sockaddr_in6));
- break;
+ if (reinterpret_cast<const InetAddress *>(&sa) != this) {
+ memset(this,0,sizeof(InetAddress));
+ switch(sa.sa_family) {
+ case AF_INET:
+ memcpy(this,&sa,sizeof(struct sockaddr_in));
+ break;
+ case AF_INET6:
+ memcpy(this,&sa,sizeof(struct sockaddr_in6));
+ break;
+ }
}
return *this;
}
@@ -175,14 +189,16 @@ struct InetAddress : public sockaddr_storage
inline InetAddress &operator=(const struct sockaddr *sa)
throw()
{
- memset(this,0,sizeof(InetAddress));
- switch(sa->sa_family) {
- case AF_INET:
- memcpy(this,sa,sizeof(struct sockaddr_in));
- break;
- case AF_INET6:
- memcpy(this,sa,sizeof(struct sockaddr_in6));
- break;
+ if (reinterpret_cast<const InetAddress *>(sa) != this) {
+ memset(this,0,sizeof(InetAddress));
+ switch(sa->sa_family) {
+ case AF_INET:
+ memcpy(this,sa,sizeof(struct sockaddr_in));
+ break;
+ case AF_INET6:
+ memcpy(this,sa,sizeof(struct sockaddr_in6));
+ break;
+ }
}
return *this;
}
diff --git a/node/Node.cpp b/node/Node.cpp
index 84452146..1eb21914 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -491,7 +491,7 @@ ZT_ResultCode Node::circuitTestBegin(ZT_CircuitTest *test,void (*reportCallback)
for(unsigned int a=0;a<test->hops[0].breadth;++a) {
outp.newInitializationVector();
outp.setDestination(Address(test->hops[0].addresses[a]));
- RR->sw->send(outp,true,test->credentialNetworkId);
+ RR->sw->send(outp,true,0);
}
} catch ( ... ) {
return ZT_RESULT_FATAL_ERROR_INTERNAL; // probably indicates FIFO too big for packet