Skip to content

Refs #984: sendpacket: avoid endless retries on ENOBUFS/EAGAIN#986

Open
d3156 wants to merge 1 commit intoappneta:masterfrom
d3156:fix-984-enobufs-retry
Open

Refs #984: sendpacket: avoid endless retries on ENOBUFS/EAGAIN#986
d3156 wants to merge 1 commit intoappneta:masterfrom
d3156:fix-984-enobufs-retry

Conversation

@d3156
Copy link

@d3156 d3156 commented Jan 19, 2026

Refs #984.

Problem

When using the PF_PACKET injection method, sendpacket() may enter an endless retry loop if send() keeps returning ENOBUFS or EAGAIN continuously (e.g., with very large frames or under sustained buffer pressure). This results in 100% CPU usage and tcpreplay never progresses to the next packet.

Change

Introduce a bounded retry loop for transient ENOBUFS/EAGAIN failures:

  • Add a small sleep on retries to avoid busy-looping and unnecessary kernel load.
  • Stop retrying after max_retry_count attempts and return an error so tcpreplay can continue with the next packet.

How to test

  1. Build tcpreplay from this branch.
  2. Replay a pcap that triggers persistent ENOBUFS/EAGAIN on PF_PACKET.
  3. Verify that tcpreplay no longer hangs in an infinite retry loop and instead proceeds (or reports failure) after the retry limit.

Values are currently hard-coded and can be made configurable if maintainers prefer.

@d3156 d3156 changed the title Fix #984: sendpacket: avoid endless retries on ENOBUFS/EAGAIN Refs #984: sendpacket: avoid endless retries on ENOBUFS/EAGAIN Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant