- compat layer extended through the full BSD API surface pf_ioctl/pf_lb/ pf_if/pf_norm/pf_table/pf_ruleset/radix/md5/sha2 need (all compile): cpumem/counters model, ifaddr/ifg groups, cred view, endian+in6 names, NAT46/64, SipHash24, mbuf_list, frag6 helpers, ip6 forward/checksum, tcp options/FSM names, taskqueue & sysctl shims (documented in docs/porting-notes.md) - pfsrc/divert_sock.c: real BSD divert(4) as runtime-registered PF_DIVERT=32 socket family inside the module (sock_register; NPROTO=AF_MAX=45 -> zero core patches); divert_packet/divert6_packet wired for pf.c - compat/pfk_ifq.c: OpenBSD 8.0 ifq framework with priq back end; hfsc and fq_codel aliases pending M5 (recorded in feature matrix as pending) - design + plan updated for the divert decision (user-requested) - stage-port.sh: single deterministic rename program for headers and .c
53 lines
1.9 KiB
Bash
Executable File
53 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# vm-deploy.sh — ship build artifacts laptop -> deb -> pf0.
|
|
# Default sources (tolerated when absent): out/linux-*-bzImage / out/bzImage,
|
|
# module/*.ko, tools/out/* (files or dirs). Explicit paths as args override.
|
|
# deb landing zone: $DEPLOY_DIR (/var/lib/pflab/deploy); pf0 gets /opt/pf/.
|
|
# Transfer into the guest uses rsync when the guest has it, else scp.
|
|
# Exit 0 with a warning when there is nothing to deploy (T6/T7 call freely).
|
|
set -euo pipefail
|
|
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
|
# shellcheck disable=SC1091
|
|
. "$REPO/scripts/lab-lib.sh"
|
|
lab_env
|
|
|
|
cd "$REPO"
|
|
FILES=()
|
|
add() { # add <path...> — files only; dirs expanded; warns on explicit misses
|
|
local p
|
|
for p in "$@"; do
|
|
if [ -d "$p" ]; then add "$p"/*
|
|
elif [ -f "$p" ]; then FILES+=("$p")
|
|
elif [ "$EXPLICIT" = 1 ]; then warn "skip missing: $p"
|
|
fi
|
|
done
|
|
}
|
|
EXPLICIT=0
|
|
if [ $# -gt 0 ]; then EXPLICIT=1; add "$@"
|
|
else
|
|
shopt -s nullglob
|
|
add out/linux-*-bzImage out/bzImage out/*.ko module/*.ko tools/out/*
|
|
fi
|
|
if [ ${#FILES[@]} -eq 0 ]; then
|
|
log "nothing to deploy (out/ bzImage, module/*.ko, tools/out/* all absent) — OK"
|
|
exit 0
|
|
fi
|
|
log "deploying ${#FILES[@]} artifact(s): ${FILES[*]#$REPO/}"
|
|
|
|
vm_cmd "$(vm_ip pf0)" 'true' 2>/dev/null || die "pf0 unreachable — run ./scripts/vm-create.sh first"
|
|
|
|
deb "mkdir -p $DEPLOY_DIR"
|
|
rsync -a -e "ssh ${SSH_OPTS[*]}" "${FILES[@]}" "$DEB_USER@$DEB:$DEPLOY_DIR/"
|
|
log "staged on deb: $DEPLOY_DIR"
|
|
|
|
vm_cmd "$(vm_ip pf0)" 'mkdir -p /opt/pf'
|
|
if deb "command -v rsync" >/dev/null 2>&1 && \
|
|
vm_cmd "$(vm_ip pf0)" 'command -v rsync' >/dev/null 2>&1; then
|
|
deb_cmd "rsync -a -e 'ssh -i $LAB_KEY_DEB $VMSSH_OPTS' '$DEPLOY_DIR/' root@$(vm_ip pf0):/opt/pf/"
|
|
else
|
|
# no rsync in guest: per-file scp
|
|
deb_cmd "for f in '$DEPLOY_DIR'/*; do scp -i $LAB_KEY_DEB $VMSSH_OPTS -q \"\$f\" root@$(vm_ip pf0):/opt/pf/; done"
|
|
fi
|
|
log "pf0:/opt/pf ->"
|
|
vm_cmd "$(vm_ip pf0)" 'ls -l /opt/pf'
|