Bug 38

Summary: Use pkt_buf (buffer for packets from guest/container) as ringbuffer
Product: passt Reporter: Stefano Brivio <sbrivio>
Component: generalAssignee: nobody
Status: CONFIRMED ---    
Severity: enhancement    
Priority: Low    
Version: unspecified   
Hardware: All   
OS: Linux   

Description Stefano Brivio 2022-11-10 12:59:02 UTC
At the moment, tap_handler_passt() reads a batch of packets into pkt_buf, and tries to ensure that there's one full packet at the end of it by blocking recv() calls requesting a given amount of bytes.

This doesn't actually guarantee what we want, at least in theory, and also the blocking recv() calls are not really nice to have there.

We could instead use pkt_buf as ringbuffer: read a given amount of data, scan for packets, and if one packet at the end isn't complete at the end, just keep a pointer to it and deal with it later.

See also:
  https://archives.passt.top/passt-dev/20221109112929.0ee6c107@elisabeth/