fix: macOS build failure and tautological unsigned comparisons - #78
Merged
Merged
Conversation
open_memstream.c used '#if HAVE_FUNOPEN', which is a preprocessor error when the macro is not defined with a value; use '#ifdef' so the file compiles on systems without funopen (reported as a MacPorts build failure). Fix the dead 'unsigned < 0' comparisons flagged by clang: - vxlan.c: recvfrom() returns ssize_t, store it in ssize_t so the error check is not dead code - vde_autolink.c: port_reserve() returns -1 on failure; it was assigned to the unsigned portno before the check, turning the failure sentinel into a huge port number. Check the signed return value first, then assign. - wirefilter.c: delay is unsigned long long, so the three 'delay < 0' terms are always false; drop them (the meaningful markovdelay >= 0 and speeddelay > 0 guards are kept). Fixes #72, fixes #12.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The VXLAN receive-error path continues processing uninitialized packet data.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Fixes macOS configuration and unsigned-comparison warnings.
Changes:
- Corrects
HAVE_FUNOPENguarding. - Uses signed values where negative results are meaningful.
- Removes tautological delay comparisons.
| File | Description |
|---|---|
src/common/open_memstream.c |
Fixes feature guard. |
src/vde_autolink.c |
Checks port allocation before unsigned assignment. |
src/vde_vxlan/vxlan.c |
Corrects recvfrom() result type. |
src/wirefilter.c |
Removes impossible comparisons. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
A failed recvfrom() left pkt uninitialized and continued the function, ultimately passing len - offsetof(struct vxlan_pkt, pkt) - a huge size_t - to plug_send(). Return immediately after logging the receive failure. Addresses Copilot review on PR #78.
rd235
approved these changes
Oct 3, 2026
rd235
left a comment
Member
There was a problem hiding this comment.
open_memstream.c bugfix (#if instead of #ifdef) OK
vxlan.c: recvfrom retvalue type mistaken. fix ok
vde_autolink.c: this is not a bug. the code has the same beahior, the proposed patched code is more readable. OK
wirefilter.c: bug: negative checks on unsigned int: fix ok
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #72, #12
#ifdef HAVE_FUNOPEN (macOS build failure).
candidate site (wirefilter.c:214) is not a tautology in the current tree.
Verified: host build passes.