diff options
author | David Howells <dhowells@redhat.com> | 2016-09-17 10:49:15 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2016-09-17 11:24:04 +0100 |
commit | 8a681c360559f75a80b37e6a6a9590457361ccb0 (patch) | |
tree | 12f2fa34048a73aae064a02fa15417b4c70b3573 /net/rxrpc/input.c | |
parent | 71f3ca408fd43b586c02480768a503af075b247e (diff) | |
download | op-kernel-dev-8a681c360559f75a80b37e6a6a9590457361ccb0.zip op-kernel-dev-8a681c360559f75a80b37e6a6a9590457361ccb0.tar.gz |
rxrpc: Add config to inject packet loss
Add a configuration option to inject packet loss by discarding
approximately every 8th packet received and approximately every 8th DATA
packet transmitted.
Note that no locking is used, but it shouldn't really matter.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/rxrpc/input.c')
-rw-r--r-- | net/rxrpc/input.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c index 84bb16d..7ac1edf 100644 --- a/net/rxrpc/input.c +++ b/net/rxrpc/input.c @@ -712,6 +712,14 @@ void rxrpc_data_ready(struct sock *udp_sk) skb_orphan(skb); sp = rxrpc_skb(skb); + if (IS_ENABLED(CONFIG_AF_RXRPC_INJECT_LOSS)) { + static int lose; + if ((lose++ & 7) == 7) { + rxrpc_lose_skb(skb, rxrpc_skb_rx_lost); + return; + } + } + _net("Rx UDP packet from %08x:%04hu", ntohl(ip_hdr(skb)->saddr), ntohs(udp_hdr(skb)->source)); |