From 7307c991a21840eaebe10bed91b1d3d674565a1d Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Thu, 28 Jun 2012 18:20:38 +0930 Subject: [PATCH] Add mdp.selfannounce.ticks_per_full_address config option --- overlay_packetformats.c | 8 ++++++-- tests/dnaprotocol | 19 ++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/overlay_packetformats.c b/overlay_packetformats.c index 18fe4f5c..3aa91e6d 100644 --- a/overlay_packetformats.c +++ b/overlay_packetformats.c @@ -191,7 +191,6 @@ int packetOkOverlay(int interface,unsigned char *packet,int len, f.bytecount=f.rfs-(offset-ofs); if (f.bytecount<0) { f.bytecount=0; - WHY("negative residual byte count after extracting addresses from frame header"); if (debug&DEBUG_PACKETFORMATS) DEBUGF("f.rfs=%d, offset=%d, ofs=%d", f.rfs, offset, ofs); return WHY("negative residual byte count after extracting addresses from frame header"); } @@ -261,7 +260,12 @@ int overlay_add_selfannouncement(int interface,overlay_buffer *b) if (ob_append_bytes(b,&c,1)) return WHY("ob_append_bytes() could not add self-announcement header"); - int send_prefix=(overlay_interfaces[interface].ticks_since_sent_full_address<4); + static int ticks_per_full_address = -1; + if (ticks_per_full_address == -1) { + ticks_per_full_address = confValueGetInt64("mdp.selfannounce.ticks_per_full_address", 4); + INFOF("ticks_per_full_address = %d", ticks_per_full_address); + } + int send_prefix=(overlay_interfaces[interface].ticks_since_sent_full_address < ticks_per_full_address); /* A TTL for this frame. XXX - BATMAN uses various TTLs, but I think that it may just be better to have all TTL=1, diff --git a/tests/dnaprotocol b/tests/dnaprotocol index 0d72e596..0887cdd4 100755 --- a/tests/dnaprotocol +++ b/tests/dnaprotocol @@ -35,9 +35,12 @@ teardown() { setup_servald_instance() { push_instance set_instance "$1" + executeOk_servald config set debug.interfaces Yes + executeOk_servald config set debug.packetformats Yes executeOk_servald config set interfaces "+>$2" - executeOk_servald config set monitor.socket "org.servalproject.servald.monitor.socket.$1" - executeOk_servald config set mdp.socket "org.servalproject.servald.mdp.socket.$1" + executeOk_servald config set monitor.socket "org.servalproject.servald.monitor.socket.$instance_name" + executeOk_servald config set mdp.socket "org.servalproject.servald.mdp.socket.$instance_name" + executeOk_servald config set mdp.selfannounce.ticks_per_full_address 1 executeOk_servald keyring add assert [ -e "$SERVALINSTANCE_PATH/serval.keyring" ] executeOk_servald keyring list @@ -52,19 +55,17 @@ setup_servald_instance() { } setup_servald_instances() { - setup_servald - DUMMYNET=/tmp/dummy - rm $DUMMYNET - touch $DUMMYNET - assert [ -e $DUMMYNET ] + DUMMYNET=$PWD/dummy + >$DUMMYNET setup_servald_instance +A $DUMMYNET SIDA=$sid setup_servald_instance +B $DUMMYNET SIDB=$sid # Now make sure that they can see each other - sleep 5 # Should be plenty of time + secs=5 + sleep $secs # Should be plenty of time + echo "Dummynet file after $secs seconds: "`ls -l $DUMMYNET` set_instance +A - echo "Dummynet file $DUMMYNET after 5 seconds: "`ls -l $DUMMYNET` executeOk_servald id peers assertStdoutLineCount '==' 1 }