Commit Graph
4592 Commits
Author SHA1 Message Date
Joachim Wiberg e9f165ebd8 patches/libnetconf2: silence netopeer2-server warnings in log
Fixes #1446

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:16 +01:00
Joachim Wiberg abad3cedc6 confd: actually fix stratum-weight semantics and flaky test
The setting 'stratumweight 0.0' disables stratum in Chrony source
selection (pure distance-based), making client_stratum_selection
non-deterministic on a LAN.  Setting it to 1.0 gives srv1 a 1-second
effective advantage per stratum level, which no realistic distance
fluctuation can overcome.

Also correct the YANG descriptions in infix-system and infix-ntp which
had the semantics backwards — claiming 0.0 "ensures lower stratum is
always preferred" when in fact higher values do that.

Fixes #1361

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:15 +01:00
Joachim Wiberg 7b4e9b3366 confd: skip bootstrap on restart using a sentinel file
After a successful bootstrap confd writes a sentinel to /run/confd.boot
If Finit restarts confd — whether after a crash or a clean exit — the
sentinel is found and the destructive bootstrap phases are skipped:

 - gen-config fork (factory/failure configs already exist)
 - wipe_sysrepo_shm() (other daemons, e.g. statd, are live)
 - sr_install_factory_config() (datastores are already initialised)
 - sr_replace_config(NULL, NULL) (running datastore is consistent)
 - bootstrap_config() / load startup-config (not needed; sysrepo has
   the right state; plugins resync via SR_EV_ENABLED on re-subscribe)

On restart confd reconnects to sysrepo, re-initialises plugins (which
re-subscribe and receive SR_EV_ENABLED to resync with the live running
datastore), then enters the steady-state event loop.

The sentinel lives on tmpfs so a real reboot always produces a clean
slate.  Crash-loop protection is delegated to Finit's max-restarts (10).

