Skip to content

fix(sync): stop advertising hotspot and tunnel addresses as LAN - #2461

Merged
arul28 merged 1 commit into
mainfrom
fix/lan-endpoint-filtering
Nov 23, 2026
Merged

arul28 merged 1 commit into
mainfrom
fix/lan-endpoint-filtering

Conversation

@arul28

@arul28 arul28 commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Why

The brain enumerated every non-internal IPv4 address as a LAN candidate except a fixed list of interface names. Windows hotspot adapters (Local Area Connection* 2, and the localized equivalents) and 198.18.0.0/15 VPN tunnels were therefore saved, broadcast in Bonjour TXT and offered first to a phone, which dials an address that cannot answer. VirtualBox and VMware host-only adapters on Windows were missed when renamed.

Same defect classes as pingdotgg/t3code#25991 and #33441, verified against ADE's device registry.

What changed

readLocalNetworkMetadata now skips:

  • the localization-independent <name>* <n> hotspot / Wi-Fi Direct suffix;
  • RFC 2544 tunnel addresses (198.18.0.0/15), so they reach neither the LAN nor the tailnet list;
  • Windows adapters with the VirtualBox (0a:00:27) or VMware (00:50:56:c0:00) host-only MAC prefixes, which a renamed adapter cannot hide. Linux bridges can inherit those MACs, so the MAC check is Windows-only.

Real LAN adapters, Hyper-V External switches and Tailscale keep their current order and classification.

Evidence

  • The owning test now mocks hotspot, VPN, VirtualBox, VMware and renamed-adapter interfaces and asserts only the real LAN addresses survive. It fails on the pre-fix code (verified) and passes with the fix.
  • Typecheck passes for apps/ade-cli and apps/desktop.

Not checked

Not exercised against a live Windows hotspot or a Clash/Mihomo TUN on this host. Full CI matrix not run locally.

🤖 Generated with Claude Code

ADE   Open in ADE  ·  fix/lan-endpoint-filtering branch  ·  PR #2461


Devin Review

RetriggerView in GreptileConfidence Score: 4/5

Clear excluded saved addresses before merging so existing installations receive the fix.

Fix All in Claude CodeFindings

  1. P1 Saved tunnel addresses survive ▶
  2. P2 VMware MAC check goes untested ▶
Fix with agent prompt
### Issue 1
apps/ade-cli/src/services/sync/deviceRegistryService.ts:275
After an upgrade, an address such as `198.19.2.2` previously saved from `utun40` remains in `tailscaleIp`. The new filter skips it, but `ensureLocalDevice` and `touchLocalDevice` keep the saved value when the fresh value is null-even when a real LAN address exists. Bonjour and pairing candidates then offer that unusable address to phones again.

Remove excluded addresses from saved values too, and allow `upsertDeviceRecord` to clear `tailscaleIp`.

### Issue 2
apps/desktop/src/main/services/sync/deviceRegistryService.test.ts:40
The VMware fixture never exercises `WINDOWS_HOST_ADAPTER_MAC`: its name contains `VMnet8`, so the existing name filter skips it first. A broken VMware MAC pattern would still pass this test. Give this fixture an unrelated name, as the test already does for VirtualBox, so it checks the promised renamed-adapter behavior.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR filters hotspot adapters, VPN tunnel addresses, and Windows host-only MAC prefixes before choosing local addresses.

  • Sync address discovery keeps hotspot, tunnel, and Windows VM-only addresses out of phone choices.

Reviews (1) · Last reviewed commit: "fix(sync): stop advertising hotspot and ..." · Reviewed by Greptile

The brain enumerated every non-internal IPv4 address as a LAN candidate
except a fixed list of interface names. Windows hotspot adapters
("Local Area Connection* 2") and 198.18.0.0/15 VPN tunnels were therefore
saved, broadcast in Bonjour TXT and offered first to a phone, which dials
an address that cannot answer. VirtualBox and VMware host-only adapters on
Windows were missed when renamed.

Filter the localized hotspot suffix, RFC 2544 tunnels, and the VirtualBox /
VMware MAC prefixes (Windows only, since Linux bridges can inherit them).

Co-Authored-By: Claude Code <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 40 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3daa933 and 58e524d.

Files selected for processing: 2

  • apps/ade-cli/src/services/sync/deviceRegistryService.ts
  • apps/desktop/src/main/services/sync/deviceRegistryService.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

