Skip to content

fix(warp): correct IPv6 address removal sed rule for IPv4-only VPS#5417

Open
EricPrometheus wants to merge 1 commit into
hiddify:mainfrom
EricPrometheus:fix/warp-ipv6-sed-rule
Open

fix(warp): correct IPv6 address removal sed rule for IPv4-only VPS#5417
EricPrometheus wants to merge 1 commit into
hiddify:mainfrom
EricPrometheus:fix/warp-ipv6-sed-rule

Conversation

@EricPrometheus
Copy link
Copy Markdown

Problem

On IPv4-only VPS (no IPv6 address, net.ipv6.conf.all.disable_ipv6 = 1), wg-quick@warp fails to start with:

[#] ip -6 address add 2606:4700:110:...:/128 dev warp
RTNETLINK answers: Permission denied
[#] ip link delete dev warp

The WARP tunnel becomes completely non-functional.

Root Cause

other/warp/wireguard/run.sh.j2 line 43 has a sed rule intended to strip IPv6 addresses when the system doesn't support IPv6:

# Old (broken)
sed -i '/Address = [0-9a-fA-F:]\{4,\}/s/^/# /' wgcf-profile.conf

However, wgcf generate produces Address lines with both IPv4 and IPv6 on the same line:

Address = 172.16.0.2/32, 2606:4700:110:8961:16c9:4520:593:6a9e/128

The old sed rule tries to match lines starting with IPv6 hex patterns, but since the line starts with 172.16.0.2, it doesn't match. The IPv6 address remains, wg-quick attempts ip -6 address add, and the kernel rejects it, causing the entire interface to be torn down.

Fix

Replace the sed rule to strip , <ipv6>/<prefix> from the Address line directly:

# New
sed -i 's/, [0-9a-fA-F:]*\/[0-9]*//' wgcf-profile.conf

Result:

# Before:
Address = 172.16.0.2/32, 2606:4700:110:8961:16c9:4520:593:6a9e/128

# After:
Address = 172.16.0.2/32

Testing

  • Verified on RackNerd IPv4-only VPS (Ubuntu 22.04, kernel 5.15.0-46)
  • WARP tunnel starts successfully after applying the fix
  • curl --interface warp https://cloudflare.com/cdn-cgi/trace confirms warp=on

File Changed

  • other/warp/wireguard/run.sh.j2 — 1 line changed

The old sed rule only matched lines starting with IPv6 patterns, but
wgcf generates `Address = IPv4, IPv6` on a single line. This caused
the IPv6 address to remain in wgcf-profile.conf on IPv4-only VPS,
making wg-quick@warp fail with "RTNETLINK answers: Permission denied".

The new rule strips `, <ipv6>/<prefix>` from the Address line, leaving
only the IPv4 address.
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