FDD-book/examples/part-06/ch28-network-driver/shared/smoke.sh
Edson Brandi 6e6dac94fe Add book companion files under examples/
Organize companion code and materials by book part:

  part-01/      Foundations
  part-02/      Kernel & driver fundamentals
  part-03/      Character & block devices
  part-04/      Networking & storage
  part-05/      Buses & advanced topics
  part-06/      Debugging & performance
  part-07/      Real-world drivers
  appendices/   Supplementary material
  README.md     Overview and build instructions
2026-04-25 16:51:00 +00:00

34 lines
711 B
Bash
Executable file

#!/bin/sh
#
# smoke.sh - minimum viable lifecycle check for mynet.
#
# Loads the module, creates an instance, configures an address, prints
# the observable state, and tears everything down. Intended for use
# after any change to mynet.c as a quick regression check.
#
# Run this from the chapter directory:
# examples/part-06/ch28-network-driver/
# after building with "make".
#
# Requires root and FreeBSD 14.3 or later.
set -e
echo "== load =="
kldload ./mynet.ko
echo "== create =="
ifconfig mynet create
echo "== configure =="
ifconfig mynet0 inet 192.0.2.1/24 up
echo "== observe =="
ifconfig mynet0
netstat -in -I mynet0
echo "== teardown =="
ifconfig mynet0 destroy
kldunload mynet
echo "OK"