#!/bin/sh # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2026 Tsiry Sandratraina # # The XNU guest's network (kernel/tools/xnu-rootfs.sh, launchd's # com.unkernel.network): the host's stack is at fixed addresses (js.md, # Network), so en0 is configured by hand, with no DHCP client. configd # does the same from its preferences (xnu-root/Library/Preferences/ # SystemConfiguration/preferences.plist: a manual service on en0, whose # DNS server IPMonitor publishes for libinfo and mDNSResponder); this job # is what runs without configd, and before it is done. /sbin/ifconfig en0 >/dev/null 2>&1 || exit 0 /sbin/ifconfig en0 inet 10.0.2.15 netmask 255.255.255.0 up /sbin/route -n add default 10.0.2.2 >/dev/null 2>&1 [ -s /etc/resolv.conf ] || printf 'nameserver 10.0.2.3\n' > /etc/resolv.conf # configd's IPConfiguration and InterfaceNamer wait for IOKit network # interfaces, which en0 (a BSD ifnet) is not, so the service's state is # published here as they would: IPMonitor makes it the primary service and # publishes the DNS configuration (State:/Network/Global/DNS) libinfo and # mDNSResponder resolve with. The service is the preferences' (its UUID). svc=4B570000-0000-4000-8000-0000000000E0 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30; do /usr/sbin/scutil <<'SC' >/dev/null 2>&1 && break list SC sleep 1 done /usr/sbin/scutil >/dev/null 2>&1 <