Loading Makefile +27 −6 Original line number Diff line number Diff line SYS := $(shell gcc -dumpmachine) SYS := $(shell gcc -dumpmachine) # LINUX # The automated regression tests run on Linux, so this is the one # environment where things likely will work -- as well as anything # works on the bajillion of different Linux environments ifneq (, $(findstring linux, $(SYS))) LIBS = -lpcap -lm -lrt LIBS = -lpcap -lm -lrt -rdynamic INCLUDES = -I. endif # MAC OS X # I occassionally develope code on Mac OS X, but it's not part of # my regularly regression-test environment. That means at any point # in time, something might be minorly broken in Mac OS X. ifneq (, $(findstring darwin, $(SYS))) LIBS = -lpcap -lm LIBS = -lpcap -lm -rdynamic INCLUDES = -I. endif # MinGW on Windows # I develope on Visual Studio 2010, so that's the Windows environment # that'll work. However, 'git' on Windows runs under MingGW, so one # day I acccidentally typed 'make' instead of 'git, and felt compelled # to then fix all the errors, so this kinda works now. It's not the # intended environment, so it make break in the future. ifneq (, $(findstring mingw, $(SYS))) LIBS = -lwpcap INCLUDES = -I. -Ivs10/include LIBS = -L vs10/lib -lwpcap -lIPHLPAPI endif # Cygwin # I hate Cygwin, use Visual Studio or MingGW instead. I just put this # second here for completeness, or in case I gate tired of hitting my # head with a hammer and want to feel a different sort of pain. ifneq (, $(findstring cygwin, $(SYS))) INCLUDES = -I. LIBS = -lwpcap endif INCLUDES = -I. DEFINES = CC = gcc CFLAGS = -g $(INCLUDES) $(DEFINES) -Wall -O3 -rdynamic -Wno-format CFLAGS = -g $(INCLUDES) $(DEFINES) -Wall -O3 -Wno-format .SUFFIXES: .c .cpp tmp/%.o: src/%.c Loading src/main-dedup.c +45 −45 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ dedup_is_duplicate(struct DedupTable *dedup, unsigned ip, unsigned port) /* THREAT: We've already validated resonses via SYN-cookies, so * therefore we don't need a robust hash for duplicate detection */ hash = ip + port ^ (ip>>8) + (ip>>16) ^ (ip>>24); hash = (ip + port) ^ ((ip>>8) + (ip>>16)) ^ (ip>>24); hash &= DEDUP_ENTRIES-1; /* Search in this bucket */ Loading src/pixie-threads.c +2 −2 Original line number Diff line number Diff line Loading @@ -21,10 +21,10 @@ pixie_begin_thread( unsigned flags, void *worker_data) { #if defined(WIN32) && defined(_MT) #if defined(WIN32) UNUSEDPARM(flags); return _beginthread(worker_thread, 0, worker_data); #elif defined(__GNUC__) #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) typedef void *(*PTHREADFUNC)(void*); pthread_t thread_id; Loading src/rawsock.c +38 −1 Original line number Diff line number Diff line Loading @@ -15,10 +15,47 @@ #ifdef WIN32 #include <Win32-Extensions.h> #include <iphlpapi.h> //#include <iphlpapi.h> #define MAX_ADAPTER_DESCRIPTION_LENGTH 128 // arb. #define MAX_ADAPTER_NAME_LENGTH 256 // arb. #define MAX_ADAPTER_ADDRESS_LENGTH 8 // arb. #define MIB_IF_TYPE_ETHERNET 6 typedef struct { char String[4 * 4]; } IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING; typedef struct _IP_ADDR_STRING { struct _IP_ADDR_STRING* Next; IP_ADDRESS_STRING IpAddress; IP_MASK_STRING IpMask; DWORD Context; } IP_ADDR_STRING, *PIP_ADDR_STRING; typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO* Next; DWORD ComboIndex; char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]; char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]; UINT AddressLength; BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH]; DWORD Index; UINT Type; UINT DhcpEnabled; PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING IpAddressList; IP_ADDR_STRING GatewayList; IP_ADDR_STRING DhcpServer; BOOL HaveWins; IP_ADDR_STRING PrimaryWinsServer; IP_ADDR_STRING SecondaryWinsServer; time_t LeaseObtained; time_t LeaseExpires; } IP_ADAPTER_INFO, *PIP_ADAPTER_INFO; ULONG WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO AdapterInfo, PULONG SizePointer); #if defined(_MSC_VER) #pragma comment(lib, "packet.lib") #pragma comment(lib, "wpcap.lib") #pragma comment(lib, "IPHLPAPI.lib") #endif #elif defined(__GNUC__) #include <unistd.h> Loading Loading
Makefile +27 −6 Original line number Diff line number Diff line SYS := $(shell gcc -dumpmachine) SYS := $(shell gcc -dumpmachine) # LINUX # The automated regression tests run on Linux, so this is the one # environment where things likely will work -- as well as anything # works on the bajillion of different Linux environments ifneq (, $(findstring linux, $(SYS))) LIBS = -lpcap -lm -lrt LIBS = -lpcap -lm -lrt -rdynamic INCLUDES = -I. endif # MAC OS X # I occassionally develope code on Mac OS X, but it's not part of # my regularly regression-test environment. That means at any point # in time, something might be minorly broken in Mac OS X. ifneq (, $(findstring darwin, $(SYS))) LIBS = -lpcap -lm LIBS = -lpcap -lm -rdynamic INCLUDES = -I. endif # MinGW on Windows # I develope on Visual Studio 2010, so that's the Windows environment # that'll work. However, 'git' on Windows runs under MingGW, so one # day I acccidentally typed 'make' instead of 'git, and felt compelled # to then fix all the errors, so this kinda works now. It's not the # intended environment, so it make break in the future. ifneq (, $(findstring mingw, $(SYS))) LIBS = -lwpcap INCLUDES = -I. -Ivs10/include LIBS = -L vs10/lib -lwpcap -lIPHLPAPI endif # Cygwin # I hate Cygwin, use Visual Studio or MingGW instead. I just put this # second here for completeness, or in case I gate tired of hitting my # head with a hammer and want to feel a different sort of pain. ifneq (, $(findstring cygwin, $(SYS))) INCLUDES = -I. LIBS = -lwpcap endif INCLUDES = -I. DEFINES = CC = gcc CFLAGS = -g $(INCLUDES) $(DEFINES) -Wall -O3 -rdynamic -Wno-format CFLAGS = -g $(INCLUDES) $(DEFINES) -Wall -O3 -Wno-format .SUFFIXES: .c .cpp tmp/%.o: src/%.c Loading
src/main-dedup.c +45 −45 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ dedup_is_duplicate(struct DedupTable *dedup, unsigned ip, unsigned port) /* THREAT: We've already validated resonses via SYN-cookies, so * therefore we don't need a robust hash for duplicate detection */ hash = ip + port ^ (ip>>8) + (ip>>16) ^ (ip>>24); hash = (ip + port) ^ ((ip>>8) + (ip>>16)) ^ (ip>>24); hash &= DEDUP_ENTRIES-1; /* Search in this bucket */ Loading
src/pixie-threads.c +2 −2 Original line number Diff line number Diff line Loading @@ -21,10 +21,10 @@ pixie_begin_thread( unsigned flags, void *worker_data) { #if defined(WIN32) && defined(_MT) #if defined(WIN32) UNUSEDPARM(flags); return _beginthread(worker_thread, 0, worker_data); #elif defined(__GNUC__) #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) typedef void *(*PTHREADFUNC)(void*); pthread_t thread_id; Loading
src/rawsock.c +38 −1 Original line number Diff line number Diff line Loading @@ -15,10 +15,47 @@ #ifdef WIN32 #include <Win32-Extensions.h> #include <iphlpapi.h> //#include <iphlpapi.h> #define MAX_ADAPTER_DESCRIPTION_LENGTH 128 // arb. #define MAX_ADAPTER_NAME_LENGTH 256 // arb. #define MAX_ADAPTER_ADDRESS_LENGTH 8 // arb. #define MIB_IF_TYPE_ETHERNET 6 typedef struct { char String[4 * 4]; } IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING; typedef struct _IP_ADDR_STRING { struct _IP_ADDR_STRING* Next; IP_ADDRESS_STRING IpAddress; IP_MASK_STRING IpMask; DWORD Context; } IP_ADDR_STRING, *PIP_ADDR_STRING; typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO* Next; DWORD ComboIndex; char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]; char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]; UINT AddressLength; BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH]; DWORD Index; UINT Type; UINT DhcpEnabled; PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING IpAddressList; IP_ADDR_STRING GatewayList; IP_ADDR_STRING DhcpServer; BOOL HaveWins; IP_ADDR_STRING PrimaryWinsServer; IP_ADDR_STRING SecondaryWinsServer; time_t LeaseObtained; time_t LeaseExpires; } IP_ADAPTER_INFO, *PIP_ADAPTER_INFO; ULONG WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO AdapterInfo, PULONG SizePointer); #if defined(_MSC_VER) #pragma comment(lib, "packet.lib") #pragma comment(lib, "wpcap.lib") #pragma comment(lib, "IPHLPAPI.lib") #endif #elif defined(__GNUC__) #include <unistd.h> Loading