More multicast fixes.

This commit is contained in:
Adam Ierymenko 2013-10-01 17:19:24 -04:00
parent 3443b203e4
commit 4b6ec872c7
4 changed files with 14 additions and 17 deletions

View File

@ -4,19 +4,18 @@ CXX=g++
INCLUDES= INCLUDES=
ARCH=$(shell uname -m) ARCH=$(shell uname -m)
DEFS=-DZT_ARCH="$(ARCH)" -DZT_OSNAME="linux" -DZT_TRACE DEFS=-DZT_ARCH="$(ARCH)" -DZT_OSNAME="linux" -DZT_TRACE
LIBS=
# Uncomment for a release optimized build # Uncomment for a release optimized build
#CFLAGS=-Wall -O3 -fno-unroll-loops -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS) CFLAGS=-Wall -O3 -fno-unroll-loops -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
#STRIP=strip --strip-all STRIP=strip --strip-all
# Uncomment for a debug build # Uncomment for a debug build
CFLAGS=-Wall -g -pthread $(INCLUDES) -DZT_TRACE $(DEFS) #CFLAGS=-Wall -g -pthread $(INCLUDES) -DZT_TRACE $(DEFS)
STRIP=echo #STRIP=echo
CXXFLAGS=$(CFLAGS) -fno-rtti CXXFLAGS=$(CFLAGS) -fno-rtti
LIBS=-lm
include objects.mk include objects.mk
all: one cli all: one cli

View File

@ -3,6 +3,7 @@ CXX=g++
INCLUDES= INCLUDES=
DEFS=-DZT_ARCH="x86_combined" -DZT_OSNAME="mac" -DZT_TRACE DEFS=-DZT_ARCH="x86_combined" -DZT_OSNAME="mac" -DZT_TRACE
LIBS=-lm
# Uncomment for a release optimized universal binary build # Uncomment for a release optimized universal binary build
CFLAGS=-arch i386 -arch x86_64 -Wall -O3 -ftree-vectorize -fstack-protector -pthread -mmacosx-version-min=10.6 -DNDEBUG $(INCLUDES) $(DEFS) CFLAGS=-arch i386 -arch x86_64 -Wall -O3 -ftree-vectorize -fstack-protector -pthread -mmacosx-version-min=10.6 -DNDEBUG $(INCLUDES) $(DEFS)
@ -13,7 +14,6 @@ STRIP=strip
#STRIP=echo #STRIP=echo
CXXFLAGS=$(CFLAGS) -fno-rtti CXXFLAGS=$(CFLAGS) -fno-rtti
LIBS=-lm
include objects.mk include objects.mk

View File

@ -154,11 +154,11 @@ public:
throw() : throw() :
_origin(origin), _origin(origin),
_bloomNonce((uint64_t)bloomNonce), _bloomNonce((uint64_t)bloomNonce),
_prefixMask(0xffffffffffffffffULL >> (64 - prefixBits)),
_prefix((uint64_t)prefix & _prefixMask),
_ptr(ptr), _ptr(ptr),
_end(end), _end(end),
_bloom(bloom), _bloom(bloom) {}
_prefix(prefix),
_prefixBits(std::min(prefixBits,(unsigned int)16)) {}
inline bool operator()(const Address &a) inline bool operator()(const Address &a)
throw() throw()
@ -167,10 +167,8 @@ public:
if (a == _origin) if (a == _origin)
return true; return true;
// Prefixes match if N least significant bits in address are equal to the // Exclude addresses not in this prefix domain
// prefix. (e.g. 0 bits and 0 prefix would match all, 1 bit and 0 prefix if ((a.toInt() & _prefixMask) != _prefix)
// would match addresses with LSB == 0)
if (((unsigned int)a.toInt() & (0xffff >> (16 - _prefixBits))) != _prefix)
return true; return true;
// Exclude addresses remembered in bloom filter -- or else remember them // Exclude addresses remembered in bloom filter -- or else remember them
@ -189,11 +187,11 @@ public:
private: private:
const Address _origin; const Address _origin;
const uint64_t _bloomNonce; const uint64_t _bloomNonce;
const uint64_t _prefixMask;
const uint64_t _prefix;
unsigned char **const _ptr; unsigned char **const _ptr;
unsigned char *const _end; unsigned char *const _end;
unsigned char *const _bloom; unsigned char *const _bloom;
const unsigned int _prefix;
const unsigned int _prefixBits;
}; };
private: private:

View File

@ -564,7 +564,7 @@ bool PacketDecoder::_doMULTICAST_FRAME(const RuntimeEnvironment *_r,const Shared
// New FIFO with room for one extra, since head will be next hop // New FIFO with room for one extra, since head will be next hop
unsigned char newFifo[ZT_PROTO_VERB_MULTICAST_FRAME_LEN_PROPAGATION_FIFO + ZT_ADDRESS_LENGTH]; unsigned char newFifo[ZT_PROTO_VERB_MULTICAST_FRAME_LEN_PROPAGATION_FIFO + ZT_ADDRESS_LENGTH];
unsigned char *newFifoPtr = newFifo; unsigned char *newFifoPtr = newFifo;
unsigned char *newFifoEnd = newFifoPtr + sizeof(newFifo); unsigned char *const newFifoEnd = newFifoPtr + sizeof(newFifo);
for(unsigned int i=0;i<ZT_PROTO_VERB_MULTICAST_FRAME_LEN_PROPAGATION_FIFO;) { for(unsigned int i=0;i<ZT_PROTO_VERB_MULTICAST_FRAME_LEN_PROPAGATION_FIFO;) {
unsigned int j = i; unsigned int j = i;
i += ZT_ADDRESS_LENGTH; i += ZT_ADDRESS_LENGTH;