Add mdp.selfannounce.ticks_per_full_address config option

This commit is contained in:
Andrew Bettison 2012-06-28 18:20:38 +09:30
parent b368a3aab4
commit 7307c991a2
2 changed files with 16 additions and 11 deletions

View File

@ -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,

View File

@ -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
}