Skip to content

[Bug] WSL2 Hyper-V adapter IP (198.18.x.x) treated as public IP #146

@Jensenwgd

Description

@Jensenwgd

Bug: Hyper-V Meta adapter IP (198.18.x.x) treated as public IP

Location: packages/cli/src/network.ts lines 6-14, isPrivateIP()

Problem: WSL2 uses a Hyper-V virtual adapter in the 198.18.0.0/15 range (RFC 8768). The current isPrivateIP() only checks RFC 1918 ranges (10.x, 172.16-31.x, 192.168.x.x), so 198.18.x.x is incorrectly classified as public. This causes the CLI to attempt external connections instead of local loopback, breaking phone connectivity.

Suggested fix: Add 198.18.0.0/15 to the private IP check:

if ((ip >= '10.0.0.0' && ip <= '10.255.255.255') ||
    (ip >= '172.16.0.0' && ip <= '172.31.255.255') ||
    (ip >= '192.168.0.0' && ip <= '192.168.255.255') ||
    (ip >= '198.18.0.0' && ip <= '198.19.255.255')) {
  return true;
}

Environment: Windows 11 + WSL2 (Hyper-V), Node.js 20.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions