Commit graph

130 commits

Author SHA1 Message Date
f8276aa54a RELEASE.md: the forks must be publicly readable
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:06:57 -05:00
4433e98531 build.sh: never let git prompt for credentials
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>
2026-11-18 01:33:10 -05:00
2c66209351 build.sh: fetch the src fork shallow, time out stalled git transfers
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>
2026-11-18 01:01:28 -05:00
6ddb7ef179 vm.sh: setup runs build.sh setup over ssh, before rsync exists in the VM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 19:24:02 -05:00
ac8436a4d6 vm.sh: wait for the first boot's freebsd-update before giving up on ssh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 19:13:47 -05:00
0a613871af release: pilot builds only the named ports and leaves no partial packages set
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:58:29 -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
fe4aecbb05 release: build VM, full release build and device migration
- vm.sh: FreeBSD amd64 build VM on the Linux workstation (QEMU/KVM,
  no root): verified official image, root SSH key via nuageinit, sync of
  this repository, detached builds, signing with the key in a tmpfs
- build.sh: check out all repositories at the release tag, build base,
  kernel, xtools, ports, plugins, core and the board package unsigned;
  finish signs everything, builds the eMMC image and rejects foreign ELF
  files in it; pilot times selected ports to estimate a build
- migrate-device.sh: repoint a gateway from opnsense.mono.si to our
  mirror (dry run, backups, strict input checks) and offer the 26.7
  major upgrade
- tests for migrate-device.sh and 20-kernel-update

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
ccebd54083 board package: build per series, harden kernel install for U-Boot
- Makefile: read the FreeBSD release from tools' config/<series>/build.conf
  and derive the compiler target and package ABI from it, version the
  package <release>_<commit count>, take libxml2 from our own packages
  set instead of pkg.FreeBSD.org, clone the NXP sources from the Forgejo
  mirrors, and drop the image target (release/build.sh replaces it)
- +MANIFEST: ABI from the series, new maintainer and www
- GATEWAY.conf: annotate mono-gateway as coming from the OPNsense
  repository; fail the image build if the package is missing
- mk-image.sh: remove the amd64 qemu binary setup_xtools leaves behind
- 20-kernel-update: drop the 26.1.3 guard; check room on the FAT
  partition, copy and verify the new kernel before replacing the old
  one, keep kernel.old, restore it on failure, retry at next shutdown
- 01-mono-modules: log modules that fail to load instead of hiding it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
9d6aad2ef7 core patches: sign and serve from opnsense.karsttech.com
The vendor mirror opnsense.mono.si is gone and upstream publishes no
aarch64 builds, so releases are signed with our own key and served from
https://opnsense.karsttech.com.

The core patches move to patches/<series>/ and are applied with git am
onto core's release tag. The new mirror patch replaces the vendor's:
CORE_PACKAGESITE and the mirror list point at the new mirror, its key
opnsense.karsttech.com.20261117 is trusted, the vendor keys are revoked,
and the separate MonoGateway repository is dropped (mono-gateway is now
published in the OPNsense repository). The CMM restart patch is kept.

keys/ holds the public key and the fingerprints release tooling trusts:
ours (trusted/revoked) and upstream's for changelog/bogons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
Maurice Walker
95fd8558bf Add OPNsense 26.7 fingerprint to core patches 2026-07-16 02:09:10 +02:00
Maurice Walker
5e16b997aa Force-add fingerprint and Mono Gateway repo before committing core patches 2026-06-17 04:21:01 +02: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
f52da03e64 pkg: add dtb updater to kernel updater 2026-04-09 05:56:46 +02:00
Maurice Walker
e84320e823 image build: move kernel to FAT partition instead of copying it
The existence of /boot/kernel/kernel.bin triggers the kernel updater.
2026-04-09 05:32:55 +02:00
Maurice Walker
fc51b3794b pkg: add kernel updater
mono-gateway package installs an rc.syshook script which moves the U-Boot booti compatible kernel image from /boot/kernel to the FAT partition on reboot / shutdown.
2026-04-09 03:59:52 +02:00
Tomaz Zaman
8c3db242b3 cmm: add configd action for interface reassignment restart
Add actions_cmm.conf so OPNsense configd can restart CMM when
interfaces are reassigned. Include in package build and plist.
2026-04-03 17:07:24 +02:00
Tomaz Zaman
b728bd41f7 cmm: add configd action for interface reassignment restart
Add actions_cmm.conf so OPNsense configd can restart CMM when
interfaces are reassigned. Include in package build and plist.
2026-04-03 16:54:54 +02:00
Maurice Walker
a25df123fa build: remove custom kernel image script
Instead, build the kernel with the LINUX_BOOT_ABI option.
https://github.com/we-are-mono/opnsense-src/pull/1
This is a precursor for enabling online kernel updates.
2026-03-31 01:25:53 +02:00
Tomaz Zaman
632abec0ec add LICENSING.md and LICENSES/ for mixed-license clarity
Document the licensing of all components in the repository:
- BSD-2-Clause: clean-room driver reimplementations
- GPL-2.0+: NXP ASK-derived fastpath stack
- GPL-2.0: mwifiex WiFi (NXP mlan core + FreeBSD moal)
- Permissive: fmlib (BSD-3-Clause), fmc (MIT)

