Skip to content

fix: macOS build failure and tautological unsigned comparisons - #78

Merged
rd235 merged 2 commits into
masterfrom
vde-build-fixes
Oct 3, 2026
Merged

rd235 merged 2 commits into
masterfrom
vde-build-fixes

Conversation

@danielinux

Copy link
Copy Markdown
Member

Fixes #72, #12

  • open_memstream.c:32: guard the funopen-based implementation with
    #ifdef HAVE_FUNOPEN (macOS build failure).
  • Fix the five confirmed tautological unsigned comparisons. The sixth
    candidate site (wirefilter.c:214) is not a tautology in the current tree.

Verified: host build passes.

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.
Copilot AI balanced review requested due to automatic review settings October 3, 2026 11:37
@danielinux danielinux linked an issue Oct 3, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The VXLAN receive-error path continues processing uninitialized packet data.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Fixes macOS configuration and unsigned-comparison warnings.

Changes:

  • Corrects HAVE_FUNOPEN guarding.
  • 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.

Comment thread src/vde_vxlan/vxlan.c
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.
@danielinux
danielinux requested a balanced review from Copilot October 3, 2026 11:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rd235 rd235 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@rd235
rd235 merged commit 2651d90 into master Oct 3, 2026
2 checks passed
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.

Build failure on macOS: open_memstream.c: error: #if with no expression Comparison of unsigned expression < 0 is always false

3 participants