DragonFlyBSD Kernel Audit
DF-0729 / setup.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-0729 — setup the live IPv6 P2P routing-loop environment.
# Run as root. Creates a gif self-tunnel so packets arriving on gif0
# route back out gif0, triggering the IFF_POINTOPOINT loop detector
# at ip6_forward.c:248-262.
set -e

echo "[setup] loading gif module"
kldload if_gif 2>/dev/null || true

echo "[setup] disabling IPv6 DAD (self-tunnel causes duplicate detection)"
sysctl net.inet6.ip6.dad_count=0 2>/dev/null || true

echo "[setup] creating gif0 self-tunnel (outer 10.0.2.15 -> 10.0.2.15)"
ifconfig gif0 create 2>/dev/null || true
ifconfig gif0 tunnel 10.0.2.15 10.0.2.15
ifconfig gif0 inet6 fc00::1/64 up

echo "[setup] enabling IPv6 forwarding"
sysctl net.inet6.ip6.forwarding=1

echo "[setup] route fc00:dead::/64 through gif0 (routing loop target)"
route delete -inet6 fc00:dead::/64 2>/dev/null || true
route add -inet6 fc00:dead::/64 -iface gif0

echo "[setup] done — gif0 config:"
ifconfig gif0
echo "[setup] routes:"
route get -inet6 fc00:dead::1 2>&1 || true