LICENSES/ contains full license texts referenced by per-file SPDX
identifiers.
2026-03-29 17:16:26 +02:00
Tomaz Zaman
ac81eea5d5 lp5812: replace Linux references with datasheet citations in comments
Change "from leds-lp5812.h" to "from LP5812 datasheet" and
"matches Linux driver" to "per LP5812 datasheet" in comments.
No functional changes.
2026-03-29 17:02:18 +02:00
Tomaz Zaman
c3ad5aa81a mwifiex: relicense moal files to GPL-2.0 with NXP copyright
The FreeBSD moal shim layer links directly against NXP's GPL-2.0
mlan core (~127K lines). Relicense the 4 moal files and Makefile
from BSD-2-Clause to GPL-2.0 and add NXP copyright, consistent
with the mlan source they are compiled against.
2026-03-29 17:02:10 +02:00
Tomaz Zaman
e8cb4efca3 fastpath: relicense to GPL-2.0+ with proper NXP copyright attribution
The fastpath stack (CDX, CMM, cmmctl, auto_bridge, FCI, dpa_app)
derives from NXP's ASK SDK which is GPL-2.0+ licensed. Several
components compile NXP vendor source directly, and others include
verbatim GPL headers (list.h, jhash.h, fpp.h).

Change all BSD-2-Clause files in the fastpath stack to GPL-2.0+ and
add original copyright holders (Mindspeed Technologies, Freescale
Semiconductor, NXP) alongside Mono's copyright. Also fix "Ported
from" comment in include/desc.h to "Inspired by".

Components unaffected: pf_notify (100% original BSD), fmlib
(BSD-3-Clause NXP), fmc (MIT NXP).
2026-03-29 17:02:02 +02:00
Tomaz Zaman
8f9b3bf487 caam: rename descriptor constants and remove GPL source references
Add CAAM_ prefix to all 253 descriptor command constants (CMD_* ->
CAAM_CMD_*, HDR_* -> CAAM_HDR_*, KEY_* -> CAAM_KEY_*, OP_ALG_* ->
CAAM_OP_ALG_*, LDST_*, FIFOLD_*, FIFOST_*, JUMP_*, MATH_*, MOVE_*)
to differentiate from Linux drivers/crypto/caam/desc.h naming.

Replace all 30+ Linux references in comments with NXP SEC reference
manual citations. Change "ported from" and "matches exactly" language
to hardware-specification references.

No functional changes — purely mechanical renames and comment rewording
for licensing clarity. Build verified clean with -Werror.
2026-03-29 01:12:41 +01:00
Tomaz Zaman
84e318cb09 ina2xx: rename constants and structs to differentiate from GPL source
Rename register macros (INA2XX_* -> INA_REG_*), config struct
(ina2xx_config -> ina_chip_params with new field names), and LSB
calculation variable to remove 1:1 naming correspondence with the
Linux hwmon/ina2xx.c GPL driver. Change "Based on" to "Inspired by"
and remove explicit Linux function reference from comments.

No functional changes — purely mechanical renames for licensing clarity.
2026-03-29 01:12:31 +01:00
Tomaz Zaman
a6471b16f6 build: use minimal 4-entry GPT to reserve firmware region on eMMC
Replace gpart (which enforces 128 GPT entries = 17KB) with a Python
script that creates a 4-entry GPT table fitting in 1.5KB.  This keeps
the entire partition table below 4KB, leaving the 4KB-32MB region free
for LS1046A boot firmware (BL2, FIP, U-Boot env, FMan microcode, DTB).

