DF-0572 / run.sh
#!/bin/sh # DF-0572 run: drives parallel UDP traffic through ipfw3 NAT to expose the per-CPU # cfg_nat cache collapse. On the bug-present module ALL outbound states converge # onto ONE cpu_id (the cached cfg_nat); on the fixed module they would distribute. # # MUST RUN AS ROOT on the guest (modules + firewall). Run the trigger as the # unprivileged user (maxx) in parallel. set -e sysctl net.filters_default_to_accept=1 >/dev/null 2>&1 || true kldload ipfw3 2>/dev/null || true kldload ipfw3_basic 2>/dev/null || true kldload ipfw3_nat 2>/dev/null || true ALIAS_IP=$(ifconfig vtnet0 | grep 'inet ' | awk '{print $2}') ipfw3 nat 1 config ip "$ALIAS_IP" 2>/dev/null || true ipfw3 add 100 nat 1 udp from any to any out via vtnet0 2>/dev/null || true cc -O2 -o /tmp/nat_oob_trigger nat_oob_trigger.c echo "driving 6 parallel UDP senders across all CPUs..." for i in 1 2 3 4 5 6; do /tmp/nat_oob_trigger 1500 10.0.2.2 >/dev/null 2>&1 & done wait echo "=== outbound UDP state cpu_id distribution (bug-present => ALL on one cpu) ===" ipfw3 nat 1 show state 2>/dev/null | grep ' udp ' | awk '$7=="o"{print $2}' | sort -n | uniq -c echo "=== on the FIXED (no-cache) module + multi-queue NIC, states distribute across 0..5 ===" |