LeonOS Documentation

IPv4 networking repair, 2026-09-13

APK download throughput follow-up

The VMware log /home/xiaobai/installer-serial.log contained 2,460,699 bytes, 8,128 TCP receive entries and 11,123,189 accepted payload bytes. There were 173 full 8 KiB receive queues and repeated one-byte probes/small window updates. Every port-443 packet also generated synchronous console/serial output; the diagnostic strings incorrectly contained literal \\n rather than newlines.

Changes in kernel/ntclks/net.c and drivers/e1000/e1000.c:

Reference: Linux v6.12 net/ipv4/tcp.c::tcp_cleanup_rbuf, net/ipv4/tcp_output.c::{tcp_select_window,tcp_select_window} and drivers/net/ethernet/intel/e1000/e1000.h::E1000_DEFAULT_RXD in the pinned local source tree. This is a bounded receive-path correction, not a complete Linux TCP implementation; window scaling, congestion control and out-of-order buffering are not certified by these tests.

Validation used actual upstream apk and cached, unmodified Alpine packages served over HTTPS in an isolated host network namespace. The guest trusts a fixture CA and verifies package signatures; downloaded files are independently hashed by BusyBox in the guest. There is no Internet or proxy in the measured path. The test autospawn process explicitly receives the normal executable PATH.

OperationBeforeFinal
Fetch libcrypto3, 1,978,546 bytes5.42 s1.42 s
Fetch GCC, 60,496,469 bytesnot measured13.65 s (4.23 MiB/s)
Add gcc + leonos-musl-dev + make, 16 packages including dependenciesnot measured29.20 s

After installation, GCC, cc1, as, collect2 and ld produced a dynamically linked stdio executable that printed APK_GCC_NETWORK_OK and exited zero. GCC's cached APK SHA256 was d1d482472ed91240731c60dbae8176bc1e32e1dfb694856da6759f6d32716325. The libcrypto3 serial log shrank from 260,195 to 10,309 bytes.

ASan/UBSan host regressions cover five-byte reads, zero-window reopening, ring wrap, overlapping retransmissions, sequence wrap, TX failure, buffer allocation failure/release and 64-packet NIC bursts across descriptor wrap. The new small-read and burst tests both failed on the original implementation.


python3 tools/test_network.py
python3 tools/test_e1000.py
unshare --user --map-root-user --net python3 tools/test_tcp_download_qemu.py --label gcc-final
unshare --user --map-root-user --net python3 tools/test_tcp_download_qemu.py --label install --install

Results/serial logs are in build/tcp-download/{before,final-small,gcc-final,install}. Results record the actual kernel hash; final results also record the driver hash. QEMU used KVM, q35, e1000-82545em and one socket/two cores. This does not measure a public Alpine mirror, VMware NAT, installed SATA throughput, or certify desktop frame rates.

Earlier network bring-up

Scope: prepare the existing network path for future Alpine apk integration. This work does not install apk or certify the full Linux networking ABI.

Root causes and changes

Reference material: the pinned Linux v6.12 e1000 and socket implementation in build/linux-6.12, musl src/network/res_msend.c, and RFC 5905. The RFC was retrieved through the configured HTTP proxy at 127.0.0.1:12334.

Verification

Host tests directly compile the driver/transport implementations with ASan/UBSan. They cover failed initialization cleanup, link state, UDP queue semantics, TCP lifetime/window/retransmission, lease expiration and NTP packet validation. Existing Unix message-batch tests and resource tests also pass.


python3 tools/test_e1000.py
python3 tools/test_network.py
python3 tools/test_linux_socket_batches.py
python3 tools/test_linux_resources.py

The guest uses an independent static musl probe and the production, unmodified BusyBox and CPython executables. A private user/network namespace contains DNS, HTTP, HTTPS and NTP fixtures; it does not change the host's DNS or clock. The subnet is 10.37.0.0/24 to detect assumptions about QEMU's default subnet.


unshare --user --map-root-user --net python3 tools/test_network_qemu.py
unshare --user --map-root-user --net python3 tools/test_network_qemu.py --reuse --nic e1000 --smp 1

QEMU/KVM q35 results: e1000-82545em with 2 vCPUs and e1000 with 1 vCPU both reported [network] DONE failures=0. Verified behavior:

Logs and machine-readable results are under build/network-test/, named e1000-82545em-smp2.{log,json} and e1000-smp1.{log,json}. These prove the controlled QEMU network path, not an actual public NTP server or VMware NAT run.

Build artifacts

The hashes below identify the current network-enabled build 3718.

python3 build.py run images-iso completed with zero errors. Both packaged root images contain the production runtime and certificate bundle; the live image's /usr/lib/leonos/libleonos.so.2 matches build/system/lib/libleonos.so.2, and its CA bundle matches system/certs/cacert.pem byte for byte.

VMware configuration

