HomeClusterLabs Projects

[host] fix defrag buffers reclaim logic

Description

[host] fix defrag buffers reclaim logic

The problem:

  • let's assume a 2 nodes (A and B) cluster setup
  • node A sends fragmented packets to node B and there is packet loss on the network.
  • node B receives all those fragments and attempts to reassemble them.
  • node A sends packet seq_num X in Y fragments.
  • node B receives only part of the fragments and stores them in a defrag buf.
  • packet loss stops.
  • node A continues to send packets and a seq_num roll-over takes place.
  • node A sends a new packet seq_num X in Y fragments.
  • node B gets confused here because the parts of the old packet seq_num X are still stored and the buffer has not been reclaimed.
  • node B continues to rebuild packet seq_num X with old stale data and new data from after the roll-over.
  • node B completes reassembling the packet and delivers junk to the application.

The solution:

Add a much stronger buffer reclaim logic that will apply
on each received packet and not only when defrag buffers
are needed, as there might be a mix of fragmented and not
fragmented packets in-flight.

The new logic creates a window of N packets that can be
handled at the same time (based on the number of buffers)
and clear everything else.

Fixes https://github.com/kronosnet/kronosnet/issues/261

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>

Details

Provenance
fabbioneAuthored on Oct 15 2019, 12:53 AM
Parents
rK7923e1864f6c: [host] rename variables to make it easier to read the code
Branches
Unknown
Tags
Unknown

Event Timeline