The boot partition starts at sector 65536 (32MB), matching the existing
GATEWAY.conf ARM_FAT_SIZE setting.  FreeBSD's kernel reads 4-entry GPTs
without issue — the 128-entry minimum only applies to gpart create.
2026-03-27 23:06:02 +01:00
Maurice Walker
f6152d5c6e remove custom growfs script
Not applicable or required for ZFS. OPNsense core has its own growfs feature.
https://github.com/opnsense/core/blob/stable/26.1/src/etc/rc
2026-03-26 23:42:11 +01:00
Maurice Walker
ebf58ecc4d config: add repository annotation to mono-gateway package
Since the package is added manually during image creation, FreeBSD needs to be made aware that it belongs to the MonoGateway repo.
2026-03-26 22:14:45 +01:00
Tomaz Zaman
16e02dd356 pcf2131: call inittodr() after late clock registration
The driver attaches via config_intrhook, which runs after the kernel's
inittodr() has already failed with ENXIO. Re-invoke inittodr() after
clock_register_flags() so the system time is set from the RTC.
2026-03-26 18:15:12 +01:00
Tomaz Zaman
0d00190958 build: create ZFS image directly, eliminate UFS intermediate step
Replace the two-step flow (make arm-5G → UFS image → mk-zfs-image.sh
converts to ZFS) with mk-image.sh that sources opnsense-build's common.sh
and creates a GPT + ZFS image directly. The script is temporarily swapped
in as arm.sh so the opnsense-build Makefile passes all the correct arguments
without requiring any upstream modifications.

Remove mk-zfs-image.sh (superseded) and the -zfs filename suffix since ZFS
is now the only image format.
2026-03-26 16:02:39 +01:00
Tomaz Zaman
10b0dc8f10 cdx/cmm: fix IPR timer shutdown race, fix CMM native Makefile
cdx_reassm_freebsd.c: Add wakeup() before kthread_exit() in the IPR
timer thread so cdx_deinit_ip_reassembly() doesn't rely on a 2-second
tsleep timeout to detect thread exit.

cmm/Makefile: Add 4 missing source files (cmm_deny.c, cmm_socket.c,
cmm_bridge.c, cmm_l2tp.c) and include paths for auto_bridge and
pf_notify headers, matching Makefile.cross.

cmm/PORTING.md: Remove stale warning about auto_bridge.ko missing
d_kqfilter — already implemented (abm_dev_kqfilter).
2026-03-24 17:06:39 +01:00
Tomaz Zaman
1c9b97f3b5 pf_notify/cmm: remove polling fallback, fix one-shot ordering bug
Fix a bug in pf_notify where pfn_mark_notified() was called before
pfn_queue_event(). If the ring buffer was full, the READY event was
dropped but the state was already marked as notified — it would never
re-fire, leaving the connection permanently in the software path.

Move pfn_mark_notified() inside the lock, after successful ring_put().
On drop, the state is NOT marked, so the next packet re-triggers READY.

Enlarge the ring buffer from 4K to 128K entries and the notified hash
from 16K to 128K entries, both dynamically allocated (~17 MB total).
Add ring_hwm and ring_used diagnostic sysctls.

With the one-shot ordering fix and larger ring, the polling fallback
in CMM is no longer necessary. Remove cmm_conn_poll() and all
associated code (DIOCGETSTATESV2, epoch-based GC, -p flag, /dev/pf).
CMM now requires pf_notify.ko and uses push events exclusively.

Add cmm_conn_maintenance() as a 30-second timer that retries offload
for pending connections (e.g., after route changes) and runs route GC.

Delete cmm_offload.c/h (poll-path eligibility, now dead code) and
cmm_deny_check() (poll-path deny wrapper).

Add a kevent registration safety check that skips invalid fds to
prevent a single bad fd from killing the entire kqueue setup.
2026-03-24 16:34:41 +01:00
Tomaz Zaman
6837618376 Merge native_build: add libxml2 include paths for native aarch64 builds 2026-03-23 19:32:04 +01:00
Tomaz Zaman
911110e390 cdx/cmm: reject route offload for non-DPAA interfaces
When OPNsense interfaces are reassigned to non-DPAA devices (bridge,
VLAN, etc.), CDX would accept route registrations with unknown input
interface names, creating routes with NULL input_itf. Every subsequent
conntrack insertion then hit the NULL check in insert_entry_in_classif_table()
producing massive DPA_ERR spam.

Fix at two layers:

