mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-04-07 02:56:44 +00:00
Wait until sid from local keyring is unreachable before claiming ownership
This commit is contained in:
parent
ef7351bddc
commit
0c1c767af0
@ -423,6 +423,12 @@ next:
|
||||
if (set_reachable(subscriber, destination, next_hop))
|
||||
changed = 1;
|
||||
|
||||
if (subscriber->identity && subscriber->reachable==REACHABLE_NONE){
|
||||
subscriber->reachable=REACHABLE_SELF;
|
||||
if (config.debug.overlayrouting || config.debug.linkstate)
|
||||
DEBUGF("REACHABLE via self %s", alloca_tohex_sid_t(subscriber->sid));
|
||||
}
|
||||
|
||||
if (changed){
|
||||
monitor_announce_link(best_hop_count, transmitter, subscriber);
|
||||
state->next_update = now+5;
|
||||
|
@ -146,6 +146,57 @@ test_multiple_ids() {
|
||||
assertStdoutGrep --matches=1 "^$SIDA2:INDIRECT::$SIDA1"
|
||||
}
|
||||
|
||||
doc_unlock_ids="Routes appear and disappear as identities are [un]locked"
|
||||
setup_unlock_ids() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
set_instance +A
|
||||
executeOk_servald keyring add 'entry-pin'
|
||||
extract_stdout_keyvalue SIDX sid "$rexp_sid"
|
||||
foreach_instance +A +B start_routing_instance
|
||||
}
|
||||
test_unlock_ids() {
|
||||
wait_until path_exists +A +B
|
||||
wait_until path_exists +B +A
|
||||
set_instance +A
|
||||
executeOk_servald id enter pin 'entry-pin'
|
||||
wait_until has_link +B +A +A $SIDA $SIDX
|
||||
set_instance +A
|
||||
executeOk_servald id revoke pin 'entry-pin'
|
||||
set_instance +B
|
||||
wait_until --timeout=30 sid_offline $SIDX
|
||||
}
|
||||
|
||||
doc_migrate_id="Unlocking the same identity triggers migration"
|
||||
setup_migrate_id() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
set_instance +A
|
||||
executeOk_servald keyring add 'entry-pin'
|
||||
extract_stdout_keyvalue SIDX sid "$rexp_sid"
|
||||
executeOk_servald keyring dump --entry-pin=entry-pin --secret sidx
|
||||
tfw_cat sidx
|
||||
set_instance +B
|
||||
executeOk_servald keyring load sidx '' 'entry-pin'
|
||||
foreach_instance +A +B create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B start_routing_instance
|
||||
}
|
||||
test_migrate_id() {
|
||||
wait_until path_exists +A +B
|
||||
wait_until path_exists +B +A
|
||||
set_instance +A
|
||||
executeOk_servald id enter pin 'entry-pin'
|
||||
wait_until has_link +B +A +A $SIDA $SIDX
|
||||
set_instance +B
|
||||
executeOk_servald id enter pin 'entry-pin'
|
||||
set_instance +A
|
||||
executeOk_servald id revoke pin 'entry-pin'
|
||||
wait_until --timeout=30 has_link +A +B +B $SIDB $SIDX
|
||||
}
|
||||
|
||||
doc_single_mdp="Use single MDP per packet encapsulation"
|
||||
setup_single_mdp() {
|
||||
setup_servald
|
||||
@ -455,6 +506,12 @@ setup_offline() {
|
||||
foreach_instance +A +B +C +D start_routing_instance
|
||||
}
|
||||
|
||||
sid_offline() {
|
||||
if ! grep "NOT REACHABLE sid=${1}" $instance_servald_log; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
instance_offline() {
|
||||
local I N
|
||||
for I; do
|
||||
@ -462,7 +519,7 @@ instance_offline() {
|
||||
for ((N=1; 1; ++N)); do
|
||||
local sidvar=SID${I#+}$N
|
||||
[ -n "${!sidvar}" ] || break
|
||||
if ! grep "NOT REACHABLE sid=${!sidvar}" $instance_servald_log; then
|
||||
if sid_offline ${!sidvar}; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user