The user's LeonOS4.vmx did not specify ethernet0.virtualDev; VMware logs contained VLANCE/VMXNET messages. That is evidence to check the virtual NIC model, not proof that the guest had an Intel adapter.

After vmrun list reported no running VMs, the configuration was backed up to LeonOS4.vmx.before-e1000-20260913, and the following explicit selection was added to /home/xiaobai/vmware/LeonOS4/LeonOS4.vmx:


ethernet0.virtualDev = "e1000"

The host's vmnet8 NAT and DHCP processes are running, with host address 192.168.165.1/24. This host-side check does not prove guest connectivity.

VMware follow-up verification

On the next report, the VMX explicitly contained virtualDev = "vlance". The installed guest logged VMware PCnet detected and e1000 initialization returned -19 (ENODEV). The failed boot was therefore using a PCnet adapter, not an Intel e1000. The prior configuration change had not persisted; the available evidence does not establish which UI action changed it.

The current configuration was backed up as LeonOS4.vmx.before-network-recheck-20260913. Its network settings are now:


ethernet0.present = "TRUE"
ethernet0.virtualDev = "e1000"
ethernet0.connectionType = "nat"
ethernet0.startConnected = "TRUE"

The VMware main window held a live configuration lock even with zero running VMs; vmrun start returned "The file is already in use". After the user exited the main window, the lock disappeared and these settings were verified again. No lock files were removed to bypass the live owner.

Actual VMware Workstation results, using the existing kernel/runtime:

Evidence: build/network-vmware-test/serial.log (diskless live VM), build/network-vmware-test/installed-serial.log (installed VM; latest boot starts at line 21987), and the original /home/xiaobai/installer-serial.log. VMware HTTP/HTTPS payload downloads have not been exercised in this follow-up; the HTTPS and certificate checks above are controlled QEMU fixture tests.

DHCP button and askpass follow-up

The installed guest still acquired a real VMware NAT lease at boot, but the network controller's Renew DHCP button reported only ret=-1. Its ordinary user request reached a root-only service operation; the service disconnected the client without returning the permission error. This was independent of e1000 carrier and boot-time DHCP success.

The host regression compiles the real daemon/client/framing with ASan/UBSan and separately exercises netctl's root, authorization, pending, cancellation and failure handling. It passes:


python3 tools/test_netmand.py

The final 2-vCPU QEMU network probe reports 25 passing checks and [network] DONE failures=0. Added checks use the actual service, reject ordinary user mutations, permit subsequent reads, reject an unprivileged helper, and execute a successful DHCP helper through official sudo. The noninteractive probe adds a command-specific NOPASSWD rule only to its disposable test image. The separate --gui mode uses the production password policy instead.


unshare --user --map-root-user --net python3 tools/test_network_qemu.py
unshare --user --map-root-user --net python3 tools/test_network_qemu.py --gui

The final GUI run also exits 0. It logs into the live desktop as the ordinary test account, clicks Renew DHCP, cancels the first password dialog and checks that no password reached PAM and no privileged helper ran. A second click and the correct password produce successful askpass, PAM, DHCP helper and sudo exits. The controller displays the renewed 10.37.0.15 lease, and its Resolve button receives 10.37.0.2 from the isolated DNS fixture for example.com. This address is deliberately fixture data, not a public DNS result. Evidence: build/network-gui-test/e1000-82545em-smp2.{log,json}, authorization-cancelled.png, dhcp-renewed.png, and dns-after-renew.png in the same directory. The test image kernel matches the production ISO kernel listed above, and no NOPASSWD test rule is present in the GUI image.

The DHCP button and askpass changes require updating the installed userland; the earlier VMX-only repair did not. VMware GUI validation of these new changes remains pending.

Taskbar clock follow-up

The VMware log for installed build 3705 records a valid RTC and an NTP wall clock update, but the taskbar still showed 00:00:00. The SDK's leonos_time_info() filled unix_seconds and set valid while leaving its calendar fields zero. The desktop correctly refreshed each second but read those zero hour/minute/second fields.

The SDK now uses musl gmtime_r() to fill every calendar field and sets valid only after conversion succeeds. Null output, failed clock reads, negative timestamps outside this unsigned SDK structure and calendar overflow return errors. UTC semantics are preserved; this repair does not configure a local timezone or change the kernel's Unix timestamp representation.

python3 tools/test_time_info.py failed on the original zero calendar and now passes against the actual SDK implementation. It checks known dates, ticking seconds, leap day, year 2040, the non-leap century 2100 and error paths, with a non-UTC process TZ to check the UTC contract. Final --gui validation recognizes the actual taskbar screenshots with Tesseract: 00:00:34 then 00:00:36 under the isolated midnight NTP fixture. The standard 25 guest network checks also pass with the final image's kernel/runtime.

Evidence: build/taskbar-clock-gui.log, build/taskbar-clock-network.log, and build/network-gui-test/clock-{first,second}.png. Both production ISO builds completed with zero errors. This display repair has QEMU validation; VMware display validation remains pending.

Remaining limits