mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 05:07:56 +00:00
Ensure directory service tests aren't creating a global routing table
This commit is contained in:
parent
e375e17faa
commit
f4e6841ed7
@ -475,6 +475,7 @@ ATOM(short, type, OVERLAY_INTERFACE_WIFI, interface_t
|
|||||||
SUB_STRUCT(mdp_iftype, mdp,)
|
SUB_STRUCT(mdp_iftype, mdp,)
|
||||||
ATOM(bool_t, send_broadcasts, 1, boolean,, "If false, don't send any broadcast packets")
|
ATOM(bool_t, send_broadcasts, 1, boolean,, "If false, don't send any broadcast packets")
|
||||||
ATOM(bool_t, default_route, 0, boolean,, "If true, use this interface as a default route")
|
ATOM(bool_t, default_route, 0, boolean,, "If true, use this interface as a default route")
|
||||||
|
ATOM(bool_t, dont_route, 0, boolean,, "If true, do not advertise any links discovered on this interface")
|
||||||
ATOM(bool_t, prefer_unicast, 1, boolean,, "If true, send data as unicast IP packets if available")
|
ATOM(bool_t, prefer_unicast, 1, boolean,, "If true, send data as unicast IP packets if available")
|
||||||
ATOM(bool_t, debug, 0, boolean,, "If true, log details of every outgoing packet")
|
ATOM(bool_t, debug, 0, boolean,, "If true, log details of every outgoing packet")
|
||||||
ATOM(bool_t, point_to_point, 0, boolean,, "If true, assume there will only be two devices on this interface")
|
ATOM(bool_t, point_to_point, 0, boolean,, "If true, assume there will only be two devices on this interface")
|
||||||
|
@ -414,6 +414,7 @@ overlay_interface_init(const char *name, struct socket_address *addr,
|
|||||||
interface->port = ifconfig->port;
|
interface->port = ifconfig->port;
|
||||||
interface->type = ifconfig->type;
|
interface->type = ifconfig->type;
|
||||||
interface->send_broadcasts = ifconfig->send_broadcasts;
|
interface->send_broadcasts = ifconfig->send_broadcasts;
|
||||||
|
interface->dont_route = ifconfig->dont_route;
|
||||||
interface->prefer_unicast = ifconfig->prefer_unicast;
|
interface->prefer_unicast = ifconfig->prefer_unicast;
|
||||||
interface->default_route = ifconfig->default_route;
|
interface->default_route = ifconfig->default_route;
|
||||||
interface->socket_type = ifconfig->socket_type;
|
interface->socket_type = ifconfig->socket_type;
|
||||||
|
@ -105,6 +105,7 @@ typedef struct overlay_interface {
|
|||||||
int type;
|
int type;
|
||||||
int socket_type;
|
int socket_type;
|
||||||
char send_broadcasts;
|
char send_broadcasts;
|
||||||
|
char dont_route;
|
||||||
char prefer_unicast;
|
char prefer_unicast;
|
||||||
/* Not necessarily the real MTU, but the largest frame size we are willing to TX.
|
/* Not necessarily the real MTU, but the largest frame size we are willing to TX.
|
||||||
For radio links the actual maximum and the maximum that is likely to be delivered reliably are
|
For radio links the actual maximum and the maximum that is likely to be delivered reliably are
|
||||||
|
22
route_link.c
22
route_link.c
@ -557,14 +557,19 @@ static int append_link(struct subscriber *subscriber, void *context)
|
|||||||
if (subscriber->identity)
|
if (subscriber->identity)
|
||||||
keyring_send_unlock(subscriber);
|
keyring_send_unlock(subscriber);
|
||||||
|
|
||||||
if (state->next_update - 20 <= now){
|
if (best_link && best_link->destination && best_link->destination->interface->dont_route){
|
||||||
if (append_link_state(payload, 0, state->transmitter, subscriber, -1,
|
// don't talk about links across interfaces with dont_route
|
||||||
best_link?best_link->link_version:-1, -1, 0, best_link?best_link->drop_rate:32)){
|
state->next_update = TIME_MS_NEVER_WILL;
|
||||||
ALARM_STRUCT(link_send).alarm = now+5;
|
}else{
|
||||||
return 1;
|
if (state->next_update - 20 <= now){
|
||||||
|
if (append_link_state(payload, 0, state->transmitter, subscriber, -1,
|
||||||
|
best_link?best_link->link_version:-1, -1, 0, best_link?best_link->drop_rate:32)){
|
||||||
|
ALARM_STRUCT(link_send).alarm = now+5;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// include information about this link every 5s
|
||||||
|
state->next_update = now + 5000;
|
||||||
}
|
}
|
||||||
// include information about this link every 5s
|
|
||||||
state->next_update = now + 5000;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -895,9 +900,8 @@ static int link_send_neighbours()
|
|||||||
while (n){
|
while (n){
|
||||||
neighbour_find_best_link(n);
|
neighbour_find_best_link(n);
|
||||||
|
|
||||||
if (n->next_neighbour_update <= now){
|
if (n->next_neighbour_update <= now)
|
||||||
send_neighbour_link(n);
|
send_neighbour_link(n);
|
||||||
}
|
|
||||||
|
|
||||||
if (n->next_neighbour_update < ALARM_STRUCT(link_send).alarm)
|
if (n->next_neighbour_update < ALARM_STRUCT(link_send).alarm)
|
||||||
ALARM_STRUCT(link_send).alarm = n->next_neighbour_update;
|
ALARM_STRUCT(link_send).alarm = n->next_neighbour_update;
|
||||||
|
@ -105,6 +105,7 @@ configure_node() {
|
|||||||
set interfaces.0.file dummy1 \
|
set interfaces.0.file dummy1 \
|
||||||
set interfaces.0.socket_type file \
|
set interfaces.0.socket_type file \
|
||||||
set interfaces.0.send_broadcasts 0 \
|
set interfaces.0.send_broadcasts 0 \
|
||||||
|
set interfaces.0.dont_route 1 \
|
||||||
set interfaces.0.drop_broadcasts on \
|
set interfaces.0.drop_broadcasts on \
|
||||||
set interfaces.0.default_route 1 \
|
set interfaces.0.default_route 1 \
|
||||||
set interfaces.0.dummy_address 10.0.${instance_number}.1 \
|
set interfaces.0.dummy_address 10.0.${instance_number}.1 \
|
||||||
@ -141,17 +142,24 @@ test_routing() {
|
|||||||
set_instance +B
|
set_instance +B
|
||||||
executeOk_servald route print
|
executeOk_servald route print
|
||||||
assertStdoutGrep --matches=1 "^$SIDA:UNICAST:"
|
assertStdoutGrep --matches=1 "^$SIDA:UNICAST:"
|
||||||
|
assertStdoutGrep --matches=0 "^$SIDC:"
|
||||||
executeOk_servald dna lookup "$DIDC"
|
executeOk_servald dna lookup "$DIDC"
|
||||||
assertStdoutLineCount '==' 3
|
assertStdoutLineCount '==' 3
|
||||||
assertStdoutGrep --matches=1 "^sid://$SIDC/local/$DIDC:$DIDC:$NAMEC\$"
|
assertStdoutGrep --matches=1 "^sid://$SIDC/local/$DIDC:$DIDC:$NAMEC\$"
|
||||||
set_instance +C
|
set_instance +C
|
||||||
executeOk_servald route print
|
executeOk_servald route print
|
||||||
assertStdoutGrep --matches=1 "^$SIDA:UNICAST:"
|
assertStdoutGrep --matches=1 "^$SIDA:UNICAST:"
|
||||||
|
assertStdoutGrep --matches=0 "^$SIDB:"
|
||||||
executeOk_servald dna lookup "$DIDB"
|
executeOk_servald dna lookup "$DIDB"
|
||||||
assertStdoutLineCount '==' 3
|
assertStdoutLineCount '==' 3
|
||||||
assertStdoutGrep --matches=1 "^sid://$SIDB/local/$DIDB:$DIDB:$NAMEB\$"
|
assertStdoutGrep --matches=1 "^sid://$SIDB/local/$DIDB:$DIDB:$NAMEB\$"
|
||||||
executeOk_servald mdp ping $SIDB 3
|
executeOk_servald mdp ping $SIDB 3
|
||||||
tfw_cat --stdout --stderr
|
tfw_cat --stdout --stderr
|
||||||
|
executeOk_servald route print
|
||||||
|
tfw_cat --stdout
|
||||||
|
set_instance +B
|
||||||
|
executeOk_servald route print
|
||||||
|
tfw_cat --stdout
|
||||||
assert_status_all_servald_servers running
|
assert_status_all_servald_servers running
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user