Skip to content

Commit

Permalink
replace OGM sequence numbers with anchored hash chain, capacity and i…
Browse files Browse the repository at this point in the history
…nterference aware path metrics, and code refactoring
  • Loading branch information
Axel Neumann committed May 1, 2016
1 parent 947cedd commit 577a0bb
Show file tree
Hide file tree
Showing 47 changed files with 3,960 additions and 2,430 deletions.
9 changes: 5 additions & 4 deletions Common.mk
@@ -1,6 +1,6 @@
GIT_REV ?= $(shell [ -r .git ] && git --no-pager log -n 1 --oneline | cut -d " " -f 1 || echo 0)

CFLAGS += -pedantic -Wall -W -Wno-unused-parameter -Os -g3 -std=gnu99 -DGIT_REV=\"$(GIT_REV)\"
CFLAGS += -pedantic -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Os -g3 -std=gnu99 -DGIT_REV=\"$(GIT_REV)\"
# CFLAGS += -DHAVE_CONFIG_H
# CFLAGS += -DCRYPTLIB=POLARSSL_1_3_4 # POLARSSL_1_2_5 POLARSSL_1_2_9 POLARSSL_1_3_3 POLARSSL_1_3_4 CYASSL_2_8_0

Expand Down Expand Up @@ -66,16 +66,17 @@ CFLAGS += $(shell echo "$(EXTRA_CFLAGS)" | grep -q "DMOST" && echo "-pg -DCORE_L

LDFLAGS += -g3

LDFLAGS += $(shell echo "$(CFLAGS) $(EXTRA_CFLAGS)" | grep -q "DNO_DYNPLUGIN" || echo "-Wl,-export-dynamic -ldl" )
LDFLAGS += $(shell echo "$(CFLAGS) $(EXTRA_CFLAGS)" | grep -q "DNO_DYN_PLUGIN" || echo "-Wl,-export-dynamic -ldl" )
LDFLAGS += $(shell echo "$(CFLAGS) $(EXTRA_CFLAGS)" | grep -q "DPROFILING" && echo "-pg -lc" )
LDFLAGS += $(shell echo "$(CFLAGS) $(EXTRA_CFLAGS)" | grep -q "DBMX7_LIB_IWINFO" && echo "-liwinfo" || echo "-liw" )

LDFLAGS += -lz -lm
LDFLAGS += $(shell echo "$(CFLAGS) $(EXTRA_CFLAGS)" | grep -q "CYASSL" && echo "-lcyassl" || echo "-lpolarssl")

SBINDIR = $(INSTALL_PREFIX)/usr/sbin

SRC_C = bmx.c key.c node.c crypt.c sec.c content.c msg.c z.c desc.c metrics.c ogm.c link.c iptools.c tools.c plugin.c list.c allocate.c avl.c hna.c control.c schedule.c ip.c prof.c
SRC_H = bmx.h key.h node.h crypt.h sec.h content.h msg.h z.h desc.h metrics.h ogm.h link.h iptools.h tools.h plugin.h list.h allocate.h avl.h hna.h control.h schedule.h ip.h prof.h
SRC_C = bmx.c key.c node.c crypt.c sec.c content.c msg.c z.c iid.c desc.c metrics.c ogm.c link.c iptools.c tools.c plugin.c list.c allocate.c avl.c hna.c control.c schedule.c ip.c prof.c
SRC_H = bmx.h key.h node.h crypt.h sec.h content.h msg.h z.h iid.h desc.h metrics.h ogm.h link.h iptools.h tools.h plugin.h list.h allocate.h avl.h hna.h control.h schedule.h ip.h prof.h

SRC_C += $(shell echo "$(CFLAGS) $(EXTRA_CFLAGS)" | grep -q "DTRAFFIC_DUMP" && echo dump.c )
SRC_H += $(shell echo "$(CFLAGS) $(EXTRA_CFLAGS)" | grep -q "DTRAFFIC_DUMP" && echo dump.h )
Expand Down
1 change: 0 additions & 1 deletion Makefile
Expand Up @@ -31,7 +31,6 @@ $(BINARY_NAME): $(OBJS) Makefile Common.mk
%.o: %.c %.h Makefile Common.mk $(SRC_H)
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@


strip: all
strip $(BINARY_NAME)

Expand Down
2 changes: 1 addition & 1 deletion allocate.h
Expand Up @@ -29,7 +29,7 @@ extern uint32_t debugMalloc_objects;

#ifdef DEBUG_MALLOC

// currently used memory tags: -300000, -300001 .. -300768
// currently used memory tags: -300000, -300001 .. -300827
#define debugMalloc( length,tag ) _debugMalloc( (length), (tag), 0 )
#define debugMallocReset( length,tag ) _debugMalloc( (length), (tag), 1 )
#define debugRealloc( mem,length,tag ) _debugRealloc( (mem), (length), (tag) )
Expand Down
315 changes: 177 additions & 138 deletions bmx.c

Large diffs are not rendered by default.

35 changes: 18 additions & 17 deletions bmx.h
Expand Up @@ -23,7 +23,7 @@
#include <stdint.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <linux/if.h>
#include <net/if.h>
#include <linux/rtnetlink.h>


Expand Down Expand Up @@ -62,9 +62,9 @@ typedef int8_t IDM_T; // smallest int which size does NOT matter
//and so on...


#define MIN_COMPATIBILITY CV17
#define MAX_COMPATIBILITY CV18
#define DEF_COMPATIBILITY CV17
#define MIN_COMPATIBILITY CV19
#define MAX_COMPATIBILITY CV20
#define DEF_COMPATIBILITY CV19
#define ARG_COMPATIBILITY "compatibility"
extern int32_t my_compatibility;

Expand Down Expand Up @@ -174,9 +174,6 @@ extern int32_t dad_to;



#define MIN_DHASH_TO 300000
#define DHASH_TO_TOLERANCE_FK 10




Expand All @@ -188,15 +185,17 @@ extern int32_t dad_to;
// deprecated:
typedef uint16_t SQN_T;
#define SQN_MAX ((SQN_T)-1)
#define MAX_SQN_RANGE 8192 // the maxumim of all .._SQN_RANGE ranges, should never be more than SQN_MAX/4

typedef uint32_t PKT_SQN_T;
#define PKT_SQN_MAX ((PKT_SQN_T)-1)


// OGMs:
typedef uint16_t OGM_SQN_T;
#define OGM_SQN_BIT_SIZE (16)

typedef uint16_t ROUGH_DHASH_T;

typedef uint32_t OGM_SQN_T;
#define OGM_SQN_BIT_SIZE (32)
#define OGM_SQN_MASK ((1<<OGM_SQN_BIT_SIZE)-1)
#define OGM_SQN_MAX OGM_SQN_MASK

Expand All @@ -211,7 +210,7 @@ typedef uint16_t AGGREG_SQN_T;
#define AGGREG_SQN_MAX AGGREG_SQN_MASK

#define AGGREG_SQN_CACHE_MASK 0xFF
#define AGGREG_SQN_CACHE_RANGE (AGGREG_SQN_CACHE_MASK+1) //32
#define AGGREG_SQN_CACHE_RANGE (AGGREG_SQN_CACHE_MASK+1)



Expand Down Expand Up @@ -309,6 +308,7 @@ typedef uint32_t DESC_SQN_T;
#define ARG_LIST "list"
#define ARG_SHOW "show"
#define ARG_ORIGINATORS "originators"
#define ARG_KEYS "keys"
#define ARG_STATUS "status"
#define ARG_CREDITS "credits"
#define ARG_DESCREFS "references"
Expand Down Expand Up @@ -423,15 +423,16 @@ enum {
FIELD_TYPE_IPX6P,
FIELD_TYPE_NETP,
FIELD_TYPE_MAC,

FIELD_TYPE_INT,
FIELD_TYPE_FLOAT,
FIELD_TYPE_END
};

#define FIELD_STANDARD_SIZES {-1,-1,-1,-8,-8,(8*sizeof(char*)), \
(8*sizeof(GLOBAL_ID_T*)),(8*sizeof(GLOBAL_ID_T*)),(8*sizeof(GLOBAL_ID_T)), \
(8*sizeof(UMETRIC_T)),(8*sizeof(UMETRIC_T*)),(8*sizeof(FMETRIC_U8_T)), \
(8*sizeof(IP4_T)), (8*sizeof(IPX_T)), (8*sizeof(IPX_T)), (8*sizeof(IP6_T)), \
(8*sizeof(IP6_T*)), (8*sizeof(struct net_key*)), (8*sizeof(MAC_T))}
(8*sizeof(IP6_T*)), (8*sizeof(struct net_key*)), (8*sizeof(MAC_T)), -1, (8*sizeof(float))}
// negative values mean size must be multiple of negativ value, positive values mean absolute bit sizes

