Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Guest-external networking: VirtioNet exists but is wired to nothing

Đang mở
#95 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
backend, networking

Hướng nghiên cứu

Read crates/hv2-core/src/vm.rs around attach_vsock, then crates/hv2-core/src/devices/virtio.rs and its test_virtio_net_* tests. For the guest driver, follow crates/hv2-unikernel/src/vsock.rs; inspect crates/hv2-net/src/nat.rs and hv2-net::tap for the host path. Done means attaching the device, sending and receiving guest frames, and routing translated traffic through TAP; the issue lays out three substantial pieces with no single test named.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Follow-up to the hv2_net::nat work (#94, closed) and to the Botnet arena-sandbox design that motivated it: a guest still cannot reach an external host-routable TCP endpoint end to end. Filed as a roadmap issue rather than a PR -- this is a three-piece gap, and I want to lay out what's actually there today (some of it further along than it looks) before anyone starts on it.

What already exists

  • crates/hv2-core/src/devices/virtio.rs: a full host-side VirtioNet device model -- VirtioNetHeader, queues, MAC/status config, a SharedVirtioNet wrapper -- with its own unit test suite (test_virtio_net_*, lines 730-893). This is not a stub.
  • crates/hv2-net/src/nat.rs (added in #94's parent work, 8f130b9/6e7df33): a tested, pure IPv4/TCP/UDP NAT translation table -- guest-egress source-port allocation + checksum recompute, static ingress port-forwards. Also not a stub, but it does no I/O of its own -- it expects something to hand it frames.
  • crates/hv2-unikernel/src/vsock.rs: a working virtio-vsock guest driver, proving the pattern this repo already uses for a from-scratch no_std virtio driver: a fixed MMIO window (VM::attach_vsock puts it at Self::VSOCK_MMIO_BASE, matching a virtio_mmio.device=4K@0xd0000000:5 kernel-cmdline-style fixed address the driver hard-codes), a static guest-memory map for rings/buffers (no allocator dependency), and a polling (not interrupt-driven) receive loop.

What's missing -- three independent pieces, all required

  1. VM has no attach_net (or similarly named) method. crates/hv2-core/src/vm.rs has attach_vsock/attach_vsock_at/attach_vsock_pci (lines 1119-1344 area) but nothing that registers a VirtioNet/SharedVirtioNet as an MMIO (or PCI) transport the way attach_vsock does for vsock. The device model exists; nothing connects it to a running VM.
  2. hv2-unikernel has no net driver. Its src/ is exactly boot.rs, interrupts.rs, mem.rs, vsock.rs (see main.rs:68-71) -- no net.rs. vsock.rs is the template to follow: same virtio-mmio v2 bring-up sequence, same fixed-address ring/buffer map style (see its mod mem block), same polling model -- just against VirtioNetHeader's framing and a different device ID instead of vsock's packet header/ops.
  3. Nothing wires hv2_net::nat's translation to a real interface. Even with (1) and (2) done, something host-side has to read frames off wherever the guest's virtio-net queue lands, run them through NatTable::translate_outbound/translate_inbound, and hand the result to/from the host's actual network stack (a TAP device via hv2-net::tap, or a raw socket). None of that loop exists yet.

Suggested order

Mirrors how vsock was actually built here (driver proven under a minimal harness before it carried real traffic):

  1. VM::attach_net, following attach_vsock's shape -- register a VirtioNet at a fixed MMIO window, return a handle the host side can read/write.
  2. hv2-unikernel's net.rs, following vsock.rs's shape -- bring-up, static ring/buffer map, polling recv/send. Provable in isolation the same way vsock was: a guest that can send and receive a raw frame, before anything about IP is involved.
  3. The glue loop: host reads a frame from the attached VirtioNet, calls hv2_net::nat, writes the translated frame to a TAP device (hv2-net::tap), and the reverse direction. This is where NatTable gets its first real caller -- worth remembering the closed #94's note that neither 8f130b9 nor 6e7df33 "could affect a running HyperMachine: NatTable has no callers outside this file" was still true as of that commit.

Not attempting any of this myself in code -- filing it so the shape of the remaining work is written down somewhere before someone (possibly me, in a later session) picks it up.

Ngôn ngữ chính
Rust
Star
103
Fork
3
Merge trung bình
9 giờ 56 phút
Pull request đã merge (30 ngày)
137

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nervosys/HyperMachine

Tất cả issue của nervosys/HyperMachine

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.