mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-21 01:42:18 +00:00
Fix intermittent 'routing' test failures
Caused by tests running so slowly that nodes become unreachable due to timeout before the assertion of reachability is made. The timeout was hard coded at five times the tick interval (2.5 seconds). Introduced new config options: mdp.iftype.*.reachable_timeout_ms and interface.*.mdp.reachable_timeout_ms to allow the timeout to be configured. Configure the timeout to 60 seconds in 'routing' tests. Changed the config schema to move options interfaces.*.mdp_tick_ms and interfaces.*.packet_interval into interfaces.*.mdp.tick_ms and interfaces.*.mdp.packet_interval (introduced new sub-struct 'mdp').
This commit is contained in:
parent
2119433bb0
commit
c9f9025581
@ -326,8 +326,9 @@ ATOM(uint32_t, uid, 0, uint32_nonzero,, "Allowed UID for mon
|
||||
END_STRUCT
|
||||
|
||||
STRUCT(mdp_iftype)
|
||||
ATOM(int32_t, tick_ms, -1, int32_nonneg,, "Tick interval for this interface type")
|
||||
ATOM(int32_t, tick_ms, -1, int32_nonneg,, "Tick interval")
|
||||
ATOM(int32_t, packet_interval, -1, int32_nonneg,, "Minimum interval between packets in microseconds")
|
||||
ATOM(int32_t, reachable_timeout_ms, -1, int32_nonneg,, "Inactivity timeout after which node considered unreachable")
|
||||
END_STRUCT
|
||||
|
||||
ARRAY(mdp_iftypelist, NO_DUPLICATES)
|
||||
@ -447,8 +448,7 @@ ATOM(bool_t, drop_broadcasts, 0, boolean,, "If true, drop all inc
|
||||
ATOM(bool_t, drop_unicasts, 0, boolean,, "If true, drop all incoming unicast packets")
|
||||
ATOM(uint16_t, drop_packets, 0, uint16_nonzero,, "Percentage of incoming packets that should be dropped for testing purposes")
|
||||
ATOM(short, type, OVERLAY_INTERFACE_WIFI, interface_type,, "Type of network interface")
|
||||
ATOM(int32_t, packet_interval, -1, int32_nonneg,, "Minimum interval between packets in microseconds")
|
||||
ATOM(int32_t, mdp_tick_ms, -1, int32_nonneg,, "Override MDP tick interval for this interface")
|
||||
SUB_STRUCT(mdp_iftype, mdp,)
|
||||
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, prefer_unicast, 0, boolean,, "If true, send unicast data as unicast IP packets if available")
|
||||
|
@ -427,6 +427,7 @@ overlay_interface_init(const char *name, struct in_addr src_addr, struct in_addr
|
||||
// How often do we announce ourselves on this interface?
|
||||
int tick_ms=-1;
|
||||
int packet_interval=-1;
|
||||
int reachable_timeout_ms = -1;
|
||||
|
||||
// hard coded defaults:
|
||||
switch (ifconfig->type) {
|
||||
@ -455,13 +456,17 @@ overlay_interface_init(const char *name, struct in_addr src_addr, struct in_addr
|
||||
tick_ms = config.mdp.iftype.av[i].value.tick_ms;
|
||||
if (config.mdp.iftype.av[i].value.packet_interval>=0)
|
||||
packet_interval=config.mdp.iftype.av[i].value.packet_interval;
|
||||
if (config.mdp.iftype.av[i].value.reachable_timeout_ms >= 0)
|
||||
reachable_timeout_ms = config.mdp.iftype.av[i].value.reachable_timeout_ms;
|
||||
}
|
||||
}
|
||||
// specific value for this interface
|
||||
if (ifconfig->mdp_tick_ms>=0)
|
||||
tick_ms = ifconfig->mdp_tick_ms;
|
||||
if (ifconfig->packet_interval>=0)
|
||||
packet_interval=ifconfig->packet_interval;
|
||||
if (ifconfig->mdp.tick_ms>=0)
|
||||
tick_ms = ifconfig->mdp.tick_ms;
|
||||
if (ifconfig->mdp.packet_interval>=0)
|
||||
packet_interval=ifconfig->mdp.packet_interval;
|
||||
if (ifconfig->mdp.reachable_timeout_ms >= 0)
|
||||
reachable_timeout_ms = ifconfig->mdp.reachable_timeout_ms;
|
||||
|
||||
if (packet_interval<0)
|
||||
return WHYF("Invalid packet interval %d specified for interface %s", packet_interval, name);
|
||||
@ -477,6 +482,7 @@ overlay_interface_init(const char *name, struct in_addr src_addr, struct in_addr
|
||||
return WHYF("No tick interval specified for interface %s", name);
|
||||
|
||||
interface->destination->tick_ms = tick_ms;
|
||||
interface->destination->reachable_timeout_ms = reachable_timeout_ms >= 0 ? reachable_timeout_ms : tick_ms > 0 ? tick_ms * 5 : 2500;
|
||||
|
||||
limit_init(&interface->destination->transfer_limit, packet_interval);
|
||||
|
||||
|
@ -1342,8 +1342,8 @@ int link_receive(struct overlay_frame *frame, overlay_mdp_frame *mdp)
|
||||
changed = 1;
|
||||
version++;
|
||||
}
|
||||
neighbour->link_in_timeout = now + interface->destination->tick_ms * 5;
|
||||
|
||||
neighbour->link_in_timeout = now + interface->destination->reachable_timeout_ms;
|
||||
|
||||
if (drop_rate != link->drop_rate || transmitter != link->transmitter)
|
||||
version++;
|
||||
|
||||
@ -1454,7 +1454,7 @@ int link_state_legacy_ack(struct overlay_frame *frame, time_ms_t now)
|
||||
nl->link_timeout = now + (link->destination->tick_ms *5);
|
||||
|
||||
neighbour->legacy_protocol = 1;
|
||||
neighbour->link_in_timeout = now + link->destination->tick_ms * 5;
|
||||
neighbour->link_in_timeout = now + link->destination->reachable_timeout_ms;
|
||||
|
||||
if (changed){
|
||||
route_version++;
|
||||
|
28
serval.h
28
serval.h
@ -445,18 +445,24 @@ struct network_destination {
|
||||
// rate limit for outgoing packets
|
||||
struct limit_state transfer_limit;
|
||||
|
||||
/* Number of milli-seconds per tick for this interface, which is basically related to the
|
||||
the typical TX range divided by the maximum expected speed of nodes in the network.
|
||||
This means that short-range communications has a higher bandwidth requirement than
|
||||
long-range communications because the tick interval has to be shorter to still allow
|
||||
fast-convergence time to allow for mobility.
|
||||
|
||||
For wifi (nominal range 100m) it is usually 500ms.
|
||||
For ~100K ISM915MHz (nominal range 1000m) it will probably be about 5000ms.
|
||||
For ~10K ISM915MHz (nominal range ~3000m) it will probably be about 15000ms.
|
||||
These figures will be refined over time, and we will allow people to set them per-interface.
|
||||
/* Number of milli-seconds per tick for this interface, which is basically
|
||||
* related to the the typical TX range divided by the maximum expected
|
||||
* speed of nodes in the network. This means that short-range communications
|
||||
* has a higher bandwidth requirement than long-range communications because
|
||||
* the tick interval has to be shorter to still allow fast-convergence time
|
||||
* to allow for mobility.
|
||||
*
|
||||
* For wifi (nominal range 100m) it is usually 500ms.
|
||||
* For ~100K ISM915MHz (nominal range 1000m) it will probably be about 5000ms.
|
||||
* For ~10K ISM915MHz (nominal range ~3000m) it will probably be about 15000ms.
|
||||
*
|
||||
* These figures will be refined over time, and we will allow people to set
|
||||
* them per-interface.
|
||||
*/
|
||||
unsigned tick_ms; /* milliseconds per tick */
|
||||
unsigned tick_ms;
|
||||
|
||||
// Number of milliseconds of no packets until we assume the link is dead.
|
||||
unsigned reachable_timeout_ms;
|
||||
};
|
||||
|
||||
struct network_destination * new_destination(struct overlay_interface *interface, char encapsulation);
|
||||
|
@ -238,7 +238,7 @@ start_radio_instance() {
|
||||
set log.console.show_pid on \
|
||||
set log.console.show_time on \
|
||||
set interfaces.1.type CATEAR \
|
||||
set interfaces.1.mdp_tick_ms 5000 \
|
||||
set interfaces.1.mdp.tick_ms 5000 \
|
||||
set interfaces.1.socket_type STREAM \
|
||||
set interfaces.1.encapsulation SINGLE \
|
||||
set interfaces.1.point_to_point on
|
||||
|
@ -234,11 +234,11 @@ setup_simulate_extender() {
|
||||
set debug.packetradio on \
|
||||
set debug.mavlink on \
|
||||
set interfaces.1.type CATEAR \
|
||||
set interfaces.1.mdp_tick_ms 5000 \
|
||||
set interfaces.1.mdp.tick_ms 5000 \
|
||||
set interfaces.1.mdp.packet_interval 5000 \
|
||||
set interfaces.1.socket_type STREAM \
|
||||
set interfaces.1.encapsulation SINGLE \
|
||||
set interfaces.1.point_to_point on \
|
||||
set interfaces.1.packet_interval 5000
|
||||
set interfaces.1.point_to_point on
|
||||
foreach_instance +A +B start_routing_instance
|
||||
}
|
||||
test_simulate_extender() {
|
||||
@ -722,6 +722,9 @@ setup_crowded_mess() {
|
||||
foreach_instance +D +F add_interface 5
|
||||
foreach_instance +E +G add_interface 6
|
||||
foreach_instance +F +G +H add_interface 7
|
||||
foreach_instance +A +B +C +D +E +F +G +H \
|
||||
executeOk_servald config \
|
||||
set mdp.iftype.wifi.reachable_timeout_ms 60000
|
||||
foreach_instance +A +B +C +D +E +F +G +H start_routing_instance
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user