CDX: Return ERR_UNKNOWN_INTERFACE when input/underlying_input device
names are non-empty but not registered, matching the existing output
device validation. Downgrade ehash NULL checks from DPA_ERROR to
DPA_INFO as a defensive fallback.

CMM: Cache route rejection (fpp_rejected flag) to avoid retrying
known-bad routes on every poll cycle. Flag is cleared on full offload
reset (interface reassignment), allowing fresh attempts with new
interface names.
2026-03-23 14:12:43 +01:00
Maurice Walker
ba004209ab build: add libxml2 include paths for native aarch64 build systems
When installing libxml2 (pkg install), files are placed in /usr/local, not /usr/obj/usr/src/arm64.aarch64/tmp/usr/local.
2026-03-20 03:14:00 +01:00
Maurice Walker
3ad64901e4
readme: use upstream opnsense/tools 2026-03-19 03:57:27 +01:00
Tomaz Zaman
d7b89fbce7 build: use upstream opnsense/tools instead of opnsense-vm-images fork 2026-03-16 00:02:36 +01:00
Tomaz Zaman
36526892ec sfpled: use ifnet link state instead of SFP GPIOs
The dtsec driver now owns the SFP GPIO pins (mod-def0, LOS,
TX-disable).  FreeBSD gpiobus only allows one consumer per pin,
so sfpled can no longer acquire them.  Remove all SFP GPIO and
I2C EEPROM access from sfpled — derive module presence and link
state purely from the dtsec ifnet link state:

  LINK_STATE_UNKNOWN → no module → LEDs off
  LINK_STATE_DOWN    → module present, no link → orange solid
  LINK_STATE_UP      → link up → green on, orange blinks on traffic
2026-03-15 14:27:17 +01:00
Tomaz Zaman
38f2d7741c build: fix SRCDIR collision in sub-Makefiles
Same issue as a906b7a (fand): the top-level Makefile exports
SRCDIR=/usr/src which leaks into sub-Makefiles that use SRCDIR
for their own local source directory. Remove the ?= conditional
so the local value is always used.
2026-03-15 02:23:20 +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
Maurice Walker
95f9c28614
Makefile: allow SRCDIR and BUILDTOOL override 2026-03-15 02:21:40 +01:00
Maurice Walker
7243900204
fastpath/fmlib: fix SRCDIR
This is not the same SRCDIR as in the top-level Makefile. The SRCDIR of the top-level Makefile must not flow through to here.
2026-03-15 02:19:25 +01:00
Maurice Walker
a906b7adc0
drivers/fand: fix SRCDIR
This is not the same SRCDIR as in the top-level Makefile. The SRCDIR of the top-level Makefile must not flow through to here.
2026-03-15 02:17:14 +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
28bcb1801d Remove legacy kernel patches
These patches were from before we maintained our own opnsense-src fork.
All changes are now committed directly to the fork and rebased on upstream.
2026-03-14 14:25:11 +01:00
Tomaz Zaman
88a442d941 fmlib: remove ioctl headers, use kernel tree copy
Delete the 5 ioctl ABI headers that now live in opnsense-src at
sys/contrib/ncsw/inc/ioctls/.  Update fmlib, fmc, and dpa_app
Makefiles to include them from the kernel source tree via KSRCDIR.
2026-03-14 14:14:45 +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
824daa1634 CMM: add multicast group offload module
Port NXP ASK multicast control plane to FreeBSD. CMM maintains a
shadow table of multicast groups and forwards add/remove/update
commands to CDX via FCI for hardware multicast replication.

CDX kernel-side support (cdx_mc_freebsd.c) was already ported;
this adds the userspace CMM module and cmmctl mc4/mc6 commands.
2026-03-13 21:22:59 +01:00
Tomaz Zaman
ed28c8320d CMM: align neighbor hash with NXP ASK design (256→2×2048 split buckets)
Match NXP's original neighbor_resolution.h layout: 2048 buckets for
IPv4, 2048 for IPv6, with IPv6 offset into the second half.
2026-03-13 21:07:55 +01:00
Tomaz Zaman
d1516d1953 CMM: align route hash with NXP ASK design (256→2×2048 split buckets)
Match NXP's original route_cache.h layout: 2048 buckets for IPv4,
2048 for IPv6, with IPv6 offset into the second half. Reduces
average chain length under load and eliminates cross-family
collisions that degraded lookup performance at scale.
2026-03-13 21:02:11 +01:00