feat: 容器內 DNS(全後端)——resolv.conf 注入 + WHP 10.0.2.3 DNS pivot;macOS vz 實機 follow-ups#127
Merged
Conversation
…GUI 解析度取捨 實體 Apple Silicon(macOS 26)vz-smoke 全綠後的收尾批次: - guest-agent exec.rs:比照 Docker 把執行環境的 /etc/resolv.conf 實體化到 temp 檔 bind 進每個服務容器(基底 image 不自帶,缺了 hostname 解析全倒在 127.0.0.1:53); appliance init 把 /etc/resolv.conf symlink 到 /proc/net/pnp(kernel ipconfig 的 nameserver 所在;vz/QEMU=DHCP、WHP=cmdline dns0,見 DESIGN「容器內 DNS」) - chefer-runtime extract.rs:解壓還原 tar mode(bundle agents/ 掉 0755 → macOS spawn vz-helper / guest 執行 guest-agent 直接 EACCES)+單元測試 - chefer-runtime proxy.rs:macOS(vz)整個略過跨平台埠代理——會與 vz 後端自己的 127.0.0.1:host → <vm_ip>:guest relay 搶埠 - build-inside-container.sh:交叉建置抓目標架構 busybox-static(x86_64 容器建 aarch64 appliance 曾產出 ENOEXEC initramfs);cp --sparse=never 相容 virtiofs /out - vz-smoke.sh:macOS 原生 cargo build musl guest-agent(rust-lld),免 cross/Docker - vz-helper main.swift:GUI 解析度取捨——預設 scanout=視窗點數、 automaticallyReconfiguresDisplay 關(cage 不 re-modeset、Retina 2× 推給 guest 會讓 UI 縮半),CHEFER_VZ_DYNAMIC_RESOLUTION=1 可切回 - README / DESIGN / HANDOFF:macOS 欄位改實測結果;DESIGN 新增「容器內 DNS」契約 (含 WHP 10.0.2.3 pivot 設計與 M7-b/c 更正、M7-d 待實機) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…7-d,待實機) M7-b/c 的 wget 出網當時並無容器內 resolv.conf 來源(裸 alpine 不自帶;musl 缺檔 fallback 127.0.0.1:53,到不了 NAT——實測 alpine 拔檔後 wget: bad address), 「裸 image 開箱即解析」從未成立。正式來源補上: - vmm-backend whp_util:kernel cmdline `ip=` 尾追 dns0=10.0.2.3(slirp 慣例位址, 與 QEMU 路徑一致)。kernel ipconfig 對靜態 ip= 也會建 /proc/net/pnp,dns0 讓它 多出 nameserver 行 → appliance init symlink + guest-agent 注入整條沿用既有鏈 - whp-helper net_backend:DNS pivot——iface 掛 10.0.2.3/32 應答 ARP(常駐、不受 TCP NAT 位址表驅逐);10.0.2.3:53 UDP fanout 到 host 設定的 DNS 上游 (GetNetworkParams,60s TTL 跟隨 VPN;CHEFER_WHP_DNS 覆寫;無上游才 fallback 公共 DNS),回程只收上游來源並 masquerade 回 10.0.2.3:53;TCP:53 SYN 走既有 TCP NAT 但 host 端改連第一個上游(resolver 截斷 fallback) - qemu-e2e:新增 /dns 斷言——容器內 resolv.conf 須為注入的 nameserver 10.0.2.3 且 example.com 解析得動,鎖住 pnp→symlink→注入整條 guest 側鏈(CI 迴歸) - roadmap:M7-d 實機驗證步驟(Windows + WHP) host 端邏輯含 6 個跨平台單元測試(pivot 轉發/masquerade、spoof 丟棄、ARP、 驅逐保護、flow 分鍵、覆寫解析);GetNetworkParams 過 x86_64-pc-windows-msvc cargo check。端到端待實機(DESIGN §6 M7-d)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
# Conflicts: # docs/DESIGN.md
實測環境 Windows 11 Pro 26200 + WHP,裸 alpine:3.20 零 resolv.conf 手段; nslookup Server=10.0.2.3 以容器內 grep 斷言進 exit code(WHP console 看不到 服務 stdout)。變因 (c) VPN/內網 hostname 未涵蓋(驗證機無 VPN),標為待補。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
實體 Mac vz 驗證時發現:基底 image(alpine 等)不自帶
/etc/resolv.conf(Docker 是由 daemon 執行期注入),缺了它服務內任何 hostname 解析都倒在 musl 預設的127.0.0.1:53→ bridge 出網「通了但 DNS 全掛」。追查後同時證實 DESIGN §6 M7-b/c 當時的 wget 出網宣稱有掩蓋——當時容器內沒有任何 resolv.conf 來源,解析必是測試另行提供了 nameserver(本機以裸 alpine 拔檔實證wget: bad address)。內容
容器內 DNS(Docker-parity,全後端)
exec.rs:fork 前把執行環境的/etc/resolv.conf內容實體化到 temp 檔,以既有 bind mount 掛進每個服務容器(蓋掉 image 殘留;來源缺失/為空則不注入)/etc/resolv.confsymlink →/proc/net/pnp(vz/QEMU=DHCP nameserver;WHP=靜態ip=也會建 pnp,nameserver 來自新增的 dns0 欄)ip=尾追 dns0=10.0.2.3(slirp 慣例位址)+ whp-helper DNS pivot——iface 掛10.0.2.3/32應答 ARP(常駐不被驅逐),UDP:53 fanout 到 host 設定的 DNS(GetNetworkParams、60s TTL、CHEFER_WHP_DNS覆寫、無上游才 fallback 公共 DNS),回程 masquerade 回10.0.2.3:53;TCP:53 走 TCP NAT 改連第一個上游/dns斷言鎖住 pnp→symlink→注入整條 guest 側鏈(CI 迴歸)macOS vz 實機驗證 follow-ups(同一工作樹批次)
CHEFER_VZ_DYNAMIC_RESOLUTION=1切回(Retina 像素直推會讓 guest UI 縮半)驗證
nslookup Server=10.0.2.3斷言進 exit code;CHEFER_WHP_DNS覆寫變因通過;VPN/內網 hostname 變因因驗證機無 VPN 標待補(roadmap 記錄)x86_64-pc-windows-msvccross-check 過.waiting)並解衝突重驗🤖 Generated with Claude Code