3 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment on lines +275 to +276
if (isVpnTunnelAddress(entry.address)) continue;
if (process.platform === "win32" && WINDOWS_HOST_ADAPTER_MAC.test(entry.mac)) continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Filtered addresses survive sync upgrades

After an upgrade, ensureLocalDevice keeps the old LAN list or tailnet IP when filtering leaves that field empty. Bonjour and pairing QR codes still advertise those saved addresses.

Learn more

The interface scan now rejects addresses that earlier versions saved in the local device row. ensureLocalDevice restores the stored LAN list when the scan returns an empty list and restores the stored tailnet IP when the scan returns null. touchLocalDevice repeats those fallbacks, and upsertDeviceRecord treats an explicit null tailnet IP as an omitted value. publishLanDiscovery and buildPairingConnectInfo use the resulting device row, so another refresh does not remove the rejected address.

Example: A host on Wi-Fi has an utun proxy at 198.19.2.2 and no real Tailscale adapter. The old version saves the proxy IP as tailscaleIp. After upgrading, the fresh scan returns null for tailscaleIp, but the existing row still carries 198.19.2.2, and the next Bonjour publish includes it.

Recommended fix: Make a successful local interface scan authoritative for the local row's LAN and tailnet fields, including an empty LAN list or explicit null tailnet IP. Preserve the existing merge behavior for peer updates that omit network fields. Extend the registry test to seed an old address and verify that refreshing the local row removes it from the pairing candidates.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

const isLikelyTailscaleInterface = /tailscale|utun|tun/i.test(interfaceName);
for (const entry of entries ?? []) {
if (!entry || entry.internal || entry.family !== "IPv4") continue;
if (isVpnTunnelAddress(entry.address)) continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Saved tunnel addresses survive

After an upgrade, an address such as 198.19.2.2 previously saved from utun40 remains in tailscaleIp. The new filter skips it, but ensureLocalDevice and touchLocalDevice keep the saved value when the fresh value is null—even when a real LAN address exists. Bonjour and pairing candidates then offer that unusable address to phones again.

Remove excluded addresses from saved values too, and allow upsertDeviceRecord to clear tailscaleIp.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/ade-cli/src/services/sync/deviceRegistryService.ts
Line: 275

Comment:
**Saved tunnel addresses survive**

After an upgrade, an address such as `198.19.2.2` previously saved from `utun40` remains in `tailscaleIp`. The new filter skips it, but `ensureLocalDevice` and `touchLocalDevice` keep the saved value when the fresh value is null—even when a real LAN address exists. Bonjour and pairing candidates then offer that unusable address to phones again.

Remove excluded addresses from saved values too, and allow `upsertDeviceRecord` to clear `tailscaleIp`.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code

// RFC 2544 tunnels (Tailscale userspace, Clash/Mihomo Wintun) are never a LAN.
utun40: [{ address: "198.19.2.2", family: "IPv4", internal: false, netmask: "255.255.0.0", mac: "00:00:00:00:00:09", cidr: "198.19.2.2/16" }],
"VirtualBox Host-Only Network": [{ address: "192.168.56.1", family: "IPv4", internal: false, netmask: "255.255.0.0", mac: "0a:00:27:00:00:0a", cidr: "192.168.56.1/24" }],
"VMware Network Adapter VMnet8": [{ address: "192.168.159.1", family: "IPv4", internal: false, netmask: "255.255.255.0", mac: "00:50:56:c0:00:08", cidr: "192.168.159.1/24" }],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 VMware MAC check goes untested

The VMware fixture never exercises WINDOWS_HOST_ADAPTER_MAC: its name contains VMnet8, so the existing name filter skips it first. A broken VMware MAC pattern would still pass this test. Give this fixture an unrelated name, as the test already does for VirtualBox, so it checks the promised renamed-adapter behavior.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/main/services/sync/deviceRegistryService.test.ts
Line: 40

Comment:
**VMware MAC check goes untested**

The VMware fixture never exercises `WINDOWS_HOST_ADAPTER_MAC`: its name contains `VMnet8`, so the existing name filter skips it first. A broken VMware MAC pattern would still pass this test. Give this fixture an unrelated name, as the test already does for VirtualBox, so it checks the promised renamed-adapter behavior.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

@arul28
arul28 merged commit 22cb84c into main Nov 23, 2026
29 checks passed
@arul28
arul28 deleted the fix/lan-endpoint-filtering branch November 23, 2026 08:11
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.

1 participant