[neighbour] Add the ability to artificially delay outbound packets

Add a fault-injection mechanism that allows an arbitrary delay
(configured via config/fault.h) to be added to any packets transmitted
via the neighbour resolution mechanism, as a way of reproducing
symptoms that occur only on high-latency connections such as a
satellite uplink.

The neighbour discovery mechanism is not a natural conceptual fit for
this artficial delay, since neighbour discovery has nothing to do with
transmit latency.  However, the neighbour discovery mechanism happens
to already include a deferred transmission queue that can be (ab)used
to implement this artifical delay in a minimally intrusive way.  In
particular, there is zero code size impact on a standard build with no
artificial delay configured.

Implementing the delay only for packets transmitted via neighbour
resolution has the side effect that broadcast packets (such as DHCP
and ARP) are unaffected.  This is likely in practice to produce a
better emulation of a high-latency uplink scenario, where local
network traffic such as DHCP and ARP will complete quickly and only
the subsequent TCP/UDP traffic will experience delays.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2026-01-06 14:04:00 +00:00
parent 33c832b0d9
commit ff6d612e72
3 changed files with 80 additions and 3 deletions

View File

@@ -14,6 +14,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/* Drop every N transmitted or received network packets */
#define NETDEV_DISCARD_RATE 0
/* Delay transmissions to neighbour-resolved destinations (in ms) */
#define NEIGHBOUR_DELAY_MS 0
/* Drop every N transmitted or received PeerDist discovery packets */
#define PEERDISC_DISCARD_RATE 0