Linux build fixes for testnet.

This commit is contained in:
Adam Ierymenko 2014-10-29 16:32:24 -07:00
parent 5484cf4309
commit 4c59497b95
2 changed files with 19 additions and 14 deletions

View File

@ -6,6 +6,10 @@ INCLUDES=
DEFS= DEFS=
LIBS= LIBS=
include objects.mk
OBJS+=osnet/LinuxRoutingTable.o osnet/LinuxEthernetTap.o osnet/LinuxEthernetTapFactory.o
TESTNET_OBJS=testnet/SimNet.o testnet/SimNetSocketManager.o testnet/TestEthernetTap.o testnet/TestEthernetTapFactory.o testnet/TestRoutingTable.o
# Enable SSE-optimized Salsa20 on x86 and x86_64 machines # Enable SSE-optimized Salsa20 on x86 and x86_64 machines
MACHINE=$(shell uname -m) MACHINE=$(shell uname -m)
ifeq ($(MACHINE),x86_64) ifeq ($(MACHINE),x86_64)
@ -58,9 +62,6 @@ endif
CXXFLAGS=$(CFLAGS) -fno-rtti CXXFLAGS=$(CFLAGS) -fno-rtti
include objects.mk
OBJS+=osnet/LinuxRoutingTable.o osnet/LinuxEthernetTap.o osnet/LinuxEthernetTapFactory.o
all: one all: one
one: $(OBJS) main.o one: $(OBJS) main.o
@ -73,11 +74,15 @@ selftest: $(OBJS) selftest.o
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS)
$(STRIP) zerotier-selftest $(STRIP) zerotier-selftest
testnet: $(TESTNET_OBJS) $(OBJS) testnet.o
$(CXX) $(CXXFLAGS) -o zerotier-testnet testnet.o $(OBJS) $(TESTNET_OBJS) $(LIBS)
$(STRIP) zerotier-testnet
installer: one FORCE installer: one FORCE
./buildinstaller.sh ./buildinstaller.sh
clean: clean:
rm -rf $(OBJS) node/*.o osnet/*.o *.o zerotier-* build-* ZeroTierOneInstaller-* rm -rf $(OBJS) $(TESTNET_OBJS) node/*.o osnet/*.o control/*.o testnet/*.o *.o zerotier-* build-* ZeroTierOneInstaller-*
debug: FORCE debug: FORCE
make -j 4 ZT_DEBUG=1 make -j 4 ZT_DEBUG=1

View File

@ -321,7 +321,7 @@ static void doJoin(const std::vector<std::string> &cmd)
std::map< Address,SimNode * >::iterator n(nodes.find(*a)); std::map< Address,SimNode * >::iterator n(nodes.find(*a));
if (n != nodes.end()) { if (n != nodes.end()) {
n->second->node.join(nwid); n->second->node.join(nwid);
printf("%s join %.16llx"ZT_EOL_S,n->first.toString().c_str(),nwid); printf("%s join %.16llx"ZT_EOL_S,n->first.toString().c_str(),(unsigned long long)nwid);
} }
} }
} }
@ -348,7 +348,7 @@ static void doLeave(const std::vector<std::string> &cmd)
std::map< Address,SimNode * >::iterator n(nodes.find(*a)); std::map< Address,SimNode * >::iterator n(nodes.find(*a));
if (n != nodes.end()) { if (n != nodes.end()) {
n->second->node.leave(nwid); n->second->node.leave(nwid);
printf("%s leave %.16llx"ZT_EOL_S,n->first.toString().c_str(),nwid); printf("%s leave %.16llx"ZT_EOL_S,n->first.toString().c_str(),(unsigned long long)nwid);
} }
} }
} }
@ -537,14 +537,14 @@ static void doUnicast(const std::vector<std::string> &cmd)
pkt.i[0] = s->toInt(); pkt.i[0] = s->toInt();
pkt.i[1] = Utils::now(); pkt.i[1] = Utils::now();
stap->injectPacketFromHost(stap->mac(),rtap->mac(),0xdead,pkt.data,frameLen); stap->injectPacketFromHost(stap->mac(),rtap->mac(),0xdead,pkt.data,frameLen);
printf("%s -> %s etherType 0xdead network %.16llx length %u"ZT_EOL_S,s->toString().c_str(),r->toString().c_str(),nwid,frameLen); printf("%s -> %s etherType 0xdead network %.16llx length %u"ZT_EOL_S,s->toString().c_str(),r->toString().c_str(),(unsigned long long)nwid,frameLen);
sentPairs.insert(std::pair<Address,Address>(*s,*r)); sentPairs.insert(std::pair<Address,Address>(*s,*r));
} else if (stap) { } else if (stap) {
printf("%s -> !%s (receiver not a member of %.16llx)"ZT_EOL_S,s->toString().c_str(),r->toString().c_str(),nwid); printf("%s -> !%s (receiver not a member of %.16llx)"ZT_EOL_S,s->toString().c_str(),r->toString().c_str(),(unsigned long long)nwid);
} else if (rtap) { } else if (rtap) {
printf("%s -> !%s (sender not a member of %.16llx)"ZT_EOL_S,s->toString().c_str(),r->toString().c_str(),nwid); printf("%s -> !%s (sender not a member of %.16llx)"ZT_EOL_S,s->toString().c_str(),r->toString().c_str(),(unsigned long long)nwid);
} else { } else {
printf("%s -> !%s (neither party is a member of %.16llx)"ZT_EOL_S,s->toString().c_str(),r->toString().c_str(),nwid); printf("%s -> !%s (neither party is a member of %.16llx)"ZT_EOL_S,s->toString().c_str(),r->toString().c_str(),(unsigned long long)nwid);
} }
} }
} }
@ -563,7 +563,7 @@ static void doUnicast(const std::vector<std::string> &cmd)
if ((frame.len == frameLen)&&(!memcmp(frame.data + 16,pkt.data + 16,frameLen - 16))) { if ((frame.len == frameLen)&&(!memcmp(frame.data + 16,pkt.data + 16,frameLen - 16))) {
uint64_t ints[2]; uint64_t ints[2];
memcpy(ints,frame.data,16); memcpy(ints,frame.data,16);
printf("%s <- %.10llx received test packet, length == %u, latency == %llums"ZT_EOL_S,r->toString().c_str(),ints[0],frame.len,frame.timestamp - ints[1]); printf("%s <- %.10llx received test packet, length == %u, latency == %llums"ZT_EOL_S,r->toString().c_str(),(unsigned long long)ints[0],frame.len,(unsigned long long)(frame.timestamp - ints[1]));
receivedPairs.insert(std::pair<Address,Address>(Address(ints[0]),*r)); receivedPairs.insert(std::pair<Address,Address>(Address(ints[0]),*r));
} else { } else {
printf("%s !! got spurious packet, length == %u, etherType == 0x%.4x"ZT_EOL_S,r->toString().c_str(),frame.len,frame.etherType); printf("%s !! got spurious packet, length == %u, etherType == 0x%.4x"ZT_EOL_S,r->toString().c_str(),frame.len,frame.etherType);
@ -640,9 +640,9 @@ static void doMulticast(const std::vector<std::string> &cmd)
pkt.i[0] = s->toInt(); pkt.i[0] = s->toInt();
pkt.i[1] = Utils::now(); pkt.i[1] = Utils::now();
stap->injectPacketFromHost(stap->mac(),mcaddr,0xdead,pkt.data,frameLen); stap->injectPacketFromHost(stap->mac(),mcaddr,0xdead,pkt.data,frameLen);
printf("%s -> %s etherType 0xdead network %.16llx length %u"ZT_EOL_S,s->toString().c_str(),mcaddr.toString().c_str(),nwid,frameLen); printf("%s -> %s etherType 0xdead network %.16llx length %u"ZT_EOL_S,s->toString().c_str(),mcaddr.toString().c_str(),(unsigned long long)nwid,frameLen);
} else { } else {
printf("%s -> !%s (sender is not a member of %.16llx)"ZT_EOL_S,s->toString().c_str(),mcaddr.toString().c_str(),nwid); printf("%s -> !%s (sender is not a member of %.16llx)"ZT_EOL_S,s->toString().c_str(),mcaddr.toString().c_str(),(unsigned long long)nwid);
} }
} }
@ -660,7 +660,7 @@ static void doMulticast(const std::vector<std::string> &cmd)
if ((frame.len == frameLen)&&(!memcmp(frame.data + 16,pkt.data + 16,frameLen - 16))) { if ((frame.len == frameLen)&&(!memcmp(frame.data + 16,pkt.data + 16,frameLen - 16))) {
uint64_t ints[2]; uint64_t ints[2];
memcpy(ints,frame.data,16); memcpy(ints,frame.data,16);
printf("%s <- %.10llx received test packet, length == %u, latency == %llums"ZT_EOL_S,nn->first.toString().c_str(),ints[0],frame.len,frame.timestamp - ints[1]); printf("%s <- %.10llx received test packet, length == %u, latency == %llums"ZT_EOL_S,nn->first.toString().c_str(),(unsigned long long)ints[0],frame.len,(unsigned long long)(frame.timestamp - ints[1]));
++receiveCount; ++receiveCount;
} else { } else {
printf("%s !! got spurious packet, length == %u, etherType == 0x%.4x"ZT_EOL_S,nn->first.toString().c_str(),frame.len,frame.etherType); printf("%s !! got spurious packet, length == %u, etherType == 0x%.4x"ZT_EOL_S,nn->first.toString().c_str(),frame.len,frame.etherType);