#!/bin/sh
# DF-3271 repro: ordinary netgraph7 node-creation churn panics INVARIANTS kernels
# in ng_ID_rehash/hashdestroy. Root on the guest, netgraph7 modules loaded.
# Each iteration: socket node + named + 7 deflate nodes via mkpeer + frames.
set +e
K=/usr/obj/usr/src/sys/netgraph7
kldload $K/netgraph/netgraph.ko 2>/dev/null
kldload $K/socket/ng_socket.ko 2>/dev/null
kldload $K/deflate/ng_deflate.ko 2>/dev/null
[ -x /root/df3270_exploit ] || cc -O -o /root/df3270_exploit /root/df3270_exploit.c
i=0
while [ $i -lt 12 ]; do
	i=$((i+1))
	echo "=== iter $i ==="
	timeout 25 /root/df3270_exploit -g 6 >/tmp/it.log 2>&1
	echo "rc=$?"
done
echo "LOOP_DONE_NO_PANIC (if you can read this, no panic this run)"
dmesg | tail -3
