Skip to content

[client] Skip down interfaces in network address collection for posture checks#5768

Merged
lixmal merged 1 commit intomainfrom
fix-posture-check-down-ifaces
Apr 7, 2026
Merged

[client] Skip down interfaces in network address collection for posture checks#5768
lixmal merged 1 commit intomainfrom
fix-posture-check-down-ifaces

Conversation

@lixmal
Copy link
Copy Markdown
Collaborator

@lixmal lixmal commented Apr 1, 2026

Describe your changes

The networkAddresses() function in client/system/info.go reports IPs from all interfaces regardless of state. On Windows, disconnected adapters retain stale DHCP addresses, so the "Peer Network Range" posture check matches those addresses against deny rules and blocks the peer entirely (0 peers, 0 routes).

  • Filter out interfaces without net.FlagUp before collecting addresses for peer system metadata
  • Leave a TODO on localip.go which has the same issue independently

Issue ticket number and link

#1743

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

No user-facing behavior change in docs, the client simply stops reporting addresses from down interfaces.

Summary by CodeRabbit

  • Bug Fixes

    • Improved network interface filtering to exclude inactive network interfaces from system information.
  • Chores

    • Added planning notes for enhanced network interface detection logic.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 1, 2026

📝 Walkthrough

Walkthrough

Network interface filtering logic was enhanced across two files. One file added TODO comments noting future filtering improvements, while another implemented a check to skip network interfaces that are not in the "up" state before further processing.

Changes

Cohort / File(s) Summary
Network Interface State Filtering
client/firewall/uspfilter/localip.go, client/system/info.go
Added filtering to skip network interfaces not in the "up" state. localip.go includes TODO comments for future improvements; info.go implements the actual filtering check using net.FlagUp before processing interface hardware addresses and enumeration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • pappz
  • crn4

Poem

🐰 Network interfaces standing tall,
No longer shall the down ones call,
With FlagUp checks and TODO dreams,
We filter flows like mountain streams! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: filtering down interfaces when collecting network addresses for posture checks.
Description check ✅ Passed The PR description follows the template structure with all required sections completed: changes described, issue linked, bug fix marked, and documentation exemption explained.

✏️ 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 fix-posture-check-down-ifaces

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
client/firewall/uspfilter/localip.go (1)

147-148: Consider linking this TODO to a concrete tracking issue.

Nice callout of the gap. To avoid this getting lost, include an issue/PR reference directly in the TODO (for example, “TODO(#1743 or follow-up issue): ...”).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@client/firewall/uspfilter/localip.go` around lines 147 - 148, The TODO in
localip.go noting "filter out down interfaces (net.FlagUp)..." should include a
concrete tracking reference so it isn't lost; update that comment (near the
logic that refreshes interface list in the functions handling local IP
discovery, e.g., the code block around the refresh/filter logic in localip.go)
to read something like "TODO(#<issue-number>): filter out down interfaces
(net.FlagUp) and handle interfaces coming up between refreshes" or reference the
PR number you create, replacing <issue-number> with the actual issue/PR ID.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@client/firewall/uspfilter/localip.go`:
- Around line 147-148: The TODO in localip.go noting "filter out down interfaces
(net.FlagUp)..." should include a concrete tracking reference so it isn't lost;
update that comment (near the logic that refreshes interface list in the
functions handling local IP discovery, e.g., the code block around the
refresh/filter logic in localip.go) to read something like
"TODO(#<issue-number>): filter out down interfaces (net.FlagUp) and handle
interfaces coming up between refreshes" or reference the PR number you create,
replacing <issue-number> with the actual issue/PR ID.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 74b87413-d733-48f3-848e-f3102716980f

📥 Commits

Reviewing files that changed from the base of the PR and between d97fe84 and bc2c07b.

📒 Files selected for processing (2)
  • client/firewall/uspfilter/localip.go
  • client/system/info.go

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.

2 participants