As a side-effect this also enables a future "run-once" mode for resource
constrained systems: confd can exit after bootstrap and the sentinel
ensures any later restart just re-attaches without re-bootstrapping.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:15 +01:00
Joachim Wiberg ed1d6b7d5c confd: replace systemf() shell-outs with POSIX/libite/libsrx APIs
Replace remaining systemf() calls that invoke simple file-system
operations with direct C API equivalents, eliminating unnecessary
fork/exec overhead:

 - mkdir -p     → mkpath() from libite
 - ln -sf       → erase() + symlink() from libite/POSIX
 - rm -rf       → rmrf() from libsrx helpers
 - rm -f dir/*  → rmrf() + mkpath() to clear and recreate the dir

Files updated: dagger.c, containers.c, firewall.c, services.c, system.c

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:14 +01:00
Joachim Wiberg 0ee3159ac6 confd: replace initctl shell-outs with direct finit_ C API
Add a finit_enable/disable/reload() family in core.c that directly
manipulates Finit's service state without fork+exec overhead:

  finit_enable(svc)  -- create symlink in /etc/finit.d/enabled/
  finit_disable(svc) -- remove symlink from /etc/finit.d/enabled/
  finit_delete(svc)  -- remove both symlink and service entirely
  finit_reload(svc)  -- utimensat() on .conf to schedule reload

Printf-style variants (finit_enablef/disablef/reloadf) handle
template instance names such as container@foo and hostapd@wlan0.

All systemf("initctl ... enable/disable/touch ...") call sites across
containers, dhcp-server, firewall, hardware, ntp, routing, services,
syslog, and system are converted to the new API.

As a related cleanup in services.c, drop the remaining srx_enabled()
calls in favour of reading the already-fetched config tree directly
via lydx_is_enabled(lydx_get_xpathf(config, ...)), eliminating the
last sysrepo round-trips from that module.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:14 +01:00
Joachim Wiberg bc6313d2db confd: services: only enable/disable or touch on actual changes
Previously svc_enadis() would call 'initctl enable + touch' for every
config change event, even when the service's enabled state was unchanged.
This caused rousette to be unnecessarily restarted on every test_reset(),
racing with the active RESTCONF connection on slow hardware.

Replace svc_enadis() and svc_change() with svc_enable() which only
manages nginx symlinks and calls 'initctl enable/disable' -- never touch.
Each handler now checks the diff for the specific leaf that changed:

- If /enabled appears in diff: call svc_enable() to start or stop it
- If other config leaves changed with service already enabled: touch only

This ensures rousette, ttyd, netbrowse, avahi, sshd, and lldpd are only
restarted when their configuration actually requires it.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:13 +01:00
Joachim Wiberg 0884227afa confd: optimize, skip dagger generation when no change
Save a few CPU cycles by skipping a new dagger generation when no
interfaces have been modified/added/deleted.

Uses d->next_fp as the sentinel: NULL means no claim was made for this
transaction.  dagger_evolve() and dagger_abandon() now NULL it after
fclose, so subsequent unclaimed transactions also get the clean early
return.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:12 +01:00
Joachim Wiberg 7f2fbc8bbf statd: avahi: rename avahi subsystem to mdns
The operator sees Infix through YANG models and should not need to know
which library implements a given feature.  Rename the public-facing
parts of the avahi module to use the mdns vocabulary:

- Log strings: "avahi: ..." → "mdns: ..."
- Public API:  avahi_ctx_init/exit → mdns_ctx_init/exit
- Main type:   struct avahi_ctx → struct mdns_ctx
- statd field: statd.avahi → statd.mdns

Internal types (struct avahi_neighbor, avahi_service, …) and file names
(avahi.c, avahi.h) are kept as-is — developers debugging at the C level
benefit from knowing the underlying implementation.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:12 +01:00
Joachim Wiberg fee552196a statd: avahi: suppress transient mDNS daemon restart errors
When the mdns service is stop-started (e.g. after a config change),
statd's avahi client fires AVAHI_CLIENT_FAILURE momentarily.  With
AVAHI_CLIENT_NO_FAIL the client reconnects automatically, but the
immediate ERROR log is misleading:

  ERROR: avahi: client failure: Daemon connection failed

New behavior:
- On AVAHI_CLIENT_FAILURE: start a 2 s deferred timer (no immediate log)
- Timer fires up to 3 times (~6 s total); on the 3rd attempt, check if
  mDNS is enabled in the running config via a temporary sysrepo session
- Log ERROR only if the daemon is still down AND mDNS is enabled
- On AVAHI_CLIENT_S_RUNNING: cancel the timer, reset the counter, and
  log NOTE "mDNS daemon reconnected" if a failure had been seen

This silences the error entirely when the operator has disabled mDNS
(expected), and defers it by ~6 s for a brief restart (self-heals
before the timer fires).

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:11 +01:00
Joachim Wiberg adee27f923 Minor, consolidate naming and adjust avahi + mdns-alias conditions
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:11 +01:00
Joachim Wiberg 9472e08262 confd: clean up, simplify use common log framework
- Use same log frameworks as reset of confd
 - Use existing primitives from libite + libsrx
 - Drop remaining pthreads
 - Coding style fixes

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:10 +01:00
Joachim Wiberg d3c091e746 statd: optimize yanger invocation time and reduce command overhead
Replace logging + logging.handlers with a lightweight syslog wrapper,
and argparse with manual argv parsing.  On a sama7g54, this cuts yanger
startup from ~770ms to ~470ms by eliminating ~300ms of stdlib imports.

Also batch external command invocations:

 - ietf_routing: two sysctl calls instead of two per interface
 - ietf_hardware: one ls per hwmon device instead of six
 - bridge: fetch mctl querier data once instead of once per VLAN

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:10 +01:00
Joachim Wiberg 5583b97da9 confd: fix duplicate keystore log messages at boot
Only install the keys on CHANGE event, fixes this annoying issue:

Nov 5 01:32:10 ix confd[2011]: Installing HTTPS gencert certificate "self-signed"
Nov 5 01:32:10 ix confd[2011]: Installing SSH host key "genkey".
Nov 5 01:32:11 ix confd[2011]: Installing HTTPS gencert certificate "self-signed
Nov 5 01:32:11 ix confd[2011]: Installing SSH host key "genkey".

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:09 +01:00
Joachim Wiberg 9e7cdf492f confd: replace sysrepo threads with libev event loop
Use SR_SUBSCR_NO_THREAD for all subscriptions and integrate sysrepo
event pipes into a libev event loop.  This eliminates approximately 30
per-subscription threads, reducing overhead on embedded ARM hardware.

A temporary poll-based "event pump" thread handles callback dispatch
during bootstrap (where sr_replace_config blocks waiting for callbacks),
then exits.  After bootstrap, the single-threaded libev loop takes over
for steady-state event processing.

Note, the confd-test-mode plugin still requires use of threads so we do
not create deadlocks when calling sr_replace_config().

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:09 +01:00
Joachim Wiberg 929f53d270 board/aarch64: enable root hub transaction translator for ehci/ohci
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:08 +01:00
Joachim Wiberg 1966d104c9 board/arm: relocate rpi2 kernel config to board support package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:08 +01:00
Joachim Wiberg 3507cd5601 doc: document new 'gencert' default https cert
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:07 +01:00
Joachim Wiberg 97c26d36bf confd: migrate https cert from /cfg/ssl to ietf-keystore
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:07 +01:00
Joachim Wiberg 06361032d2 confd: add support for user configurable https certificate
- Add x509-public-key-format identity to crypto-types
 - Add certificate node to web services container
 - Use certificate from ietf-keystore as web cert

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:07 +01:00
Joachim Wiberg f61e1580cd configs: drop wifi and gps support from minimal builds
Neither the Raspberry Pi 2B or the Microchip SAMA7G54-EK board have WiFi
hardware by default so drop WiFi, and GPS, support to allow for smaller
builds with only the bare essentials in kernel and system.

Minimal builds in general don't need WiFi or GPS either, so let's disable
them from all.  This may become a central theme going forward, keeping
the minimal builds ... minimal.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:06 +01:00
Joachim Wiberg 8d87465876 board/common: fix race between confd bootstrap and test_reset RPC
netopeer2 and rousette were starting as soon as confd had a PID, while
confd was still loading the startup config via sr_replace_config().  This
held a write lock on the running datastore.  A test calling test/reset
shortly after the NETCONF port opened would have its own sr_replace_config()
block on that lock for up to 60 s, at which point sysrepo timed out the
whole RPC with "SHM event 'rpc' processing timed out".

Fix by adding the usr/bootstrap condition to both management servers so
they don't accept connections until confd signals that bootstrap is complete.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:06 +01:00
Joachim Wiberg f257ab58d4 board/common: probe for wifi radios
Relocate probe of wifi radios from gen-hardware to 00-probe.  This saves
one python invocation and some precious CPU cycles at boot.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:05 +01:00
Joachim Wiberg 07f23ec4f5 board/common: move hostname.d setup at runtime to build-time
Follow-up to 90f619b which first introduced the /etc/hostname.d concept.

This commit moves the setup of /etc/hostname.d to post-build.sh dropping
the initial call to the hostname activation script a bit, since it is
called anyway after bootstrap has finished.  The scrip is also given a
bit of a refrehs, reducing overhead and needless log messages.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:05 +01:00
Joachim Wiberg 4ca53f8ec2 confd: consolidate gen-config to start earlier
Allow confd to start even earlier at boot and call 'gen-config' as a
background task, pending on it to complete before we load the sysrepo
factory datastore.

Also, add Finit style progress to console so users can see the phases
of the bootstrap process.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:04 +01:00
Joachim Wiberg 4bc08e7323 Drop useless logger processes, these services already use syslog
Note, rousette does not support SIGHUP, so let's mark it as such.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:04 +01:00
Joachim Wiberg 9c2a90c07a statd: move start to runlevel 2 to save CPU cycles at bootstrap
Also, we don't need to start a logger process for statd, it behaves
nicely and uses syslog.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:03 +01:00
Joachim Wiberg 3deb021bce board/common: postpone start of dbus to after confd bootstrap
Infix technically does not need to start dbus and dnsmasq before confd
has loaded the system startup-config.  So we move it in time to save
some CPU cycles for confd & C:o.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:03 +01:00
Joachim Wiberg 77a7915e1f confd: replace sysrepo-plugind + bootstrap + load with single daemon
On single-core Cortex-A7, the YANG bootstrap and config loading is the
dominant boot bottleneck.  The current sequence spawns three serial
phases (bootstrap, sysrepo-plugind, load), each performing independent
sr_connect()/sr_disconnect() cycles, and every sysrepoctl/sysrepocfg
invocation is a fork+exec that rebuilds SHM from scratch.

Replace all three with a single confd binary that does one sr_connect()
and performs all datastore operations in-process:

 - Wipe stale /dev/shm/sr_* for a clean slate
 - sr_install_factory_config() from the generated JSON
 - Smart migration: compare config version via libjansson, only
   fork+exec the migrate script when versions actually differ
 - Load startup-config (or test-config) via lyd_parse_data() +
   sr_replace_config(), mirroring what sysrepocfg -I does internally
 - On failure: revert to factory-default, load failure-config, set
   login banners (Fail Secure mode)
 - On first boot: copy factory-default to running, export to file
 - dlopen plugins and enter event loop

The bootstrap shell script is split: config generation (gen-hostname,
gen-interfaces, etc.) stays in the new gen-config script, while all
sysrepo operations move into the C daemon.  The finit boot sequence
collapses from 5 stanzas to 2 (gen-config -> confd).

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:03 +01:00
Joachim Wiberg 3b85fdff87 doc: minor fixes
- Markdown syntax
 - Grammar fixes
 - Use lowdown's admonition syntax
 - Update examples

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:02 +01:00
Joachim Wiberg ea5071a264 package/finit: backport upstream fixes
Backport fixes from upstream post v4.16 release.  Mainly to fix
mdns-alias crash+restart counter issue when avahi-daemon has to
be restarted.  Finit did not properly clear the dependency that
mdns-alias had on avahi-daemon, causing it to crash and have its
restart counter incremented.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:02 +01:00
Joachim Wiberg 50be4d1a43 package/initviz: new package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:01 +01:00
Joachim Wiberg 63c3d244ae board/arm: trim kernel defconfig
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:01 +01:00
Joachim Wiberg 7050f400d5 board/arm: sama7g54-ek: enable sdmcc high speed modes
For details, see:
 - https://github.com/linux4sam/u-boot-at91/commit/23ac019
 - https://github.com/linux4sam/linux-at91/commit/5b35500

U-Boot patches imported and refreshed in local KernelKi fork of U-Boot,
see https://github.com/kernelkit/u-boot/tree/v2025.01-kkit

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:00 +01:00
Joachim Wiberg 23cbfd6f4e board/arm: disable u-boot environment, use aux partition
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:00 +01:00
Joachim Wiberg e2bb1cfbe0 board/arm: fix rauc system.conf 2026-03-20 16:17:59 +01:00
Joachim Wiberg 95abdac7ee board/arm: update board list with Microchip SAMA7G54 eval kit
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:17:59 +01:00
Joachim Wiberg 0a7bd76ede configs/sama7g54_ek_*_boot_defconfig: switch to upstream U-Boot
The v2025.01 release supports the Microchip SamA7G5* eval kit(s), which
means we can enjoy the same patch level of U-Boot as other Infix boards

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:17:59 +01:00
Joachim Wiberg f8ef10ff2f board/common: optimize busybox for speed, drop fork+exec for applets
- The biggest changes are syncing with latest BusyBox (busybox-update-config)
 - Disable optimize for size
 - Enable feature "SH_NOFORK" which allows /bin/sh to call applet_main()
   directly without having to fork+exec busybox

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:17:58 +01:00
Joachim WibergandGitHub 63f9e8a939 Merge pull request #1451 from kernelkit/frr
Bump FRR to 10.5.3

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-18 17:58:04 +01:00
Mattias Walström be85775e50 Bump FRR to 10.5.3
For change log, see:
     https://github.com/FRRouting/frr/releases/tag/frr-10.5.3
2026-03-18 16:18:44 +01:00
Mattias WalströmandGitHub 2fea1e4a2b Merge pull request #1450 from kernelkit/upgrade-buildroot
Bump buildroot to 2025.02.12 (LTS)
2026-03-18 14:18:43 +01:00
Mattias Walström fcf9782a8c Bump buildroot to 2025.02.12 (LTS)
Alot of CVE fixes, see https://github.com/buildroot/buildroot/blob/2025.02.x/CHANGES
2026-03-17 21:48:51 +01:00
Mattias WalströmandGitHub f1584f5937 Merge pull request #1449 from kernelkit/kernel-upgrade-399f2582-484c-438e-b83c-92bd62c5dd9f
Upgrade to kernel 6.18.18
2026-03-17 08:18:27 +01:00
ael-bot 3d67876136 Upgrade Linux kernel to 6.18.18 2026-03-16 15:04:32 +00:00
Joachim WibergandGitHub 0f01012c07 Merge pull request #1447 from kernelkit/refactor-actions
Move local GitHub actions to kernelkit/actions repo

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-16 15:48:54 +01:00
Joachim WibergandClaude Sonnet 4.6 63f46d4d43 .github: move local actions to kernelkit/actions repo
Fixes a regression from 0c11cea where local composite actions
(.github/actions/) were referenced with relative paths. When spins
reuse our reusable workflows, GitHub resolves relative action paths
in the context of the calling repo, not infix — breaking the build.

Replace all uses of ./.github/actions/{cache-restore,podman-cleanup}
with kernelkit/actions/{cache-restore,podman-cleanup}@v1 (new repo).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 14:38:58 +01:00
Joachim WibergandGitHub 5487344034 Merge pull request #1444 from kernelkit/another-netd-fixup 2026-03-13 07:15:27 +01:00
Joachim Wiberg 3e762e6111 confd: Use ERRNO() instead of ERROR() after POSIX API failures
Replace ERROR() with ERRNO() in all error paths following POSIX API
calls (fopen, rename, realloc, fmkpath, etc.), removing redundant
manual strerror(errno) formatting where present.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-12 22:27:52 +01:00
Joachim Wiberg af15e65087 package/netd: ensure /etc/net.d exists at boot
Before netd starts confd might want to create .conf file for it to run,
so we sort of depend on /etc/net.d existing at boot.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-12 22:08:25 +01:00
Joachim WibergandGitHub 03b4466e09 Merge pull request #1443 from kernelkit/kernel-upgrade
Upgrade Linux kernel to 6.18.17

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-12 19:19:32 +01:00