xdptap - Fault Injection: Corrupting Packets
 
 

xdptap - Fault Injection: Corrupting Packets

May 25, 2025
development, projects, HOWTO
xdptap, IXDP, AF_XDP, libxdp, RPCL

Overview #

xdptap allows to corrupt packets by flipping one single bit at a random position in the packet payload data. For general usage and restricting fault injection to specific MAC addresses see xdptap - Fault Injection: Dropping Packets.

Further related posts:

The area where one single bit is flipped starts at byte 15 always leaving the destination MAC address, the source MAC address and the first Ethertype untouched. With nested VLANs, the VLAN-ID thus may also become wrong.

RPCL Control #

Setting the Packet Corruption “Bitflip” Probability #

fault.bitflip.probability #

set FI bitflip probability in 1/100000 units ( probability interface - )

The fault.bitflip.probability is interface specific and can be set in 1/100000 units. The default value is 0 (0.000%).

Example:

ok 1000 0 fault.bitflip.probability # setting 1% for interface 0 
ok if.stats
0 enp1s0f0 ixgbe queues:1 ZEROCOPY
  rx                    16467306
  tx                    510634
  drop                  0
  noif                  0
  err                   0
  RX tap                disabled
  TX tap                disabled
  fault injection       disabled
    drop probability    0 (0.000%) 
    bitflip probability 1000 (1.000%)
    dup probability     0 (0.000%) 
    dropped by FI       0
    bitflipped by FI    0
    duplicated by FI    0
1 enp1s0f1 ixgbe queues:1 ZEROCOPY
  rx                    510640
  tx                    16467306
  drop                  6
  noif                  0
  err                   0
  RX tap                disabled
  TX tap                disabled
  fault injection       disabled
    drop probability    0 (0.000%) 
    bitflip probability 0 (0.000%) 
    dup probability     0 (0.000%) 
    dropped by FI       0
    bitflipped by FI    0
    duplicated by FI    0
ok

To be effective, the desired source interface needs to be enabled for fault injection with fault.enable, see xdptap - Fault Injection: Dropping Packets.

Tips #

  • The ping utility reports corrupted data, here it’s good to know that packet corruption needs to be active in the backward direction corrupting the reply only (Linux doesn’t answer corrupted ICMP echo requests).
  • The effect on Linux can be examined with the nstat utility on a system receiving corrupted packets.
  • The overall effect of corrupted packets is comparable with packet loss at the same probability.