Skip to content

fix: infinite packet processing loop breaking on errors/duplicates#7

Open
KimNorgaard wants to merge 1 commit into
pyke369:masterfrom
KimNorgaard:fix/packet-loop-break-bug
Open

fix: infinite packet processing loop breaking on errors/duplicates#7
KimNorgaard wants to merge 1 commit into
pyke369:masterfrom
KimNorgaard:fix/packet-loop-break-bug

Conversation

@KimNorgaard

Copy link
Copy Markdown

The DHCP packet receiver and processor loop in main.go improperly used break statements. Because there are no nested/inner for loops or switch statements around them, these breaks would completely exit the main packet processing loop.

When this occurred:

  • A duplicate request arrived,
  • A non-request packet without an existing context was parsed,
  • Address resolution failed, or
  • Sending a response packet to a client encountered a network write error,

the server would exit the loop, terminate processing of all future DHCP packets, and exit.

This commit replaces all incorrect break statements in the packet processing loop with continue, ensuring that the server skips the problematic packet/operation and continues processing subsequent packets.

The DHCP packet receiver and processor loop in main.go improperly
used `break` statements. Because there are no nested/inner for
loops or switch statements around them, these `break`s would
completely exit the main packet processing loop.

When this occurred:

- A duplicate request arrived,
- A non-request packet without an existing context was parsed,
- Address resolution failed, or
- Sending a response packet to a client encountered a network write error,

the server would exit the loop, terminate processing of all future DHCP
packets, and exit.

This commit replaces all incorrect `break` statements in the packet
processing loop with `continue`, ensuring that the server skips the
problematic packet/operation and continues processing subsequent packets.
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