Skip to content

Force IPv4 for baidu connectivity probe#11

Open
DzmingLi wants to merge 1 commit into
black-binary:masterfrom
DzmingLi:fix-ipv6-fallback
Open

Force IPv4 for baidu connectivity probe#11
DzmingLi wants to merge 1 commit into
black-binary:masterfrom
DzmingLi:fix-ipv6-fallback

Conversation

@DzmingLi
Copy link
Copy Markdown

@DzmingLi DzmingLi commented May 11, 2026

Problem

On dual-stack hosts, the daemon can sit forever in a retry loop without ever entering the login flow. Observed on HUST_WIRELESS captive-portal Wi-Fi:

baidu boom! the timeout of the request was reached
error! connection refused

tcpdump shows every probe goes out as IPv6 SYN to baidu's AAAA address, never falling back to IPv4 even though IPv4 connectivity works fine.

Root cause: minreq has no happy-eyeballs / address fallback — it pins to whichever address getaddrinfo() returns first. With default Linux gai.conf ordering, AAAA wins. On the typical campus captive portal where the host has an IPv6 default route via RA but no upstream IPv6 reachability, every request stalls on SYN retransmits until the 10s timeout. The daemon never sees the portal redirect script and so never logs in.

Fix

Resolve www.baidu.com manually, pick the first IPv4 address, request by IP with an explicit Host header.

has been tested

minreq has no happy-eyeballs fallback — on a host with AAAA records
returned first (typical default getaddrinfo order), every request loops
on IPv6 SYN retries until timeout, even when IPv4 connectivity is fine.
On networks where IPv6 isn't routed (e.g. captive-portal Wi-Fi before
auth), the daemon never reaches baidu and never triggers login.

Resolve www.baidu.com manually, pick the first IPv4 address, and request
by IP with an explicit Host header. The captive portal intercepts based
on egress destination so the redirect still fires.
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