summaryrefslogtreecommitdiffstats
path: root/test/TEST-50-MULTINIC
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:54:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:54:25 +0000
commit9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a (patch)
tree2efb72864cc69e174c9c5ee33efb88a5f1553b48 /test/TEST-50-MULTINIC
parentInitial commit. (diff)
downloaddracut-9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a.tar.xz
dracut-9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a.zip
Adding upstream version 060+5.upstream/060+5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/TEST-50-MULTINIC')
-rw-r--r--test/TEST-50-MULTINIC/Makefile1
-rwxr-xr-xtest/TEST-50-MULTINIC/client-init.sh40
-rw-r--r--test/TEST-50-MULTINIC/client.link6
-rwxr-xr-xtest/TEST-50-MULTINIC/create-root.sh23
-rw-r--r--test/TEST-50-MULTINIC/dhcpd.conf36
-rw-r--r--test/TEST-50-MULTINIC/exports1
-rwxr-xr-xtest/TEST-50-MULTINIC/finished-false.sh2
-rwxr-xr-xtest/TEST-50-MULTINIC/hard-off.sh3
-rw-r--r--test/TEST-50-MULTINIC/hosts5
-rwxr-xr-xtest/TEST-50-MULTINIC/server-init.sh98
-rw-r--r--test/TEST-50-MULTINIC/server.link6
-rwxr-xr-xtest/TEST-50-MULTINIC/test.sh376
-rwxr-xr-xtest/TEST-50-MULTINIC/wait-if-server.sh3
13 files changed, 600 insertions, 0 deletions
diff --git a/test/TEST-50-MULTINIC/Makefile b/test/TEST-50-MULTINIC/Makefile
new file mode 100644
index 0000000..2dcab81
--- /dev/null
+++ b/test/TEST-50-MULTINIC/Makefile
@@ -0,0 +1 @@
+-include ../Makefile.testdir
diff --git a/test/TEST-50-MULTINIC/client-init.sh b/test/TEST-50-MULTINIC/client-init.sh
new file mode 100755
index 0000000..4c51e27
--- /dev/null
+++ b/test/TEST-50-MULTINIC/client-init.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+. /lib/dracut-lib.sh
+
+export PATH=/usr/sbin:/usr/bin:/sbin:/bin
+command -v plymouth > /dev/null 2>&1 && plymouth --quit
+exec > /dev/console 2>&1
+
+export TERM=linux
+export PS1='initramfs-test:\w\$ '
+stty sane
+echo "made it to the rootfs! Powering down."
+
+set -x
+
+for i in /sys/class/net/*; do
+ # booting with network-manager module
+ state=/run/NetworkManager/devices/$(cat "$i"/ifindex)
+ grep -q connection-uuid= "$state" 2> /dev/null || continue
+ i=${i##*/}
+ [ "$i" = lo ] && continue
+ ip link show "$i" | grep -q master && continue
+ IFACES="${IFACES}${i} "
+done
+
+for i in /run/initramfs/net.*.did-setup; do
+ # booting with network-legacy module
+ [ -f "$i" ] || continue
+ strglobin "$i" ":*:*:*:*:" && continue
+ i=${i%.did-setup}
+ IFACES="${IFACES}${i##*/net.} "
+done
+{
+ echo "OK"
+ echo "$IFACES"
+} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
+
+getargbool 0 rd.shell && sh -i
+
+sync
+poweroff -f
diff --git a/test/TEST-50-MULTINIC/client.link b/test/TEST-50-MULTINIC/client.link
new file mode 100644
index 0000000..b992bfd
--- /dev/null
+++ b/test/TEST-50-MULTINIC/client.link
@@ -0,0 +1,6 @@
+[Match]
+OriginalName=*
+
+[Link]
+NamePolicy=keep kernel database onboard slot path
+MACAddressPolicy=keep
diff --git a/test/TEST-50-MULTINIC/create-root.sh b/test/TEST-50-MULTINIC/create-root.sh
new file mode 100755
index 0000000..8060b00
--- /dev/null
+++ b/test/TEST-50-MULTINIC/create-root.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+trap 'poweroff -f' EXIT
+
+# don't let udev and this script step on eachother's toes
+for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
+ : > "/etc/udev/rules.d/$x"
+done
+rm -f -- /etc/lvm/lvm.conf
+udevadm control --reload
+udevadm settle
+
+set -ex
+
+mkfs.ext4 -L dracut /dev/disk/by-id/ata-disk_root
+mkdir -p /root
+mount -t ext4 /dev/disk/by-id/ata-disk_root /root
+cp -a -t /root /source/*
+mkdir -p /root/run
+umount /root
+echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
+sync
+poweroff -f
diff --git a/test/TEST-50-MULTINIC/dhcpd.conf b/test/TEST-50-MULTINIC/dhcpd.conf
new file mode 100644
index 0000000..be8dee7
--- /dev/null
+++ b/test/TEST-50-MULTINIC/dhcpd.conf
@@ -0,0 +1,36 @@
+ddns-update-style none;
+
+use-host-decl-names true;
+
+subnet 192.168.50.0 netmask 255.255.255.0 {
+ option subnet-mask 255.255.255.0;
+ option routers 192.168.50.1;
+ next-server 192.168.50.1;
+ server-identifier 192.168.50.1;
+ option domain-name-servers 192.168.50.1;
+ option domain-search "example.com";
+ option domain-name "other.com";
+
+ group {
+ host client-if1 {
+ hardware ethernet 52:54:00:12:34:00;
+ fixed-address 192.168.50.100;
+ }
+ }
+
+ group {
+ host client-if2 {
+ hardware ethernet 52:54:00:12:34:01;
+ fixed-address 192.168.50.101;
+ }
+ }
+
+ group {
+ option root-path "nfs:192.168.50.1:/nfs/client";
+
+ host client-if3 {
+ hardware ethernet 52:54:00:12:34:02;
+ fixed-address 192.168.50.102;
+ }
+ }
+}
diff --git a/test/TEST-50-MULTINIC/exports b/test/TEST-50-MULTINIC/exports
new file mode 100644
index 0000000..ff5f29b
--- /dev/null
+++ b/test/TEST-50-MULTINIC/exports
@@ -0,0 +1 @@
+/nfs/client 192.168.50.0/24(rw,insecure,no_subtree_check,no_root_squash)
diff --git a/test/TEST-50-MULTINIC/finished-false.sh b/test/TEST-50-MULTINIC/finished-false.sh
new file mode 100755
index 0000000..ecdbef9
--- /dev/null
+++ b/test/TEST-50-MULTINIC/finished-false.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exit 1
diff --git a/test/TEST-50-MULTINIC/hard-off.sh b/test/TEST-50-MULTINIC/hard-off.sh
new file mode 100755
index 0000000..01acb19
--- /dev/null
+++ b/test/TEST-50-MULTINIC/hard-off.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
diff --git a/test/TEST-50-MULTINIC/hosts b/test/TEST-50-MULTINIC/hosts
new file mode 100644
index 0000000..d02a4e9
--- /dev/null
+++ b/test/TEST-50-MULTINIC/hosts
@@ -0,0 +1,5 @@
+127.0.0.1 localhost
+192.168.50.1 server
+192.168.50.100 client-if1
+192.168.50.101 client-if2
+192.168.50.102 client-if3
diff --git a/test/TEST-50-MULTINIC/server-init.sh b/test/TEST-50-MULTINIC/server-init.sh
new file mode 100755
index 0000000..997b1d1
--- /dev/null
+++ b/test/TEST-50-MULTINIC/server-init.sh
@@ -0,0 +1,98 @@
+#!/bin/bash
+exec < /dev/console > /dev/console 2>&1
+set -x
+export PATH=/usr/sbin:/usr/bin:/sbin:/bin
+export TERM=linux
+export PS1='nfstest-server:\w\$ '
+: > /dev/watchdog
+stty sane
+echo "made it to the rootfs!"
+echo server > /proc/sys/kernel/hostname
+
+wait_for_if_link() {
+ local cnt=0
+ local li
+ while [ $cnt -lt 600 ]; do
+ li=$(ip -o link show dev "$1" 2> /dev/null)
+ [ -n "$li" ] && return 0
+ sleep 0.1
+ cnt=$((cnt + 1))
+ done
+ return 1
+}
+
+wait_for_if_up() {
+ local cnt=0
+ local li
+ while [ $cnt -lt 200 ]; do
+ li=$(ip -o link show up dev "$1")
+ [ -n "$li" ] && return 0
+ sleep 0.1
+ cnt=$((cnt + 1))
+ done
+ return 1
+}
+
+wait_for_route_ok() {
+ local cnt=0
+ while [ $cnt -lt 200 ]; do
+ li=$(ip route show)
+ [ -n "$li" ] && [ -z "${li##*"$1"*}" ] && return 0
+ sleep 0.1
+ cnt=$((cnt + 1))
+ done
+ return 1
+}
+
+linkup() {
+ wait_for_if_link "$1" 2> /dev/null && ip link set "$1" up 2> /dev/null && wait_for_if_up "$1" 2> /dev/null
+}
+
+wait_for_if_link enx525401123456
+
+ip addr add 127.0.0.1/8 dev lo
+ip link set lo up
+ip addr add 192.168.50.1/24 dev enx525401123456
+linkup enx525401123456
+
+: > /dev/watchdog
+modprobe af_packet
+: > /dev/watchdog
+modprobe sunrpc
+: > /dev/watchdog
+mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
+: > /dev/watchdog
+[ -x /sbin/portmap ] && portmap
+: > /dev/watchdog
+mkdir -p /run/rpcbind
+[ -x /sbin/rpcbind ] && rpcbind
+: > /dev/watchdog
+modprobe nfsd
+: > /dev/watchdog
+mount -t nfsd nfsd /proc/fs/nfsd
+: > /dev/watchdog
+exportfs -r
+: > /dev/watchdog
+rpc.nfsd
+: > /dev/watchdog
+rpc.mountd
+: > /dev/watchdog
+command -v rpc.idmapd > /dev/null && [ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
+: > /dev/watchdog
+exportfs -r
+: > /dev/watchdog
+mkdir -p /var/lib/dhcpd
+: > /var/lib/dhcpd/dhcpd.leases
+: > /dev/watchdog
+chmod 777 /var/lib/dhcpd/dhcpd.leases
+: > /dev/watchdog
+rm -f /var/run/dhcpd.pid
+dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
+exportfs -s
+echo "Serving NFS mounts"
+while :; do
+ [ -n "$(jobs -rp)" ] && : > /dev/watchdog
+ sleep 10
+done
+mount -n -o remount,ro /
+poweroff -f
diff --git a/test/TEST-50-MULTINIC/server.link b/test/TEST-50-MULTINIC/server.link
new file mode 100644
index 0000000..1d21856
--- /dev/null
+++ b/test/TEST-50-MULTINIC/server.link
@@ -0,0 +1,6 @@
+[Match]
+OriginalName=*
+
+[Link]
+NamePolicy=mac
+MACAddressPolicy=keep
diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh
new file mode 100755
index 0000000..4f81235
--- /dev/null
+++ b/test/TEST-50-MULTINIC/test.sh
@@ -0,0 +1,376 @@
+#!/bin/bash
+
+# shellcheck disable=SC2034
+TEST_DESCRIPTION="root filesystem on NFS with multiple nics with $USE_NETWORK"
+
+# Uncomment this to debug failures
+#DEBUGFAIL="loglevel=7 rd.shell rd.break"
+#SERIAL="tcp:127.0.0.1:9999"
+
+run_server() {
+ # Start server first
+ echo "MULTINIC TEST SETUP: Starting DHCP/NFS server"
+
+ declare -a disk_args=()
+ # shellcheck disable=SC2034
+ declare -i disk_index=0
+ qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root
+
+ "$testdir"/run-qemu \
+ "${disk_args[@]}" \
+ -net socket,listen=127.0.0.1:12350 \
+ -net nic,macaddr=52:54:01:12:34:56,model=e1000 \
+ -serial "${SERIAL:-"file:$TESTDIR/server.log"}" \
+ -device i6300esb -watchdog-action poweroff \
+ -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0" \
+ -initrd "$TESTDIR"/initramfs.server \
+ -pidfile "$TESTDIR"/server.pid -daemonize || return 1
+
+ chmod 644 -- "$TESTDIR"/server.pid || return 1
+
+ # Cleanup the terminal if we have one
+ tty -s && stty sane
+
+ if ! [[ $SERIAL ]]; then
+ while :; do
+ grep Serving "$TESTDIR"/server.log && break
+ echo "Waiting for the server to startup"
+ tail "$TESTDIR"/server.log
+ sleep 1
+ done
+ else
+ echo Sleeping 10 seconds to give the server a head start
+ sleep 10
+ fi
+}
+
+client_test() {
+ local test_name="$1"
+ local mac1="$2"
+ local mac2="$3"
+ local mac3="$4"
+ local cmdline="$5"
+ local check="$6"
+
+ echo "CLIENT TEST START: $test_name"
+
+ declare -a disk_args=()
+ # shellcheck disable=SC2034
+ declare -i disk_index=0
+ qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
+ cmdline="$cmdline rd.net.timeout.dhcp=30"
+
+ # Invoke KVM and/or QEMU to actually create the target filesystem.
+ test_marker_reset
+ "$testdir"/run-qemu \
+ "${disk_args[@]}" \
+ -net socket,connect=127.0.0.1:12350 \
+ -net nic,macaddr=52:54:00:12:34:"$mac1",model=e1000 \
+ -net nic,macaddr=52:54:00:12:34:"$mac2",model=e1000 \
+ -net nic,macaddr=52:54:00:12:34:"$mac3",model=e1000 \
+ -netdev hubport,id=n1,hubid=1 \
+ -netdev hubport,id=n2,hubid=2 \
+ -device e1000,netdev=n1,mac=52:54:00:12:34:98 \
+ -device e1000,netdev=n2,mac=52:54:00:12:34:99 \
+ -device i6300esb -watchdog-action poweroff \
+ -append "quiet panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console" \
+ -initrd "$TESTDIR"/initramfs.testing || return 1
+
+ {
+ read -r OK
+ read -r IFACES
+ } < "$TESTDIR"/marker.img
+
+ if [[ $OK != "OK" ]]; then
+ echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
+ return 1
+ fi
+
+ for i in $check; do
+ if [[ " $IFACES " != *\ $i\ * ]]; then
+ echo "$i not in '$IFACES'"
+ echo "CLIENT TEST END: $test_name [FAILED - BAD IF]"
+ return 1
+ fi
+ done
+
+ for i in $IFACES; do
+ if [[ " $check " != *\ $i\ * ]]; then
+ echo "$i in '$IFACES', but should not be"
+ echo "CLIENT TEST END: $test_name [FAILED - BAD IF]"
+ return 1
+ fi
+ done
+
+ echo "CLIENT TEST END: $test_name [OK]"
+ return 0
+}
+
+test_run() {
+ if ! run_server; then
+ echo "Failed to start server" 1>&2
+ return 1
+ fi
+ test_client
+ ret=$?
+ kill_server
+ return $ret
+}
+
+test_client() {
+ # Mac Numbering Scheme
+ # ...:00-02 receive IP addresses all others don't
+ # ...:02 receives a dhcp root-path
+
+ # PXE Style BOOTIF=
+ client_test "MULTINIC root=nfs BOOTIF=" \
+ 00 01 02 \
+ "root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00" \
+ "enp0s1" || return 1
+
+ client_test "MULTINIC root=nfs BOOTIF= ip=enp0s3:dhcp" \
+ 00 01 02 \
+ "root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00 ip=enp0s2:dhcp" \
+ "enp0s1 enp0s2" || return 1
+
+ # PXE Style BOOTIF= with dhcp root-path
+ client_test "MULTINIC root=dhcp BOOTIF=" \
+ 00 01 02 \
+ "root=dhcp BOOTIF=52-54-00-12-34-02" \
+ "enp0s3" || return 1
+
+ # Multinic case, where only one nic works
+ client_test "MULTINIC root=nfs ip=dhcp" \
+ FF 00 FE \
+ "root=nfs:192.168.50.1:/nfs/client ip=dhcp" \
+ "enp0s2" || return 1
+
+ # Require two interfaces
+ client_test "MULTINIC root=nfs ip=enp0s2:dhcp ip=enp0s3:dhcp bootdev=enp0s2" \
+ 00 01 02 \
+ "root=nfs:192.168.50.1:/nfs/client ip=enp0s2:dhcp ip=enp0s3:dhcp bootdev=enp0s2" \
+ "enp0s2 enp0s3" || return 1
+
+ # Require three interfaces with dhcp root-path
+ client_test "MULTINIC root=dhcp ip=enp0s1:dhcp ip=enp0s2:dhcp ip=enp0s3:dhcp bootdev=enp0s3" \
+ 00 01 02 \
+ "root=dhcp ip=enp0s1:dhcp ip=enp0s2:dhcp ip=enp0s3:dhcp bootdev=enp0s3" \
+ "enp0s1 enp0s2 enp0s3" || return 1
+
+ client_test "MULTINIC bonding" \
+ 00 01 02 \
+ "root=nfs:192.168.50.1:/nfs/client ip=bond0:dhcp bond=bond0:enp0s1,enp0s2,enp0s3:mode=balance-rr" \
+ "bond0" || return 1
+
+ # bridge, where only one interface is actually connected
+ client_test "MULTINIC bridging" \
+ 00 01 02 \
+ "root=nfs:192.168.50.1:/nfs/client ip=bridge0:dhcp::52:54:00:12:34:00 bridge=bridge0:enp0s1,enp0s5,enp0s6" \
+ "bridge0" || return 1
+ return 0
+}
+
+test_setup() {
+ export kernel=$KVERSION
+ export srcmods="/lib/modules/$kernel/"
+ rm -rf -- "$TESTDIR"/overlay
+ (
+ mkdir -p "$TESTDIR"/overlay/source
+ # shellcheck disable=SC2030
+ export initdir=$TESTDIR/overlay/source
+ # shellcheck disable=SC1090
+ . "$PKGLIBDIR"/dracut-init.sh
+
+ (
+ cd "$initdir" || exit
+ mkdir -p dev sys proc run etc var/run tmp var/lib/{dhcpd,rpcbind}
+ mkdir -p var/lib/nfs/{v4recovery,rpc_pipefs}
+ chmod 777 var/lib/rpcbind var/lib/nfs
+ )
+
+ inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
+ dmesg mkdir cp ping exportfs \
+ modprobe rpc.nfsd rpc.mountd showmount tcpdump \
+ sleep mount chmod rm
+ for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
+ if [ -f "${_terminfodir}"/l/linux ]; then
+ inst_multiple -o "${_terminfodir}"/l/linux
+ break
+ fi
+ done
+ type -P portmap > /dev/null && inst_multiple portmap
+ type -P rpcbind > /dev/null && inst_multiple rpcbind
+ [ -f /etc/netconfig ] && inst_multiple /etc/netconfig
+ type -P dhcpd > /dev/null && inst_multiple dhcpd
+ instmods nfsd sunrpc ipv6 lockd af_packet
+ inst ./server-init.sh /sbin/init
+ inst_simple /etc/os-release
+ inst ./hosts /etc/hosts
+ inst ./exports /etc/exports
+ inst ./dhcpd.conf /etc/dhcpd.conf
+ inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc \
+ {,/usr}/etc/protocols {,/usr}/etc/services
+ inst_multiple -o rpc.idmapd /etc/idmapd.conf
+
+ inst_libdir_file 'libnfsidmap_nsswitch.so*'
+ inst_libdir_file 'libnfsidmap/*.so*'
+ inst_libdir_file 'libnfsidmap*.so*'
+
+ _nsslibs=$(
+ cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
+ | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
+ | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
+ )
+ _nsslibs=${_nsslibs#|}
+ _nsslibs=${_nsslibs%|}
+ inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'
+
+ inst /etc/passwd /etc/passwd
+ inst /etc/group /etc/group
+
+ cp -a /etc/ld.so.conf* "$initdir"/etc
+ ldconfig -r "$initdir"
+ dracut_kernel_post
+ )
+
+ # Make client root inside server root
+ (
+ # shellcheck disable=SC2030
+ # shellcheck disable=SC2031
+ export initdir=$TESTDIR/overlay/source/nfs/client
+ # shellcheck disable=SC1090
+ . "$PKGLIBDIR"/dracut-init.sh
+
+ (
+ cd "$initdir" || exit
+ mkdir -p dev sys proc etc run root usr var/lib/nfs/rpc_pipefs
+ )
+
+ inst_multiple sh shutdown poweroff stty cat ps ln ip dd \
+ mount dmesg mkdir cp ping grep setsid ls vi less cat sync
+ for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
+ if [ -f "${_terminfodir}"/l/linux ]; then
+ inst_multiple -o "${_terminfodir}"/l/linux
+ break
+ fi
+ done
+
+ inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+ inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
+ inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util"
+ ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
+ ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
+
+ inst ./client-init.sh /sbin/init
+ inst_simple /etc/os-release
+ inst_multiple -o {,/usr}/etc/nsswitch.conf
+ inst /etc/passwd /etc/passwd
+ inst /etc/group /etc/group
+
+ inst_libdir_file 'libnfsidmap_nsswitch.so*'
+ inst_libdir_file 'libnfsidmap/*.so*'
+ inst_libdir_file 'libnfsidmap*.so*'
+
+ _nsslibs=$(
+ cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
+ | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
+ | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
+ )
+ _nsslibs=${_nsslibs#|}
+ _nsslibs=${_nsslibs%|}
+ inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'
+
+ cp -a /etc/ld.so.conf* "$initdir"/etc
+ ldconfig -r "$initdir"
+ )
+
+ # second, install the files needed to make the root filesystem
+ (
+ # shellcheck disable=SC2030
+ # shellcheck disable=SC2031
+ export initdir=$TESTDIR/overlay
+ # shellcheck disable=SC1090
+ . "$PKGLIBDIR"/dracut-init.sh
+ inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd
+ inst_hook initqueue 01 ./create-root.sh
+ inst_hook initqueue/finished 01 ./finished-false.sh
+ )
+
+ # create an initramfs that will create the target root filesystem.
+ # We do it this way so that we do not risk trashing the host mdraid
+ # devices, volume groups, encrypted partitions, etc.
+ "$DRACUT" -l -i "$TESTDIR"/overlay / \
+ -m "bash rootfs-block kernel-modules qemu" \
+ -d "piix ide-gd_mod ata_piix ext4 sd_mod" \
+ --nomdadmconf \
+ --no-hostonly-cmdline -N \
+ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
+ rm -rf -- "$TESTDIR"/overlay
+
+ declare -a disk_args=()
+ # shellcheck disable=SC2034
+ declare -i disk_index=0
+ qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1
+ qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root 120
+
+ # Invoke KVM and/or QEMU to actually create the target filesystem.
+ "$testdir"/run-qemu \
+ "${disk_args[@]}" \
+ -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
+ -initrd "$TESTDIR"/initramfs.makeroot || return 1
+ test_marker_check dracut-root-block-created || return 1
+
+ # Make an overlay with needed tools for the test harness
+ (
+ # shellcheck disable=SC2031
+ # shellcheck disable=SC2030
+ export initdir="$TESTDIR"/overlay
+ mkdir -p "$TESTDIR"/overlay
+ # shellcheck disable=SC1090
+ . "$PKGLIBDIR"/dracut-init.sh
+ inst_multiple poweroff shutdown
+ inst_hook shutdown-emergency 000 ./hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
+ inst_simple ./client.link /etc/systemd/network/01-client.link
+
+ inst_binary awk
+ inst_hook pre-pivot 85 "$PKGLIBDIR/modules.d/45ifcfg/write-ifcfg.sh"
+ )
+ # Make client's dracut image
+ "$DRACUT" -l -i "$TESTDIR"/overlay / \
+ -o "ifcfg plymouth" \
+ -a "debug watchdog ${USE_NETWORK}" \
+ --no-hostonly-cmdline -N \
+ -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
+
+ (
+ # shellcheck disable=SC2031
+ export initdir="$TESTDIR"/overlay
+ # shellcheck disable=SC1090
+ . "$PKGLIBDIR"/dracut-init.sh
+ rm "$initdir"/etc/systemd/network/01-client.link
+ inst_simple ./server.link /etc/systemd/network/01-server.link
+ inst_hook pre-mount 99 ./wait-if-server.sh
+ )
+ # Make server's dracut image
+ "$DRACUT" -l -i "$TESTDIR"/overlay / \
+ -m "bash rootfs-block debug kernel-modules watchdog qemu network network-legacy" \
+ -d "af_packet piix ide-gd_mod ata_piix ext4 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb ib700wdt" \
+ --no-hostonly-cmdline -N \
+ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1
+
+}
+
+kill_server() {
+ if [[ -s "$TESTDIR"/server.pid ]]; then
+ kill -TERM -- "$(cat "$TESTDIR"/server.pid)"
+ rm -f -- "$TESTDIR"/server.pid
+ fi
+}
+
+test_cleanup() {
+ kill_server
+}
+
+# shellcheck disable=SC1090
+. "$testdir"/test-functions
diff --git a/test/TEST-50-MULTINIC/wait-if-server.sh b/test/TEST-50-MULTINIC/wait-if-server.sh
new file mode 100755
index 0000000..cea7259
--- /dev/null
+++ b/test/TEST-50-MULTINIC/wait-if-server.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+. /lib/net-lib.sh
+wait_for_if_link enx525401123456