cmm put a next hop's MAC into CDX when it programmed the route and then
only watched the next hop's address and interface. A next hop that
changed its MAC (a new ISP modem, an IP reused by another LAN host) kept
receiving its flows at the old MAC, possibly another host's, and new
flows reused the stale route until cmm was restarted. Neighbors no route
used also stayed cached as resolved, so a later route to the same IP got
the old MAC without asking the kernel.
cmm_neigh_check() now re-reads the ARP and NDP tables (one dump per
family) and marks every cached neighbor whose MAC changed or is gone;
cmm_route_check_neighbors() deregisters the routes using it and their
offloaded flows, which re-offload once the next hop resolves again. It
runs every maintenance cycle (30 s) and after route-socket changes, and
cmm_route_handle_change() also treats a different MAC as a change. The
last reference to a neighbor frees it. The link-layer table parser is
shared by both lookups and bounds-checks each entry's length.
pf_notify vetoes af-to (NAT64) states: their two keys are in different
address families, which cmm cannot program.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Offload stays off by default: it is only needed for multi-gigabit
throughput on the 10 GbE ports. The README says how to turn it on and
off (in /etc/rc.conf.local; onestop, since rc.subr refuses a plain stop
once it is disabled) and lists the caveats: no TCP sequence checks for
offloaded flows, Suricata/Zenarmor/NetFlow/tcpdump see only their first
packets, VLAN and rule counters miss hardware traffic, the MAC address
gap, what is untested, and the reboot after an update. RELEASE.md keeps
the design and points there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RELEASE.md: the "offload: off" section becomes "opt-in": how to turn cmm
on (in /etc/rc.conf.local, which overrides rc.conf), which flows go into
hardware and which stay in pf, what offloaded packets still skip
(Suricata, Insight/NetFlow, tcpdump), the reboot after an update, and
what was wrong with the vendor's offload.
ARCHITECTURE.md: pf_notify's RESYNC event, vetoes, route-to target and
orig_kif, the DELETE reserve, sloppy only for offloaded states, and the
flow lifecycle with the offload conditions; the PF_KEY socket is gone
with the IPsec code; cmm only starts with cmm_enable="YES".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
publish mirrors the staged tree with rsync --delete-after, and the share
holds the only copy of series that are no longer built (26.1). A staging
tree rebuilt after /scratch was lost, holding only the current series,
would have deleted 26.1 from the live mirror. publish now stops, before
verifying, when the destination has a directory in its top two levels
(an ABI, a series, releases/<series>) that the staged tree lacks; names
are printed quoted. Retiring a series means deleting it from the share
by hand.
RELEASE.md documents the guard and how to restore the staged tree from
the share.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- K2: config/lock-<version> gives tools, src, ports, plugins and core
their exact commits; build stops when a checkout differs (a tag moved
upstream, or src moved on), and fetches tags without --force.
build.sh lock resolves and writes them. lock-26.7.9 is what 26.7.9 was
built from, checked against the upstream tags.
- K3: verify --root reports symlinks that lead outside the tree or
nowhere, which publish (rsync -L) would follow; such a path is now
reported instead of crashing verify.
- K6: RELEASE.md no longer says core trusts only our key (it also trusts
upstream's, for changelog and bogons), and names no host or user.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hook deleted /boot/kernel/kernel.bin once it was on the FAT
partition, so the health audit always reported it missing (seen on the
gateway after the 26.7.9 upgrade). It now leaves the kernel set's files
alone and returns early, without a space check or a log line, when the
kernel and device tree on the FAT partition are already the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- pkg 2.8 (26.7) writes a package's catalogue checksum as "2$" and its
BLAKE2b-512 in pkg's base32; accept it next to pkg 2.3's SHA-256 hex
and check each against its own digest, read once for both. Latest/
signatures stay over the SHA-256: a BLAKE2b catalogue checks them when
deep, and only their key when shallow, as for the sets.
- TarSource members share the set's file object, which every read
seeks, and verify_repo reads them from eight threads: the 26.7.9
upgrade set failed at random packages. Reads now take turns.
- Report the upgrade set's results under its path, not ".".
- Clean up the trust objects' temporary directories.
Tests: the root and URL verify tests run again with BLAKE2b catalogues,
a pkg 2.8.4 checksum pins the encoding, and the upgrade set gets its
own tests (parallel reads of large packages, a tampered package in a
signed set, a bad .abi_hint).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
U-Boot boots boot/kernel/kernel.bin, and the gateway's 20-kernel-update
skips a kernel set without one, leaving the old kernel in place. FreeBSD
15 builds it only with WITH_KERNEL_BIN, which the 26.7.9 image build was
the first to notice; check the kernel set right after it is built.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since 26.7 the ports tree builds pkg from opnsense/pkg (2.8.4) and tools
compares the host's pkg with it; ports-mgmt/pkg is FreeBSD's 2.9.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- caam: the bus activate, deactivate and release resource methods take
no type and rid in FreeBSD 15.
- cdx: sys/cdefs.h defines __maybe_unused now; define it only if missing.
- 26.1 is end of life and no longer built: remove patches/26.1 and
make-26.1.conf, default to 26.7 and FreeBSD 15.1 throughout, and move
the build examples in README.md and RELEASE.md to 26.7.9. The 26.1
tree on the mirror stays, for gateways that still have to upgrade.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The security audit of the vendor's fastpath found that offloaded flows
ignore pf route-to/reply-to and gateway rules (VPN-as-gateway traffic can
leave on WAN), that pf_notify marks every pf state sloppy while cmm runs,
that bridged traffic is offloaded without pf, that hardware flows can
outlive their pf state, and that the IPsec exception path panics. New
images no longer enable cmm, and RELEASE.md gives the commands for a
gateway that was installed from the vendor's image. The board modules
still load; nothing is offloaded without cmm.
rc.d/20-kernel-update is our rewrite: its Mono copyright line goes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CMM restart on interface reassignment moves to the MVC assignment
API, which replaced interfaces_assign.php in 26.7. The mirror patch is
unchanged but for the plist, where upstream's trusted key changed. Both
apply to core 26.7.9 with git am. caddy-custom's plugins are pinned at
their versions of 2026-11-11, when 26.7.9 was tagged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tools makes Latest/ for the main repository only, and upstream's aux
repository has none either, so verify no longer requires it there. The Go
toolchain in aux ships ELF test data and race-detector objects for every
platform under /usr/local/go<N>/src/; that tree is exempt from the aarch64
check, nothing else of the Go packages is.
The first real 26.1.11 mirror now verifies clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tools signs the aux repository's catalogue only in a packages step run
with the key; its sign-packages re-signs the packages set's catalogue but
not the aux set's. Build runs without the key, so the aux catalogue stayed
unsigned and gwmirror verify rejected it. finish now unpacks the aux set,
signs its catalogue with pkg repo and repacks it before tools signs the set.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
finish's scan imported the image's pool with every dataset mounted under
an altroot. The pool's own dataset needs a mountpoint inside the read-only
root, so nothing was mounted, find scanned an empty directory, and the
export then failed with "pool is busy". The pool is now imported without
mounting, and each dataset is mounted read-only by itself. The root must
have /bin/sh, so an empty scan cannot pass. The export is retried, since
the pool stays busy for a while after the import and after an unmount.
build.sh now says when set -e stops it, and vm.sh sign returns finish's
exit status, not tee's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
xcaddy fetches www/caddy-custom's plugins while it builds, at their
newest versions; caddy-l4 v0.1.3 (2026-11-09) needs caddy 2.11.7 and the
ports tree has 2.11.4, so the port failed. config/make-<series>.conf,
added to tools' make.conf by ports_make_conf, pins tools' plugin list at
the versions of 2026-07-01, when 26.1.11 was tagged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codeberg now compresses tag archives with GNU gzip instead of git's own,
so sysutils/sysinfo's 1.0.4 archive is 15546 bytes, not distinfo's 15618,
and FreeBSD's distfile cache serves the new one too. git archive of the
tag with git's gzip at level 6 reproduces the original exactly (SHA256
checked by the port). The FETCH_CMD wrapper does that for Codeberg tag
archives, after checking owner, repository and tag strictly, and is
renamed for the second kind of repair.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tools ran make clean after each port, which cleans every dependency with
the port's own flavor: a dependency with another flavor, or none, looks
for the wrong work-<flavor> and keeps its work directory. After a failure
tools removes the dependencies it built, and the stale directory claims
they are installed, so every later port needing them failed at once
(Rust: cmake not found; libxslt.so not found). build now has tools'
ports.sh remove every work directory instead, and stops if ports.sh no
longer has the two cleans it replaces.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ports tree's clean passes a flavored port's FLAVOR on to its
dependencies, so a dependency without flavors looks for work-<flavor> and
keeps its half-built work directory; its build tools are removed, and
every later port that needs it fails at once until the next step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Rust build in the 12 GB VM lost two llvm-tblgen 2.8 hours in:
FreeBSD kills a process that has waited 30 seconds for a page, and the
emulated VM's pageout took that long with the swap unused. setup turns
those kills off (vm.pfault_oom_attempts=-1), and build caps lang/rust,
which builds its own LLVM with a job per CPU, at one job per 768 MB
through tools' make.conf.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
host_pkg fetched pkg's distfiles again for every build of the host
pkg, and GitHub turned one of its patches away four times in a row,
which stopped the build. It now seeds them into the distfiles set
(repair_distfiles, which skips what the set has) and extracts them
from there. port_distfiles names a port's entries in the set, for
both host_pkg and distfiles_in_set (whose awk now reads them from
the environment).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FreeBSD's tar lists an empty file as an empty archive, so a package
file cut off at zero bytes passed salvage_ports' check. A salvaged
package must now also hold +MANIFEST.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A 16 GB VM (18 GB in qemu, 7 GB of it ZFS cache) and the HTPC's other
work ran the HTPC out of memory, and its reboot lost 12 hours of the
ports step. The VM now gets a swap disk of its own (swap.qcow2, serial
gwswap, cache=none: off ZFS, where swap can deadlock, and past the
host's page cache), and setup caps the VM's ZFS cache at 2 GB
(vm_memory). The VM itself goes down to 12 GB in vm.conf.
Tools writes the packages set only when a ports step ends. build now
first adds what an interrupted step had finished (salvage_ports): the
runtime packages in the stage's packages directory, when the stage
belongs to the same series, version and ports commit, each checked to
be a whole archive. Build-only dependencies are rebuilt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The restarted build stopped at seeding pkg's distfiles: GitHub
answered "Service Unavailable" for a patch the distfiles set already
held. repair_distfiles now skips a port whose distfiles and patch
files are all in the set (distfiles_in_set), and fetch-patch.sh tries
GitHub's current patch three times, a minute apart.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tools caches the build-only dependencies it builds (cmake, autoconf,
the Rust and Go compilers) for the rest of a ports step only, and the
packages set keeps just the listed ports and their runtime
dependencies. Each chunk therefore rebuilt them: the second chunk
started by rebuilding the autotools the first had built.
The step also runs without an argument now: an argument makes tools
stop at the first failed port, while without one it goes on with the
others and fails at the end. ports_list served only the chunks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tools' distfiles step walks every port's whole dependency tree again,
one make at a time: 70 of 266 ports in 9 hours under emulation. It
also walks the default flavor's tree for flavored ports (QEMU's desktop
dependencies for qemu@guestagent) and fails there on a port the build
never needs (gstreamer1-plugins-bad, missing from its distinfo). The
ports step fetches what it builds anyway, so the step is dropped, and
with it the tools patch that only fixed it.
pkg's distfiles are seeded into the distfiles set (which tools
extracts into the ports chroot) before the first chunk. A chunk whose
log shows "Couldn't fetch it" or "Giving up on fetching files" has
those ports repaired with fetch-patch.sh and runs once more.
fetch_failures accepts only port names, tested against real and
crafted logs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Natively, the first fetch in tools' distfiles chroot builds pkg, whose
GitHub patches no longer match distinfo, and tools' fetch loop records
a failure in a path outside the chroot, which under sh -e ended the
loop with no port named. patches/tools/0001 records failures inside
the chroot (as tools' ports step does); build.sh applies patches/tools
to every series. pkg's distfiles go into the set before the step, via
fetch-patch.sh; repairs are appended to the set instead of rewriting
a set of many gigabytes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
qemu-user cannot run cargo, so no Rust port (py-cryptography and its
dependents) can be cross-built. The build VM is now FreeBSD arm64 under
full-system emulation (qemu-system-aarch64, TCG), run by the new
release/vmhost.sh in a rootless podman container on the build host
GW_VMHOST. vm.sh drives it over ssh and reaches the VM's loopback-only
ssh port through the host (ProxyJump). Settings may live in
$GW_KEYDIR/vm.conf.
The image download probes its sources, resumes stalled transfers and
falls back to a mirror that keeps old releases; the checksum always comes
from FreeBSD itself.
build.sh builds the ports in chunks of PORTS_CHUNK (20) with timings, so
progress is visible and a failure costs one chunk, then runs the whole
list once more to bundle the set. ports_list evaluates ports.conf like
tools' list_config does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The mirror share refuses ":" in names, ignores case, and lists device
names such as "aux" under a mangled 8.3 name, which rsync would delete as
an unknown file (the real directory). So FreeBSD:<N>:aarch64 is stored
as FreeBSD_<N>_aarch64 and a series' aux repository as aux-repo, in the
staged tree and on the share alike; nginx rewrites the client URLs onto
them, and gwmirror reads and writes through the same mapping.
verify --root, and therefore publish, now fails on any other name the
share cannot store (reserved characters, device names, trailing dot or
space, names differing only in case).
Checked with the real nginx image in podman: a deep verify --url of a
staged fixture passes, aux included, with the live changelog/bogons proxy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first pilot stopped building the host pkg: GitHub now abbreviates the
object names on the index lines of its generated commit patches with 10
digits instead of 9, so OPNsense's patches of ports-mgmt/pkg no longer
match distinfo, and nothing caches OPNsense's own distfiles.
- release/fetch-patch.sh: FETCH_CMD that, when fetch(1) fails for a
GitHub commit/pull/compare patch, shortens the abbreviations until the
size matches; the port's checksum target verifies the SHA256.
- build.sh: run tools' distfiles step on its own, repair the ports it
could not fetch on the host into the distfiles set, and rerun it; the
pilot fetches its ports' distfiles too; host pkg uses the wrapper.
- vm.sh sync: files owned by root in the VM. They kept the workstation's
uid, git refused the "dubious" repository, and that defeated the dirty
check silently. build.sh now fails when git cannot read /usr/deps, and
the package target refuses a version without the commit count.
- migrate-device.sh: FreeBSD grep rejects the empty alternative in the
fingerprint file check, so it failed on every device. Found by running
release/tests on the build VM, now part of the documented test run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hang blamed on Forgejo in the previous commit was git waiting at an
invisible username prompt: the forks are internal to code.karsttech.com
and the build VM has no credentials. Fail at once instead, and correct
the reason for the shallow src fetch (its history is not needed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A full clone of opnsense-src from Forgejo hung for 5.5 hours with nothing
transferred. The build never reads src history (tools only describes src
when VERSION is not numeric), so fetch just the ref's commit; core, plugins
and ports keep full history and tags for their version strings.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>