#!/bin/sh
set -eu

BRIDGE="${1:-warden0}"
GATEWAY="${2:-192.168.100.1}"
SUBNET="${3:-192.168.100.0/24}"

printf 'bridge=%s\n' "$BRIDGE"
ifconfig "$BRIDGE" >/tmp/warden-pf-ifconfig.txt 2>/dev/null
grep -q "inet ${GATEWAY} " /tmp/warden-pf-ifconfig.txt

printf 'forwarding='
sysctl -n net.inet.ip.forwarding

printf 'nat-rules\n'
pfctl -sn | grep "$SUBNET"

printf 'filter-rules\n'
pfctl -sr >/dev/null

rm -f /tmp/warden-pf-ifconfig.txt
