feat(w0-pr4): same-subnet ghost detector in both probe scripts - #1481
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5966bc8fde
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $netKey = if ($pl -ge 24) { | ||
| "$($bytes[0]).$($bytes[1]).$($bytes[2]).0/$pl" | ||
| } elseif ($pl -ge 16) { | ||
| "$($bytes[0]).$($bytes[1]).0.0/$pl" |
There was a problem hiding this comment.
Derive subnet key using real IPv4 mask math
Get-NicCollisions builds netKey by zeroing whole octets instead of applying the exact prefix mask, so prefixes like /25, /23, or /20 collapse distinct networks into one key (for example, both halves of 192.168.1.0/25 map to the same key). This creates false nic_collisions on valid segmented networks and can send operators to unnecessary remediation steps.
Useful? React with 👍 / 👎.
| for subnet, members in entries.items(): | ||
| if len(members) < 2: continue | ||
| primary = members[0] | ||
| for ghost in members[1:]: | ||
| print(f"{primary[0]}|{primary[1]}|{ghost[0]}|{ghost[1]}|{subnet}") |
There was a problem hiding this comment.
Filter collision pairs by link state before labeling ghosts
The Linux detector marks members[0] as primary and every other member as ghost without checking whether each interface is actually down/disconnected, so hosts with two active NICs in the same subnet (or different ip output ordering) are still reported as ghost collisions. Because this path feeds both the warning text and nic_collisions JSON, it yields misleading diagnostics in normal multi-NIC configurations.
Useful? React with 👍 / 👎.
5966bc8 to
af0e071
Compare
Add Get-NicCollisions (PS1) and detect_nic_collisions (bash) and wire
them fully into: JSON output (nic_collisions field), interactive report
(NIC Collision Check section with remediation link), and schema comments
(placeholder format, no hardcoded IPs).
Both scripts now emit nic_collisions: [{primary, ghost, subnet}] — empty
array on healthy hosts, populated when same-subnet ghost adapters are
detected per SAME_SUBNET_GHOST_PATTERN.md detection steps.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
af0e071 to
0521a76
Compare
…detector (#1537) Addresses Codex P1 + P2 findings from PR #1535 (closed as superseded by #1476+#1481). Same bugs apply to main's version, so fixing directly. deploy/provision/glances-autodetect.ps1 (P1): Get-NicCollisions previously truncated network keys to whole-octet boundaries (/24, /16, /8) regardless of actual PrefixLength. This mis-grouped /23, /20, /25, etc. — missing real same-subnet adapter collisions on non-/24 networks and creating false ones on partial-octet masks. Now builds a true CIDR network mask via bitwise AND on each byte using the actual PrefixLength. deploy/provision/glances-autodetect.sh (P2): The Python collision detector treated every additional IP in a subnet as a ghost regardless of interface identity. A single NIC with multiple IPv4 addresses (IP aliasing / secondary IPs) was reported as a collision, even though no competing adapter exists. Now requires at least 2 distinct interfaces in the subnet group before flagging, and skips same-interface aliases inside the loop. Verification (Linux fix, Python simulation): - same-iface alias only (eth0, eth0) → 0 ghosts ✓ - distinct-iface collision (eth0, eth1) → 1 ghost ✓ - mixed: 1 alias + 1 ghost (eth0, eth0, eth1) → 1 ghost ✓ Cross-lane on behalf of W0 substrate (4090 / Z890 lane historically). Co-authored-by: Shaela Bello <slbello@uncg.edu> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Get-NicCollisions(PowerShell) anddetect_nic_collisions(bash) — both use the detection steps fromSAME_SUBNET_GHOST_PATTERN.mdnic_collisions: [{primary, ghost, subnet}]into JSON output of both scripts<placeholder>format — no hardcoded IPsRationale
Docker Desktop on Windows silently no-ops port binds when a ghost adapter owns the routing table entry for the LAN subnet. This detector surfaces the condition at onboarding time (pre-provision), before the operator spins up the Docker stack, giving them the fix path before the bug manifests.
Test plan
.\glances-autodetect.ps1 --json— verifynic_collisionsfield present, empty array on clean host.\glances-autodetect.ps1(interactive) — verify "NIC Collision Check" section shows "No same-subnet ghost adapters detected" in greenprimary/ghost/subnetvaluessudo bash glances-autodetect.sh --json— verifynic_collisionsfield presentsudo bash glances-autodetect.sh(interactive) — verify collision section renders<placeholder>formatDepends on
PR-3 (#1476) — base branch
feat/w0-pr3-windows-glances-probe🤖 Generated with Claude Code