Commit graph

20 commits

Author SHA1 Message Date
ae932c9c46 Offload: follow next-hop MAC changes; veto af-to
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>
2026-11-28 04:22:57 -05:00
1f06ea3817 README: how to turn hardware flow offload on and off, and its caveats
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>
2026-11-28 04:16:25 -05:00
87893ded3e Build 26.7 for FreeBSD 15 only; port caam and cdx to its kernel
- 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>
2026-11-23 19:26:41 -05:00
52f795704a Fetch distfiles as the ports build, repairing failed fetches per chunk
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>
2026-11-19 16:15:18 -05:00
b59c0e41ed Repair distfiles that tools' chroot cannot fetch, and let tools list them
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>
2026-11-19 06:45:58 -05:00
dcc4d129ab Build natively in an emulated arm64 VM on a remote build host
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>
2026-11-18 23:42:04 -05:00
ab6b52207f mirror: gwmirror stage/verify/publish, nginx stack, release docs
- 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>
2026-11-17 18:56:54 -05:00
Maurice Walker
93b3a45ddd Move mirror / repo / fingerprint configuration to core package
This is how our releases have always been built: Patch opnsense/core before building it. This is required for online updates.
Also, update the readme to use opnsense.mono.si for prefetching sets. The packages set available there includes the patched core package.
2026-06-17 03:49:36 +02:00
Maurice Walker
3ad64901e4
readme: use upstream opnsense/tools 2026-03-19 03:57:27 +01:00
Tomaz Zaman
a5258dd258 build: use standard OPNsense paths (/usr/src, /usr/tools, /usr/deps)
Replace custom /build/ layout with standard OPNsense /usr/ hierarchy.
Add DEPSDIR variable to GATEWAY.conf. Make git pull non-fatal for NFS
setups. Update all Makefile paths, symlinks, and README instructions.
2026-03-15 02:23:20 +01:00
Tomaz Zaman
3481c87698 build: forward SYSROOT/KSRCDIR to sub-makes, fix parallel clean race
- Pass SYSROOT and KSRCDIR from top-level Makefile to all Makefile.cross
  invocations so SRCTOP override flows through to sub-makes
- Add .ORDER directives to prevent "make -j clean all" race where clean
  deletes .ko files while modules target tries to copy them
- Remove redundant dist target (modules/userspace already copy to dist/)
- Fix package target depending on clean (raced with its own dist dep)
- Make IMAGESDIR/SETSDIR overridable with ?=
- Update mk-kernel-img.sh defaults from legacy /mnt/vision paths
- Replace MONO-GATEWAY with GATEWAY in all Makefile comments
- Remove stale patches/ from README directory tree
- Document SRCTOP override and make image shortcut in README
2026-03-14 15:07:06 +01:00
Tomaz Zaman
d5060f404d CDX: fix MC4/MC6 reset commands, build and doc improvements
Add mc4_reset()/mc6_reset() handlers in CDX multicast command processor.
CMD_MC4_RESET and CMD_MC6_RESET were unhandled — the size check rejected
them (length 0 < MC4_MIN_COMMAND_SIZE) returning ERR_WRONG_COMMAND_SIZE.
Handle reset before the size check since it carries no payload.

Also: bump libxml2 to 2.15.2, remove sudo from make image (assumes root),
add -isystem for kernel headers in CMM cross-build, add cmmctl command
reference (CMM.md).
2026-03-14 00:39:52 +01:00
Tomaz Zaman
1bc132cc48 CDX: PLCR/KG miss fixup, per-CPU dist FQs, clean kldunload
- Miss action fixup: Ethernet/PPPoE tables → PLCR policer (rate-limits
  exception traffic), all other tables → KG scheme with CC_EN (re-enters
  CC tree). Replaces previous ENQ_FRAME-to-default-FQID approach.

- Distribution FQRs now use per-CPU SW portal channels instead of pool
  channel, preventing TCP reordering on miss path.

- BMan buffer refill: cdx_dist_fq_rx_callback now calls
  dtsec_rm_pool_rx_refill_bpid() and frees buffers via
  dtsec_rm_buf_free_external() (per-port UMA zone) instead of direct
  bman_put_buffer().

- Clean kldunload: cdx_destroy_port_fqs() retires all dist FQRs,
  qman_portal_quiesce() drains in-flight portal polls.
  FM_PORT_DeletePCD() called on all dtsec RX + OH ports before hash
  table deletion, preventing FMan PCD exceptions after unload.
2026-03-05 23:49:54 +01:00
Tomaz Zaman
0ac9dbe362 Fix CAAM JR double enumeration, stale NOP interrupt, add make image target 2026-03-03 17:32:47 +01:00
Tomaz Zaman
0e2ab6a33b Network interface mapping clarification 2026-03-03 02:25:08 +01:00
Tomaz Zaman
28d6e831d2 Updated documentation for corectness and clarity, removed dead build code 2026-03-02 23:13:00 +01:00
Tomaz Zaman
7dcc939229 Split monolithic kernel patch into 6 format-patches
Replace the single OPNsense-26.1-aarch64-GATEWAY.patch with per-subsystem
format-patches in patches/. These are generated from the opnsense-src
mono-gateway branch via git format-patch and can be applied with git am.

Also fix package build: add pcf2131.ko and caam.ko to plist, clean stale
packages before creating new ones, and update README with build instructions
and the git am workflow.
2026-03-02 13:57:35 +01:00
Tomaz Zaman
f88576c880 Move pcf2131 and caam to out-of-tree kernel modules 2026-03-02 13:57:35 +01:00
Tomaz Zaman
2b3e5563d7 Proper repositories and commits 2026-02-25 15:21:07 +01:00
Tomaz Zaman
5514d65ac5 Hello world. 2026-02-25 15:13:46 +01:00