#define FIELD_FORMAT_MAX_ITEMS 100
Expand Down Expand Up @@ -554,15 +555,15 @@ enum {
/*
* ASSERTION / PARANOIA ERROR CODES:
* Negative numbers are used as SIGSEV error codes !
* Currently used numbers are: -500000 -500001 ... -502519
* Currently used numbers are: -500000 -500001 ... -502677
*/

//#define paranoia( code , problem ) do { if ( (problem) ) { cleanup_all( code ); } }while(0)
#define assertion( code , condition ) do { if ( !(condition) ) { cleanup_all( code ); } }while(0)
#define assertion_dbg( code , condition, ... ) do { if ( !(condition) ) { dbgf_sys(DBGT_ERR, __VA_ARGS__ ); cleanup_all( code ); } }while(0)
#define assertion( code , condition ) do { if ( code <= -600000 || code > -500000 || !(condition) ) { cleanup_all( code ); } }while(0)
#define assertion_dbg( code , condition, ... ) do { if ( code <= -600000 || code > -500000 || !(condition) ) { dbgf_sys(DBGT_ERR, __VA_ARGS__ ); cleanup_all( code ); } }while(0)

#ifdef EXTREME_PARANOIA
#define ASSERTION( code , condition ) do { if ( !(condition) ) { cleanup_all( code ); } }while(0)
#define ASSERTION( code , condition ) assertion(code, condition)
#define CHECK_INTEGRITY( ) checkIntegrity()
#else
#define CHECK_INTEGRITY( )
Expand Down

0 comments on commit 577a0bb

Please sign in to comment.