Skip to content

fix: using incomplete struct sockaddr_in#130

Merged
sergio-nsk merged 1 commit into
masterfrom
sergio-nsk/netinet-in/1
Mar 31, 2026
Merged

fix: using incomplete struct sockaddr_in#130
sergio-nsk merged 1 commit into
masterfrom
sergio-nsk/netinet-in/1

Conversation

@sergio-nsk
Copy link
Copy Markdown
Collaborator

@sergio-nsk sergio-nsk commented Mar 31, 2026

Some platform SDKs don't #include <netinet/in.h> in sys/socket.h.

Summary by CodeRabbit

  • Chores
    • Enhanced build system compatibility for non-Windows platforms through conditional header availability checks and includes.

Some platform SDKs don't `#include <netinet/in.h>` in `sys/socket.h`.
@sergio-nsk sergio-nsk requested a review from nmoinvaz March 31, 2026 01:03
@sergio-nsk sergio-nsk added the bug Something isn't working label Mar 31, 2026
Copilot AI review requested due to automatic review settings March 31, 2026 01:03
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ea3436e9-819a-4b84-a96c-e830f06605b7

📥 Commits

Reviewing files that changed from the base of the PR and between c34bf91 and 24634a3.

📒 Files selected for processing (4)
  • CMakeLists.txt
  • net_util.c
  • proxyres_config.h.in
  • wpad_dhcp_posix.c

📝 Walkthrough

Walkthrough

The changes add support for conditionally including the netinet/in.h header across multiple source files by introducing a CMake feature check that detects its availability at build time and exposing the result through a configuration macro.

Changes

Cohort / File(s) Summary
Build Configuration
CMakeLists.txt, proxyres_config.h.in
Added CMake header check for netinet/in.h on non-Windows builds and defined HAVE_NETINET_IN_H configuration macro.
Source Code Updates
net_util.c, wpad_dhcp_posix.c
Added conditional includes of <netinet/in.h> guarded by HAVE_NETINET_IN_H macro checks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

Suggested reviewers

  • nmoinvaz

Poem

🐰 A header check so neat and tidy,
For netinet/in, our quest is nigh!
Conditional includes, bright and clean,
The best portability we've ever seen! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main fix: addressing the incomplete struct sockaddr_in issue by adding the missing netinet/in.h include.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sergio-nsk/netinet-in/1

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.77%. Comparing base (df114f1) to head (24634a3).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #130      +/-   ##
==========================================
+ Coverage   58.57%   63.77%   +5.19%     
==========================================
  Files          32       34       +2     
  Lines        2607     2912     +305     
  Branches      526      546      +20     
==========================================
+ Hits         1527     1857     +330     
+ Misses        745      709      -36     
- Partials      335      346      +11     
Flag Coverage Δ
macos 60.84% <ø> (+5.77%) ⬆️
macos_duktape 66.00% <ø> (+6.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves POSIX networking portability by explicitly including <netinet/in.h> (when available) to ensure struct sockaddr_in and related IPv4 definitions are complete on platforms where <sys/socket.h> doesn’t include it.

Changes:

  • Add CMake detection for the presence of <netinet/in.h>.
  • Plumb the detection result into proxyres_config.h.
  • Conditionally include <netinet/in.h> in POSIX networking source files.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
CMakeLists.txt Adds check_include_file("netinet/in.h" ...) so builds can detect header availability.
proxyres_config.h.in Introduces HAVE_NETINET_IN_H config macro for conditional compilation.
wpad_dhcp_posix.c Conditionally includes <netinet/in.h> to avoid incomplete sockaddr_in on some SDKs.
net_util.c Conditionally includes <netinet/in.h> for consistent IPv4 type/constant availability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sergio-nsk sergio-nsk merged commit 4454fb3 into master Mar 31, 2026
20 checks passed
@sergio-nsk sergio-nsk deleted the sergio-nsk/netinet-in/1 branch March 31, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants