#!/bin/sh
# DF-0502 reproduction attempt — records the trigger sequence and the environment blocker.
# Run as root on the DragonFly guest. (Outcome on this build: cannot create the ng_fec node.)
set -x
kldload ng_fec 2>&1 || echo "(ng_fec already loaded)"
kldload ng_ether 2>&1 || echo "(ng_ether already loaded)"
ifconfig tap create 2>&1   # tap0 — would-be bundle member
ifconfig tap create 2>&1   # tap1 — second member
echo "--- attempt to create an ng_fec node via mkpeer off ng_ether ---"
ngctl mkpeer tap0: upper fec lower 2>&1; echo "mkpeer_rc=$?"
ngctl list 2>&1 | grep -iE "fec|Type:"
ifconfig fec0 2>&1 | head -1
echo "============================================================"
echo "On this DragonFly netgraph7 build, mkpeer off ng_ether returns"
echo "EINVAL for EVERY type (echo/tee/fec) because ng_ether_rcvmsg()"
echo "(sys/netgraph7/ether/ng_ether.c:560) drops generic NGM_MKPEER"
echo "messages instead of forwarding them to ng_generic_msg."
echo "=> no ng_fec node can be instantiated => the shutdown infinite-"
echo "loop trigger topology cannot be set up on this guest."
echo "The bug itself is unambiguous (see VERDICT.md / fix.diff)."
echo "============================================================"
echo "If a node COULD be created, the trigger would be:"
echo "  ngctl msg fec0: add_iface tap1   ;# add a member"
echo "  ifconfig tap1 destroy            ;# destroy it out-of-band"
echo "  ngctl shutdown fec0:             ;# -> ng_fec_shutdown infinite loop"
