Compare commits

..
476 Commits
Author SHA1 Message Date
Joachim Wiberg 8a09b3e22c confd: fix audit logs using proper facility
The LOG_SECURITY facility was set wrong (1 << 13) instead of (13 << 3), see
https://github.com/kernelkit/sysklogd/blob/0fc6656/src/syslog.h#L120 for
details.  This caused all audit log messages to be logged in LOG_USER.

Also, rename LOG_SECURITY -> LOG_AUDIT and log macro SECURITY() -> AUDIT()
to match RFC5424 terminology.

Similar fix to sysrepo, LOG_AUDIT facility instead of daemon + WARNING.
Additionally, drop the leading [severity] prefix to sysrepo logs.  Only
needed when logging to stdout.

Follow-up to issue #521

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-30 15:29:11 +02:00
Joachim Wiberg 7d95da7657 confd,statd: fix invalid option to openlog()
LOG_DAEMON is a facility not an option.  Replace with NDELAY option and
set facility properly in call to openlog() instead.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-30 15:29:11 +02:00
Joachim Wiberg cf1c4c32f1 board/common: disable unused pam_lastlog.so from PAM login
Fixes the following recurring login warning in syslog.  (We cannot use
pam_lastlog.so since it does not rotate its /var/log/lastlog file.)

login[2819]: PAM unable to dlopen(/lib/security/pam_lastlog.so): /lib/security/pam_lastlog.so: cannot open shared object file: No such file or directory

Follow-up to issue #542

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-30 15:29:11 +02:00
Joachim Wiberg e0483be38c Update ChangeLog for v24.08.0 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-30 15:29:11 +02:00
Joachim Wiberg 773ee7f479 confd: drop local aliases for "audit" and "cron2"
The backported patches to sysklogd now support the RFC facilities
natively, so we can focus on local facilities (and 'all').

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-30 15:29:11 +02:00
Joachim Wiberg 306baf3f41 doc: fix minor review comments on new Syslog chapter
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-30 15:29:11 +02:00
Ahmed KaricandMattias Walström 8227f1bcde test: enable running infix tests from external projects
Minor adjustments have been made to enable calling infix tests from an
external project (i.e. 'make test' target).
This essentially allows running any external test (or a group of tests)
using the infix-9pm tool.
2024-08-30 12:26:39 +02:00
Mattias Walström b76904c0e6 Add retry if HTTP error 502 (bad gateway)
This is most likely caused by nginx is up but rousette
is not fully started yet.
2024-08-29 16:29:44 +02:00
Joachim WibergandMattias Walström 04d7729de8 .github: attempt build folder cleanup
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-29 16:29:44 +02:00
Mattias Walström 764a64bee8 yang: Improve must expressions for multicast-filters
Add a must expression to limit invalid configurations.
Not belonging to VLAN when added to a multicast-filter in
that VLAN. Make sure multicast snooping is enabled when
using multicast filters.

This fixes #587

Signed-off-by: Mattias Walström <lazzer@gmail.com>
2024-08-29 16:29:44 +02:00
Mattias Walström 2119fd239a test:syslog: Prefix with infix-syslog model
Unsure why this test ever passed.
2024-08-29 16:29:44 +02:00
Joachim Wiberg c7e013656c Note, RESTCONF not yet ready for prime time
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-29 11:08:48 +02:00
Joachim Wiberg 48e7fe3562 doc: minor, fix 9pm option argument formatting
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-29 11:08:48 +02:00
Joachim Wiberg 6c7758b04d confd: disable ttyd and netbrowse in failure-config
Open interfaces are console, SSH, NETCONF, and RESTCONF only.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-29 11:08:48 +02:00
Joachim Wiberg 44419607e1 confd: fix obvious copy-paste bug in infix-services for RESTCONF
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-29 11:08:48 +02:00
Joachim Wiberg 926aa61ea6 buildroot: bump to 2024.02.5
Release announcement available from the Buildroot list:

https://lore.kernel.org/buildroot/87v803gwip.fsf@dell.be.48ers.dk/T/#u

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-29 11:08:48 +02:00
Joachim Wiberg ccd2b155b2 .github: check 'make legal-info' for all builds
A fairly quick step that runs for all build targets, likely saving us a
lot of time for release weeks.

Fixes #574

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg 430414ab13 confd: ensure users in admin group can access all datastores
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg d05a64913e configs: drop pam_lastlog.so, does not rotate its log
The PAM plugin lastlog, previously used (optional) by Netopeer2 and
Rousette, does not rotate /var/log/lastlog, and since we don't have
cron and logrotate this can potentially fill up /var.

This patch disables pam_lastlog.so from the build and drops the two
matching session lines for both Netopeer2 and Rousette.  Both still
log user access to sysrepo, so no critical functionality is lost.

Follow-up to issue #542

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg 74ac87c558 doc: update ChangeLog for upcoming v24.08 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg 69e9cde1e9 doc: update project URL in motd and docs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg 924346c5c5 doc: RESTCONF is now enabled in all defconfigs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg 88d81f36c5 confd: fix missing yang:operation when deleting syslog actions
The srx_get_changes() API, introduced in 18b5922, does not provide the
user with a delete yang:operation when the entire YANG tree is deleted.

Refactor syslog actions to use the srx_get_diff() API instead.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg 1342794671 confd: handle case of missing selectors for syslog actions
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg 4c81ac978e confd: adjust Frr logging for staticd and ospfd
Ensure Frr logs to the local2 syslog facility to allow sorting all
Frr (staticd, ospfd) logs into a dedicated /var/log/routing log file.

We activate OSPF debugging, but keep log level at 'informational' for
the time being.  The YANG model needs some sort of "knob" to toggle
debug messages when troubleshooting OSPF.

Fixes #541

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg 8cafd6f568 board/common: disable all debug log messages from /var/log/syslog
Infix has the catch-all /var/log/debug, and now also /var/log/routing
for debug messages from Frr.

The log file /var/log/syslog now catches *all* messages except auth*,
which may contain secrets, except debug messages.  Contrast this with
/var/log/messages which only logs info/notice/warn -- i.e., no error
and above log messages.

Due to the way syslogd parses /etc/syslog.conf et al, we override the
default in Infix to disable the default /var/log/syslog, otherwise we
would get duplicates to the same log file.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg 610e83cbbf patches/syslogd: backport fixes to listen .conf directive
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg dfcd8a7a56 patches/sysrepo: exit sysrepo-plugind on thread processing error
When sysrepo-plugind is processing callback events, make sure to log the
error and exit(1) the entire process so the system can handle the problem.
For example, restart all dependent services.

Fixes #585

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg 740601dde1 test: cosmetic update + shellcheck
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg ee6d96d3ed test: adjust location for Infamy .venv directory to ~/.infix/venv
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg 8266984c63 test: save infamy ash history across runs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-28 19:14:47 +02:00
Joachim Wiberg 76a7f7b181 Update ChangeLog with syslog, audit trail, and fixes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg fb00719069 package/klish: bump for droprivs refactor of script plugin
As of KernelKit Klish @ 710a631 the script plugin has been refactored to
run all commands as the logged in user instead of as root.  The default
admin user is member of the wheel group, which allows access to sysrepo
and sudo access to containers thanks to NOPASSWD rights.

The doas script is a dummy wrapper to silence 'sudo -n' output for users
without any privileges.

As of this commit, unprivileged users can no longer copy, show, or in
any other way manipulate the system configuraiton.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 3670d80034 package/klish: bump to ensure foreground daemon logs to syslog
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg ab8783dad4 package/klish-plugin-sysrepo: relocate sysrepo functionality here
This is a refactor to ensure sysrepo functionality guarded by NACM works
as intended in Infix.

Relocate infix_rpc() to klish-plugin-sysrepo, ensuring unauthenticated
users are denied access.

Drop infix_commit() in favor of slightly modified srp_commit(), this to
ensure sysrepo audit trail logs are visible at all times.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg e912ca5d3b board/common: fix missing mkpasswd argument in askpass tool
Fixes #570

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 51efa5e274 cli: enable sysrepo logging to syslog for copy command
Ensure audit trail events are logged for 'copy' to datastores.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 341188c70c cli: fix copy running-config start<TAB>
Allow completing with startup-config for both src and dst datastores in
copy command.

Fixes #576

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg dac2182069 confd: initial audit trail support
This commit introduces a new SECURITY() log macro that logs to facility
'audit' (sometimes called 'security') with severity set to 'alert'.  It
is then used to instrument the single most important things to log; all
changes to users and their privileges.

We also add logging to sysrepo, which knows the username for changes to
running-config, copies to startup-config, and RPCs.

Fixes #521

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 0ffca5aa21 test: verify remote logging with rfc5424 log format
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 977cc620de doc: new Syslog Support document
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 8d2bdd1f1d confd: rename syslog format -> log-format, add must expression
- For consistency and clarity, rename format -> log-format
 - Add must expression to ban 'bsd' format from file logging

Note: technically, sysklogd silently reverts back to rfc3164 for file
      logging, but it's better to be clear with the user with what is
      possible to configure and is going to be used.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 1f892c28dc confd: add support for local syslog facilities
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg fe389d07fd confd: document ietf-syslog augments and deviations properly
As a bare minimum, all augments and deviations made to standard models
should have a description denoting *why* they exist.

In the case of ietf-syslog the base model is still a draft and carries
some odd defaults we want to disable, or replace with better ones.  The
augments are global log rotation and and log format.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 90f818437a confd: refactor ietf-syslog callbacks for log-file and remote
This refactor changes the callback subscription for log-file and remote
log actions to ensure they are called for *all* changes.  Even changes
to deeply nested sub-trees like file-rotation when no other changes are
made.  The previous attempt failed to address that.

The refactored callbacks replace sr_get_changes() with srx_get_changes()
for better control over what they iterate over.  The callbacks always
regenerate the syslogd *.conf file snippets for each log action, so
there is no need for the overly granular sr_get_changes(), ever.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 96ee348eab confd: add support for log format selection
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg df2998777b confd: simplify /etc/syslog.d/*.conf file naming
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 203896dc49 confd: add support for syslog server configuration
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg cfd4108bb7 libsrx: srx_get_diff() is now just a wrapper for srx_get_changes()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 18b59229f3 libsrx: new api, srx_get_changes()
Reduces the overhead/repetition for module callbacks by combining the
forces of srx_get_diff() and lydx_get_descendant() into one API.  The
resulting function supports both XPath and simplified paths to get the
subtree of changes applicable to the callback.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 961306d1a3 libsrx: new function, srx_get_items()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 1091b0ad82 confd: add support for acting as a remote syslog server
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 45cc5f4897 confd: add support for syslog log-file rotation
This augments ietf-syslog.yang with global file rotation settings which
are used when per-file rotation is not configured.  The defaults chosen
match previously decided defaults for Infix: 1M:10, i.e., rotate every
file at 1 MiB and keep up to 10 gzipped aged-out archives.

The standard model includes a default value of 1 for the number of files
kept, which is removed (deviated).  There is also a unit specified for
max-file-size, 'megabytes', replaced with 'kilobytes' in this change.
On smaller embedded systems, smaller sizes may be required.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 9ada734b00 confd: refactor ietf-syslog
Also, add [] guards to remote IPv6 address.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg d44678ef37 confd: add support for logging to remote syslog servers
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg cc0321f38f test: new test ietf_syslog/basic.py
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg bf83003d23 confd: initial support for ietf-syslog.yang
Add YANG models and an initial plugin for file logging.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg f0506c6cd5 package/skeleton-init-finit: drop log rotation from command line
With the latest sysklogd backports syslogd now supports log rotation
settings in the .conf files, which we'll add yang support for later in
this patch series.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 9adcc9fe99 patches/sysklogd: backport sysklogd log rotation support
This is a backport of sysklogd v2.6.0 support for log rotation settings
in the .conf file.  Previously only supported on the command line.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg f92a6830bb package/klish-plugin-sysrepo: fix missing prefix to identities
When a the type of a leaf node (of a list) is buried inside a union we
need to fish out the module prefix if one of the types in the union is
an identityref.  It's all very simple really.

Also, when tab completing for possible identities, always make sure to
strip any leading module prefix.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 3269175118 package/klish: fix annoying freeze if pressing any key before prompt
Backport upstream fix, https://src.libcode.org/pkun/klish/commit/a1ecbdc

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 5272f56827 board/common: add 'log' and 'follow' alias for displaying syslog
These changes mirror the changes made to the CLI in an attempt to create
a better user experience for working with log files even from the shell.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Joachim Wiberg 6d03e7ef3c src/klish-plugin-infix: fixes to 'dir' and 'show log' commands
These changes are designed to make the experience working with log files
easier.  Both listing available log files and viewing them.

 - replace C dir@infix with a shell script for easier extensions,
   e.g., we want to show both available .cfg and log files
 - add support for gunzipping .gz log files before viewing them

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Ahmed KaricandMattias Walström a44f83c127 confd: add missing 10-infix-services.json to failure and test config + fix allignment 2024-08-26 13:59:49 +02:00
Ahmed KaricandMattias Walström abf54db490 doc: document introducing test-mode to infix tests 2024-08-26 13:59:49 +02:00
Ahmed KaricandMattias Walström 241f3f224f board/common: introduce image test-mode
To support testing, the test-config.cfg file has been introduced in Infix.
Additionally, a "test mode" for the running image is required for this
configuration to be applied.

Basically the test-config will only be loaded when the device is in test mode,
which is determined by the presence of the /mnt/aux/test-mode file.
However, placing this file via the Qeneth system proved to be
inconvenient in the test environment. Therefore, it the entire image is
built in test mode, with the 'test-mode' file preloaded onto the disk
image (specifically in the auxiliary partition).
To support this, a new variable, (bool) DISK_IMAGE_TEST_MODE, has been
introduced:

 enabled: the image will be built in the test mode;
 disabled: the image will be built in the standard mode.

Part of issue #568
2024-08-26 13:59:49 +02:00
Ahmed KaricandMattias Walström 21274aa379 confd: fix output directory for gen-version in gen_failure_cfg
Fixes #562
2024-08-23 11:15:12 +02:00
Ahmed KaricandMattias Walström efafa944d6 confd: minor cleanup
- removed unused parameters in functions factory() and failure()
- renamed the functions
2024-08-23 11:15:12 +02:00
Ahmed KaricandMattias Walström 837fb0ee7f confd: load test-config when in test-mode 2024-08-23 11:15:12 +02:00
Ahmed KaricandMattias Walström 4a325af4e4 confd: generate test-config.cfg
Currently, it's not possible to run infix tests from an external
project (based on infix) due to an incompatibility between the
configuration used in the tests (the default configuration
within the image generated by the external project) and the infix
base configuration expected by the test cases. Therefore, a simple
configuration specifically for testing purposes needs to be generated
within an image. This test-config should always be generated
but only loaded when the device is in test mode.

Part of issue #568
2024-08-23 11:15:12 +02:00
Joachim Wiberg 3fb49cf9dd Adjust periodic Coverity Scan to weekly, Saturdays
Fixes #573

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-22 21:55:23 +02:00
Mattias WalströmandJoachim Wiberg 1c2a491b50 yanger: Use correct file for system-output 2024-08-22 21:52:36 +02:00
Joachim Wiberg 588d8189bf test: run all CI tests with a random container name
Fixes #568

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-22 21:52:36 +02:00
Joachim Wiberg dbcc04c3f8 test: improve robustness of container actions
If a container has not yet stopped/started we may for proto RESTCONF get
"invalid URI" result back for some container actions.  With this change
we allow the action to be retried up to three times before passing on
the error.

In tests on Qemu (x86_64) this happens very rarely and need at most one
retry before succeeding.  Verified by iterating the same basic test over
night (9000+ iterations).

Fixes #558

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-22 21:52:36 +02:00
Joachim Wiberg bd498fcfa5 statd: add logger fallback for unit tests
When unit tests run in CI we may not have a syslog daemon available, in
such cases we set up a dummy handler.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-22 21:52:36 +02:00
Joachim Wiberg 8c5defa9f4 statd: return empty data from run commands, drop getitem()
These changes are intended to make yanger a bit more robust.  Instead of
bailing out on command errors, we now return empty string or object back
to the callee in run_cmd() and run_json_cmd().

One example where yanger previously exited hard, and dragged with it the
entire session, is when inspecting container status or when attempting
to restart container instances which have yet to be created/stopped.

Fixes #558

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-22 21:52:36 +02:00
Joachim Wiberg 2f5becf8b2 doc: update section on transport protocol
Simplify and add paragraph on how to select proto from test-sh.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-22 21:52:36 +02:00
Tobias Waldekranz 6a7900c6d1 board/aarch64: styx: Source product data from VPD
In order for the probe logic to source product data from a VPD, it
must be marked as such. Otherwise we end up in a scenario where the
data is collected, but not hoisted up to the system level, leaving the
system without a defined base-MAC for instance.
2024-08-19 14:07:39 +02:00
Mattias WalströmandTobias Waldekranz 60e8b24d01 infamy: Refactor xpath handling between restconf and netconf implmentation
Previous xpath may or may not been an xpath, we still called it xpath.
Remove the obscure function get_xpath() and instead transform to a
URI in restconf.py

This fix issue #490

Signed-off-by: Mattias Walström <lazzer@gmail.com>
2024-08-16 16:50:13 +02:00
Joachim WibergandTobias Waldekranz e8e9f7c0a1 board/aarch64/r2s: control WAN LED with a simple DHCP client monitor
When the interface is up and has a 'proto dhcp' address the WAN LED is
lit up.  When the interface goes down, or loses its DHCP lease, the LED
is turned off.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz af5169e286 board/aarch64/r2s: add u-boot factory-reset button detect
Allow reset button on the R2S to be used for factory reset at power-on.
See board README for details.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz 9a12f8f0f5 doc: update ChangeLog with NanoPi R2S changes and related fixes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz a1ac456d08 configs: enable pam_lastlog.so
Backport pam-lastlog build fix from latest Buildroot master and enable
in all defconfigs to fix syslog warning:

   login[2819]: PAM unable to dlopen(/lib/security/pam_lastlog.so)

Fixes #542

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz 8353963b40 board/common: factory reset using shred and LED indication
This patch greatly improves the security of the Infix factory reset by
replacing 'rm' with 'shred'.  The shred tool overwrites the contents of
files three times.  With the -z and -u options the last pass writes
zeroes and then uninks the files.

On the NanoPi R2S the factory-reset now takes 24 seconds:

   Aug 11 16:00:34 infix mnt[121]: Resetting to factory defaults.
   Aug 11 16:00:58 infix mnt[173]: Factory reset complete.

A visual aid is also added, setting *all* LEDs to on, that can be found
mounted on the device, before starting the file shredders.  The LEDs are
reset back to off and SYS red blinking as soon as the wipe has completed
and iitod has been started.

Fixes #158

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz 9a67a95067 board/common: shellcheck, quote variables to prevent word splitting
Fixes to SC2086 mostly.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz 890d812b69 board/common: allow device specific compat strings for .pkg files
This patch allows us to define the rauc manifest compatibility string with
menuconfig.  The INFIX_IMAGE_ID is a direct replacement for the previously
composed "infix-$ARCH" in mkrauc.sh.

For example, the compatibility string "infix-aarch64" is replaced for the
NanoPi R2S with "infix-r2s" to ensure users get a proper warning if they
try upgrading to an image that maybe boots, but is not likely to work.

The CLI upgrade command gets a 'force' flag to override the compat string.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz df89b22062 board/aarch64/r2s: add support for reset button
This patch further cleans up the r2s kernel config and also enables the
input event framework for the gpio0 reset button on the device.

The very simple input-event-daemon is introduced, with the only purpose
of listening to /dev/input/event1 for KEY_RESTART and trigger reboot.

Some helpful tooling is also added to help debug events (evtest).

Issue #276

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz 4d90565838 board/aarch64/r2s: add static factory-config.cfg
This serves as an example of how a board specific builds in Infix can
carry a static factory-config.  This will be extended upon as we add
support for DHCP server, WiFi access point, and firewall support.

For now the following features are added:

 - Default hostname: r2s instead of infix-00-00-00
 - LAN port always at 192.168.2.1/24, IPv6 SLAAC enabled
 - WAN port has DHCP enabled for IPv4, IPv6 SLAAC disabled
 - NTP client enabled, default server pool.ntp.org
 - DHCP client is set up to request and allow ntp server

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz b0c5d74860 patches/linux: port relevant kkit-6.6.y patches to kkit-6.10.y
Only the most important bridge and usb fixes have been ported in this
commit, and a new patch for the r8153 link/traffic LEDs, ported from
the FriendlyELEC/Rockchip kernel tree.

Fixes #274

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz 01a4eedcad board/aarch64/r2s: map board LEDs to Infix system LEDs
The R2S has a minimal set of system LEDs, all of which are single color.
This commit tries to distill and map the essence of the Infix functions
to available LEDs.

The SYS LED is turned on (fainy red) at power-on, when U-Boot has loaded
the kernel it turns the SYS LED bright red on.  The idea is then to turn
the red SYS LED off as soon as the system has successfully loaded system
startup-config, and then turn the green LAN LED on.  Indicating that the
both the device is operational and that the user can connect to the LAN
port.

The WAN LED is given a "wan-up" input condition, with the intention of
turning it on (green) when the device has acquired a DHCP address.

The failure modes, which in many ways is the essence of Infix signaling,
are fail-safe and panic, triggered by loading failure-config, or failing
to loadd failure-config, respectively.  In fail-safe mode the SYS LED is
blinking red at 5 Hz and in panic mode *all* LEDs blink at 5 Hz.

Issue #276

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz e85f1a41a1 configs/r2s_defconfig: enable wireless tools and regdb
For prototyping experimental wireless support for Infix.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz 760e7d0683 board/aarch64/r2s: rename interfaces to match case and LEDs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz fb41249a11 board: quick fix for too small primary/secondary on sd cards
With new features & fixes, Infix grows.  With the latest support for
rauc upgrades introduced with the VisionFive2, and now also for R2S,
we need to reserve room for future upgrades even when running from
an SD card.

This is a quick fix for genimge generated SD card imaages before we
get a proper installer in place that can be used both on the target
and host systems to partition and provision an eMMC, NVME, SSD, or
an SD card.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz 9b6dedbe08 board/aarch64/r2s: add README for the NanoPi R2S board
Fixes #275

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz 094a1ac4f1 board/aarch64/r2s: enable force check of package hashes
- Enable BR2_DOWNLOAD_FORCE_CHECK_HASHES for R2S
 - Relocate VisionFive2 patches to global patch dir for sharing with R2S
 - Add hash for ATF v2.9

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz 97eab18349 board/aarch64/r2s: allow saving U-Boot environment
This change allows modifying and saving the U-Boot environment to the
aux partition on the NanoPi R2S.  Required to able to safely maintain
multiple R2S devices on the same LAN.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz e7394a89d3 board/common: disable metadata checksumming for aux partition
U-Boot (2024.07) does not yet support the 'metadata_csum' feature flag
to Ext4 file systems.  So let's disable it for now in mkaux.sh so we
can allow builds for, e.g., the R2S and VisionFive2 boards to modify
and save their U-Boot environment.

Needed on the NanoPi R2S to set ethaddr + eth1addr since it does not
have any VPD EEPROM mounted.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz d2457baf2b board/aarch64/r2s: generalized secure boot support
- Bump kernel to 6.10.3
   - Initial defconfig sync with aarch64
     - Enable kprobes, ksyms, and function tracer
     - Enable missing file systems for parity with Infix
     - Enable bridging, netfilter, and other Infix requirements
     - Initial virtion support for running in Qemu (untested)
     - Enable device mapper, required for rauc bundle install
   - Make dummy and tunnel drivers modules to be able to drop dummy0
     and tunl0 interfaces that otherwise mess up "show interfaces"
   - Disable suspend and hibernation, not supported in Infix
   - Disable unused GPIO, PHY, MDIO, and USB drivers
   - Disable RK3328 watchdog driver, cannot perform reset on R2S,
     enablle softdog instead as a seamless replacement for Infix.
     Even though not optimal (since it's software) reboot works
   - Disable ethtool netlink support, does not work and breaks
     interface configuration completely on R2S!
   - Enable netdev LED triggers, for LAN and WAN LEDs
 - Bump u-boot to 2024.07
   - Hard code developer mode to allow shell access
   - Disable factory reset button support (not yet supported)
 - Bump ATF to v2.9
 - Enable squashfs for rootfs image
 - Enable signing of images
 - Add secondary partition
 - Add dedicated var partition
 - Add aux partition for signatures and uboot env

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Joachim WibergandTobias Waldekranz df028d1fc0 configs: drop openssl engines from riscv
This was a temporary fix to a Buildroot regression, reverted
in Infix commit c7c21b3

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-16 16:47:28 +02:00
Mattias Walström c9ef775012 cli: always sort lo first in 'show interfaces'
This fixes #545

Signed-off-by: Mattias Walström <lazzer@gmail.com>
2024-08-16 16:32:22 +02:00
Mattias Walström 8d6bf14937 Upgrade kernel to 6.6.46 2024-08-16 16:32:22 +02:00
Tobias Waldekranz 3da46f7249 uboot: Support overriding the interface used for netbooting Infix
For systems with multiple paths to the network, different situations
may call for different paths to be used. Therefore, allow the user to
override the active interface via the environment on the auxiliary
partition.

The default (defined the bootloader's device tree) is still used in
cases when nothing else is specified in the environment.
2024-08-12 14:48:14 +02:00
Joachim Wiberg fa1cece60f Follow-up to 2194f7be: migrate /libexec to /usr/libexec
For consistency with the / + /usr merge, see 2194f7be, let's move the
last remnants in /: /libexec/infix to /usr/libexec/infix

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 2201543090 package/finit: add support for BR2_ROOTFS_MERGED_USR
Ensure Finit installs its files to /usr/lib/finit when building with the
merged-usr config option.  For consistency we adjust --exec-prefix, which
is the base for $libdir, meaning also /libexec is moved to /usr/libexec.

Finit tracks the paths internally, we only need to update runparts probe.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 95519212be board/riscv64: add README for the VisionFive2 board
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 28b1ffe2ae board/riscv64: generalized secure boot support
- Enable squashfs for rootfs image
 - Enable signing of images
 - Add secondary partition
 - Add mkaux.sh script

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg b7c2cde57f doc: minor grammar fixes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 32f4f37281 board/common: riscv64 is also a 64-bit platform
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg f9d14aeab3 package/nghttp2-asio: fix package naming
~/src/infix/x-riscv(riscv)$ make
Makefile:574: *** nghttp2-asio is in the dependency chain of rousette that has added it to its _DEPENDENCIES variable without selecting it or depending on it from Config.in.  Stop.

Fixes #536

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 7cc8ca703e Update ChangeLog and mention new RISC-V board support
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg ce417dedd7 Finalize board support for StarFive VisionFive2
- Sync defconfig with aarch64
 - Sync linux_defconfig with aarch64
   - ethtool w/ netlink not supported yet for the StarFice dwmac
   - note, waaay too many unused drivers still
 - Add aux/cfg/var partitions to sdcard, no rauc support yet
 - Add factory-password-hash to device tree

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 6277b7c94c statd: log critical yanger errors to syslog
Switch to logger, with syslog backend, instead of print() for logging
errors.  This way we can log errors/warnings yet still return partial
JSON data back to statd.  For example, failing to read JSON counters
from ethtool should not break "show interfaces", just return empty
array and log failure to run command.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 6b20dc35de statd: pep-8 fixes
- Missing whitespace in assignments, before comments and methods
 - Drop semicolons from end of statements
 - Use 'if foo not in bar' instead of 'if not foo in bar'
 - Some too long lines (not all, that would be painful)

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 435c5ca9b4 statd: allow ethtool --json to fail without breaking operational ds
On boards like the R2S and the VisionFive2 `ethtool --json -S ethX` is
not yet supported.  This patch allows ethtool to fail, with a slightly
better log message, without breaking the operational datastore.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 2e27a7112a statd: fix log facility and missing pid
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 05526dd893 confd: avoid setting lower-layer-if to vlanN
Inference for an interface named vlanN can only guess C-VLAN and VID,
the base interface must be left to the user to fill in.  This is also
mandatory in the model.

Fixes #531

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 76d3627ccd confd: fix vid sanity check, 4095 is reserved
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg f6b3dfabf9 confd: minor whitespace and readability changes
Reduce scope of pointer, reduce repetition with a define, and add
whitespace for readability.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg c3a4a93cc8 confd: disable password aging when unlocking password login for user
We cannot rely on time being correct.  Password expiration need to be handled
by external mechanism, e.g., RADIUS.

Fixes #534

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 12d969ab0c confd: log PID in migration and prodoct probe scripts
Like other scripts already do, makes it easier to read syslog.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg a275282307 confd: harmonize empty and missing password hash behavior
Removing a user's password hash should be the same an empty password
hash.  In the latter case we already allow login with SSH keys, this
change harmonizes the behavior by also allowing login with SSH keys
when the users's password hash is removed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 39e4935369 confd: refactor user hash validation
Consolidate empty password and $factory$ hash extraction to a common
function called before set_pasword().  The purpose is to ensure all
error handling and log messages are in the same place, except for
missing factory-password-hash, which is now treated as a PANIC and
logged to /dev/console.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 9bbc973d9d confd: silence user group member check
Fixes group record leakage to syslog.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 43b3c43a38 doc: spell out meaning of OAM at least somewhere
;-)

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 0be6f5694c patches: make sure to version linux patches
Just like other packages we should version our Linux patches as well,
even though it may be painful and cause some extra overhead, in the
end it allows multi-kernel setups and compatibility with customer's
using Infix as a BR2_EXTERNAL.

Fixes #489

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg 959ce88b83 board/common: fix bogus syslog warnings
When syncing interface defaults at boot, some settings are read-only and
some are write-only.  Filter these out so sysctl does not log any bogus
Permission Denied messages.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Joachim Wiberg c925b2f0a8 board/riscv64: initial support for StarFive VisonFive2
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-08 13:35:27 +02:00
Mattias WalströmandJoachim Wiberg 8c333ab7e5 Fix regression when merge /usr
cp: cannot stat '/home/lazzer/Documents/addiva/infix/board/common/rootfs/bin/onieprom': No such file or directory
Signed-off-by: Mattias Walström <lazzer@gmail.com>
2024-08-07 17:22:25 +02:00
Mattias Walström 2194f7bebe Merge /usr/* directories into /
/usr/bin  -> /bin
/usr/sbin -> /sbin
/usr/lib  -> /lib
2024-08-06 11:15:38 +02:00
Mattias Walström 0f305ccb84 buildroot: Remove commits from when rousette was introduced
* spdlog: set SPDLOG_FMT_EXTERNAL=OFF
* linux-pam: Set libdir to /usr/lib to get pkg-config to work
2024-08-06 11:15:38 +02:00
Joachim Wiberg ee3c7f44e5 doc: new hardware section, Using a USB Stick
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-04 07:42:44 +02:00
Joachim Wiberg f0ae642144 doc: minor, whitespace cleanup + root -> admin
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-04 07:42:44 +02:00
Joachim Wiberg 438ea3818e board/common: add support for auto-mounting USB sticks
Fixes #497

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-04 07:42:44 +02:00
Joachim Wiberg 9457521626 qemu.sh: check if mkfs.vfat exists, fall back to mkfs.exfat
Also add disk label for future experiments.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-04 07:42:44 +02:00
Joachim Wiberg b9238b2a96 board: add support for exFAT file systems
From https://en.wikipedia.org/wiki/exFAT:

   ... a file system optimized for flash memory such as USB flash
   drives and SD cards.
   ... has been adopted by the SD Association as the default file
   system for SDXC and SDUC cards larger than 32 GB.

The exfatprogs is also a default installed package on most modern
distros, compared to dosfstools (mkfs.vfat) which is not.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-04 07:42:44 +02:00
Joachim Wiberg c7c21b3f6e buildroot: bump to v2024.02.4 LTS
Adjust defconfigs after revert of OpenSSL engines before .4 release.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-02 22:51:21 +02:00
Joachim Wiberg 1b996f543a package/python-yangdoc: bump to v0.6.0
Fixes #529

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-07-11 02:47:02 +02:00
Joachim Wiberg ffb3af5533 buildroot: bump for security fixes
- OpenSSH CVE-2024-6387

 - GLIBC-SA-2024-0004:
     ISO-2022-CN-EXT: fix out-of-bound writes when writing escape
     sequence (CVE-2024-2961)

 - GLIBC-SA-2024-0005:
     nscd: Stack-based buffer overflow in netgroup cache (CVE-2024-33599)

 - GLIBC-SA-2024-0006:
     nscd: Null pointer crash after notfound response (CVE-2024-33600)

 - GLIBC-SA-2024-0007:
     nscd: netgroup cache may terminate daemon on memory allocation
     failure (CVE-2024-33601)

 - GLIBC-SA-2024-0008:
     nscd: netgroup cache assumes NSS callback uses in-buffer strings
     (CVE-2024-33602)

Please note, with this bump it is required to enable the new OpenSSL
option BR2_PACKAGE_LIBOPENSSL_ENGINES, otherwise libssh will not build.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-07-11 02:47:02 +02:00
Jon-Olov VatnandJoachim Wiberg 66d9a80600 Doc: fix typo
[skip ci]
2024-07-08 16:32:12 +02:00
Jon-Olov VatnandJoachim Wiberg f6e4ea3fa7 Doc: Minor tweaks to Speed/Duplex documentation.
[skip ci]
2024-07-08 16:32:12 +02:00
Jon-Olov VatnandJoachim Wiberg b7b3a55fbd Doc: Adding picture to illustrate ethernet auto-neg
[skip ci]
2024-07-08 16:32:12 +02:00
Jon-Olov VatnandJoachim Wiberg 2dab79c321 Doc: Include information on Ethernet config, status and stats
[skip ci]
2024-07-08 16:32:12 +02:00
Mattias Walström 2b5ed0615f Bump libyang, libnetconf2, sysrepo and netopeer2
For netopeer2 we need to patch away local-users, since if it is enabled
netopeer2 requires all users that should be allowed to use netconf to
also be configured in ietf-netconf-server.

Also add some upstream patches.
2024-07-03 09:08:56 +02:00
Joachim Wiberg a672074cef buildroot: fix libyang license hash, updated copyright year
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-28 15:25:11 +02:00
Joachim Wiberg 8f8766c340 package/python-libyang: allow building also for target
No need to lock it down solely for host build-time use.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-28 15:24:28 +02:00
Joachim Wiberg 46598a875d package/python-yangdoc: fix misspelled DEPENDENCIES variable
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-28 15:23:27 +02:00
Joachim Wiberg d523e588d6 packakge: spellcheck license file references
Minor spelling error and mistakes, hashes actually OK.

 - LICENCE -> LICENSE
 - LICENCE -> COPYING

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-28 15:21:48 +02:00
Joachim Wiberg 269c0f2b00 .github: generate checksum files also for latest build
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-28 14:49:25 +02:00
Joachim Wiberg 53c079e1b2 doc: update ChangeLog, final update for v24.06.0-rc1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-28 12:54:27 +02:00
Joachim Wiberg 10744c5116 board/common: extract YANG documentation for all builds
This change builds on top of the earlier work to bootstrap Infix YANG
modules at build time.  Adding a step at the end of post-build.sh to
call the yangdoc tool.  The resulting yangdoc.html is a stand-alone HTML
file of (almost) all YANG nodes.  Almost because some top-level nodes
are unused by Infix atm. and have been filtered out for readability.

Fixes #432

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-28 12:54:27 +02:00
Joachim Wiberg edaaa33ddc package/python-yangdoc: new package
To be used with automatic generation of YANG documentation extracted
from sysrepo at build time.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-28 12:54:27 +02:00
Joachim Wiberg 31a30c736a package/python-libyang: new package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-28 12:54:27 +02:00
Joachim Wiberg 5a3897b1aa package/confd: drop empty help text
This silences an annoying warning at defconfig/oldconfig about MD5CRYPT.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-28 12:54:27 +02:00
Joachim Wiberg 1fac47a728 doc: split CLI tutorial into multile files
Fixes #455

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-28 12:54:27 +02:00
Joachim Wiberg f1585476da confd: fix ietf-tcp-common version
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-28 12:54:27 +02:00
Mattias Walström d27153ea95 Refactor randomization of transport protocol
Simplify the logic and add a parameter to the command line parser
instead of environment variable.
2024-06-27 15:43:06 +02:00
Mattias Walström e3cd981830 restconf: Add workaround for bug in request 2.32.x 2024-06-27 15:43:06 +02:00
Mattias Walström 3b8505f8c4 sysrepo-cpp: Add timeout to getData 2024-06-27 15:43:06 +02:00
Mattias Walström 3feea4d9e2 rousette: Add timeout option 2024-06-27 15:43:06 +02:00
Mattias Walström 91c55ddeb8 backport fix for extending timeouts in initctl 2024-06-27 15:43:06 +02:00
Mattias Walström 4a3559d88f infamy: Remove duplicate function
Get management ip was implemented in two functions, removing one.
2024-06-27 15:43:06 +02:00
Mattias Walström d340ba7407 infamy: Wait for NETCONF and RESTCONF
Also remove some code duplication.
2024-06-27 15:43:06 +02:00
Mattias Walström b790c46dc4 restconf: Bugfix download yang modules
Actually check if the model is already downloaded,
before download.
2024-06-27 15:43:06 +02:00
Mattias Walström b57353294f test: usb: Make possible to run on physical devices
Virtual devices always have two USB ports, but physical, may have more
or less.
2024-06-27 15:43:06 +02:00
Mattias Walström c05ed73ff5 Document randomisation of restconf/netconf 2024-06-27 15:43:06 +02:00
Mattias Walström 4cc23092b2 restconf: Implement actions
And refactor how it was implemented in netconf
2024-06-27 15:43:06 +02:00
Mattias Walström 2919c23fde tests: containers: Adapt tests to work with restconf
Move the web port used in containers from 80 -> 91
this to not collide with nginx which is required
for restconf.
2024-06-27 15:43:06 +02:00
Mattias Walström df7dab5951 infamy: Randomize tests for restconf/netconf 2024-06-27 15:43:06 +02:00
Mattias Walström dd0f1610ab Add get_current_time_with_offset to netconf/restconf
This allows the timezone tests to run on restconf as well
2024-06-27 15:43:06 +02:00
Mattias Walström 29f56eb384 Restconf, netconf: Implement full feature compatibility
Abstract functions and common functions are located in transport.py
Some quirks has been required due to how rousette works,
these functions has been added to the abstract class

Can be removed when rousette behaves as expected.
2024-06-27 15:43:06 +02:00
Mattias Walström ba4d4caeb3 infamy: netconf: Implement deletion by xpath
This is the only way to delete with restconf so it it must also be
implemented in netconf. This replace the put_diff_dict function.

Also: how the xpath looks is different in restconf/netconf therefore
each protocl has a get_xpath() function as well.
2024-06-27 15:43:06 +02:00
Mattias Walström 0595628e97 infamy: Adapt for operational changes between netconf and restconf 2024-06-27 15:43:06 +02:00
Mattias Walström 095b256971 Adapt tests to be able to run them with NETCONF and RESTCONF 2024-06-27 15:43:06 +02:00
Mattias Walström ef09c65f40 restconf: Add support to download YANG-modules 2024-06-27 15:43:06 +02:00
Joachim Wiberg 2ecb6922a0 doc: update changelog for upcoming release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 19:08:22 +02:00
Joachim Wiberg 4c3a46b288 package/klish: bump for improved error message on missing command
Replaces:

    Error: Illegal command

with:

    Error: Command not found, or incomplete.  Try ? for help or Tab for completion.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 19:08:22 +02:00
Joachim Wiberg 95a5f153df statd: increase port column width for 'show bridge mdb'
Fixes #462

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 19:08:22 +02:00
Joachim Wiberg afbe5ca20b confd: when disabling containers, delete in background
Instead of potentially blocking sysrepo, which has a 5 second timeout,
we move 'container delete' jobs to be run by the execd queue.

Fixes #479

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 19:08:22 +02:00
Joachim Wiberg 0edc2d5b70 execd: add support for SNN and KNN queue scripts
This change makes sure execd calls KNN style scripts before SNN,
allowing confd to post teardown jobs that are guaranteed to run
before any jobs to create new resources run.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 19:08:22 +02:00
Joachim Wiberg 56a5388242 confd: fix warning in call to initctl
ietf-system.c: In function ‘change_hostname’:
ietf-system.c:1722:9: warning: ignoring return value of ‘system’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 1722 |         system("initctl -nbq touch netbrowse");
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 19:08:22 +02:00
Joachim Wiberg 4202c07926 package/curios-httpd: bump to v24.05.0
- Fixes to missing BusyBox tools (cat)
 - Bump Buildroot to this year's LTS (2024.02)

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 19:08:22 +02:00
Joachim Wiberg 3e045e62b1 confd: adjust libxcrypt dependency slightly
Ubuntu 22.04 (ubuntu-latest runner on GitHub) has a slightly earlier
version of libxcrypt.  The only hard requirement we have is yescrypt
support, so we can relax the configure check slightly to be able to
run coverity scan.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 773b229749 .github: update coverity job to include libxrypt, drop augeas
We recently dropped Augas from confd and this branch adds support for
$0$cleartext passwords, which require libxcrypt.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg dcdc2ba24d confd: follow-up to 7d9257f
First, actually remove setup.sh.  No reason to have the old version
lingering in the repo confusing devs.  Also simplify script heading
dropping previous netopeer2 text and distilling the comment before
sourcing the .inc file.

Silence the install/update, dropping -v -- no need to be overly verbose
now that we now the new yang loader works at build time.

Crucially -- fix a bug in UPDATE_MODULE(), missing closing '

Simplify naming and location of .inc files.  No need for the long
filenames, or the new directory, the directory name gives plenty of
context.

Add reminder of duplicate infix-interfaces.yang in .inc files -- this
duplication is unfortunate and we should try to fix this better.  We
will forget to update one or the other any day ...

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 3e7340cb52 confd: add support for $0$cleartext password
Finalize support for IETF System YANG incl. all IANA crypt-hash types.

This patch builds on the earlier work adding yescrypt and $factory$ key
word.  The YANG description for the crypt-hash type override has been
significantly udpated to discourage use of $0$cleartext passwords.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg ed88a92fac confd: add support for vendor/product specific factory-config
With the recent changes to confd to support: hostname format specifiers,
$factory$ default keyword for password, and on-the-fly generation of the
NETCONF SSH host keys, the system no longer depend on the very intricate
confd gen-* scripts to create factory-config and failure-config.

This patch set adds support for detecting and installing product/vendor
specific static factory-config and failure-config files.  See the confd
README for details.

To facilitate generation, e.g., of the NETCONF SSH host keys, the confd
daemon must be running when bootstrapping the first startup-config from
eithe generated or static factory-config.  This is why the bootstrap and
load helper scripts have been changed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 3aead122ee package/finit: backport batch mode for runparts
Drop annoying escape characters from ixinit when logging to syslog.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 067c911640 confd: refactor netconf hostkey generation
This patch adds support for an empty "genkey" pair in the keystore for
the NETCONF hostkeys.  Primarily intended for static factory-config.

When a configuration is loaded and confd detects a missing public or
private key in the "genkey" asymmetric key, it loads generated keys
from disk and store in the running datastore.

Fixes #435

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 935bb0d808 confd: minor, fix linter warning (value unused)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 170392cdb1 libsrx: new helper function srx_isset()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 2c81c7cdb6 doc: update ChangeLog for upcoming v24.06 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 0d0d97ad3f test: verify hostname format %h-%m in running and operational
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 32ef120928 test: verify admin user default password in running and operational
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg e5820e1e55 test: new method get_password() in Env
Allow tests to fetch expected factory default password of devices.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg fb424709d7 test: minor, fix pep-8 warnings from pylint
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 99117fc90f conf: add support for handling breaking model changes
Add metadata 'version' field to ietf-system to be able to detect .cfg
file version.  Fixes #308

Add early boot script to automatically migrate configuration files of
older version to new syntax.  Fixes #178

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 8851b279f5 confd: merge infix-shell-types.yang with infix-system.yang
All typedefs and identities should be declared in the module that uses
them unless other modules need them.  This change also makes it easier
to work with tools like yanglint and pyang.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 86a962795a confd: operational support for ietf-system hostname and passwords
Fixes #478

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 3a40bbca39 confd: silence setup.sh and fix update bug
This patch silences the previously very verbose setup.sh script, and
crucially also fixes a bug in UPDATE_MODULE().  Missing closing '

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 4deeacd0ad confd: change failure mode hostname to capitals
For consistency with UNKNOWN base mac address, and making it easier for
the user to actually notice the fault condition.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 1361d02e59 confd: add support for hostname format specifiers
The following specifiers are currently supported:

 - %h default hostname from /etc/os-release
 - %i value of ID from /etc/os-release
 - %m last three octets of base MAC, e.g., c0-ff-ee

Fixes #435

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 173e6040fe confd: allow non-admin users to use the CLI, NACM rules apply
With this patch, users not in the NACM admin group and a login shell set
to clish can now log in to the CLI.  Prior to this change only members
of the UNIX group 'wheel' could open the klishd socket.

The patch adds another group, 'sys-cli', which acts as a capability for
users.  An admin user (member of the admin group) will now be member of
both the UNIX 'wheel' and 'sys-cli' groups.  A non-admin user that has
shell set to 'clish' will only be member of the 'sys-cli' group.  Other
users will not be mapped to any UNIX group and have only permissions set
in NACM.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 3cbafd8ef4 confd: add supoprt for yescrypt
Fixes #447

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 75d560440e confd: allow web services in failure mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 174bf7dc6f confd: add support for $factory$ password hash
This patch simplifies the handling of factory default password for the
admin user by overloading the ietf-system password type.  The new type,
$factory$, acts a system hint to use any device specific (or built-in
software/device-tree) default password hash.

Fixes #435

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 83d2e1b0ae container: clean up after unpacking oci archive
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg b251cb56f0 container: enable logging of output from start/stop action
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg fec19e1808 container: fix timeout handling in restart
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg aa529242c7 klish-plugin-infix: ensure filesystem is synced after 'copy' command
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 03a8ea9500 package/klish-plugin-sysrepo: fix 'show leaf-node' in configure
This patch bumps klish-plugins-sysrepo to fix the annoying issue with
the CLI not supporting, e.g. "show hostname" in system config context.

Details: https://github.com/kernelkit/klish-plugin-sysrepo/issues/3

The problem was two-fold, first we used the wrong ptype for 'show'
(and 'diff') commands, so srp_show() was not even called.  Then the
klish-plugin-sysrepo code did not account for show being called for
leaf nodes.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Ahmed KaricandMattias Walström 2b1543ba11 confd: Minor Update on YANG Modules Setup Refactor
- Fix indentations:
    - Corrected indentations in confd.mk to adhere to Buildroot coding
     standards

  - Relocate YANG Modules List Files:
    - Moved the YANG modules list files (.inc) from package/confd to
     src/confd

  - Add Missing YANG Module:
    - Included infix-interfaces@2024-01-15.yang in
      yang_modules_confd.inc
    - This module was missing in the non-containerized build and is now
      correctly added
2024-06-19 15:41:33 +02:00
Mattias Walström b92276bfac docker: Upgrade requests to silence dependabot
Unintended leak of Proxy-Authorization header in requests #1
Requests `Session` object does not verify requests after making first request with verify=False #2
2024-06-19 15:35:51 +02:00
Mattias Walström ee0b035e4b doc: Update Changelog 2024-06-19 15:35:51 +02:00
Mattias Walström ac70c6bffc kernel: Upgrade kernel to 6.6.34 2024-06-19 15:35:51 +02:00
Mattias Walström 61b9e6307c buildroot: Update buildroot to 2024.02.3 2024-06-19 15:35:51 +02:00
Mattias Walström f0f8b7e06a containers: Remove empty entrypoint
This made it impossible to use the "command" in container
configuration.

This fix issue #476
2024-06-19 15:35:51 +02:00
Mattias Walström dadf81baf7 rousette: Import upstream patch to remove systemd dependancy 2024-06-19 15:35:51 +02:00
Mattias Walström f819279aea qemu: Make the size of /var configurable 2024-06-19 15:35:51 +02:00
Mattias Walström 6ce0fe7607 confd: Stop bfdd if ospf is removed
This was not handled in the previous design.
2024-06-19 15:35:51 +02:00
Ahmed KaricandMattias Walström 7d9257f5f6 confd: refactor yang modules setup script for better modularity and maintainability
- Moved setup.sh and yang_modules files from infix/src/confd/scripts/ to infix/utils/ to streamline the repository structure
- Updated confd.mk to correctly reference the new location of the setup script
- Introduced yang_modules_<type>.inc file to list all YANG modules for improved clarity and maintainability
- Modified the new setup script to dynamically source module lists from yang_modules_<type>.inc
2024-06-18 18:54:18 +02:00
Tobias Waldekranz 8baca7df03 test: unit: defconfig: Skip root login checks for all boot configs
Also, hoist the whitelist check up one level, so that we can report
which configs we are exempting, and which ones we are actually
checking.
2024-06-17 14:59:27 +02:00
Tobias Waldekranz 34a6a0ecc4 uboot: Allow untrusted images to boot in developer mode
Since a user has access to the shell in developer mode, we might as
well allow booting through the standard boot scripts as well. This
means that a product with a bootloader only accepting images signed by
Company A can now be configured to netboot a regular developer image
without any special user interaction.
2024-06-17 14:59:27 +02:00
Tobias Waldekranz 97c38ee024 cn9130-crb: Update U-Boot glue after bootmenu additions
We no longer need to set bootdelay on development platforms. You can
now always get to the bootmenu with a Ctrl-C, from there you can get
to the shell if developer mode is enabled. Therefore, override the
default dev-mode detection to statically enable it on the CRB.
2024-06-17 14:59:27 +02:00
Tobias Waldekranz ba73f3e832 uboot: HTTP netboot support
If we receive an option 67 (bootfile) matching http://IP/rootfs.itb,
use U-Boot's wget implementation to download the file. The web server
must listen on port 80. tftp:// is also supported.

Without a protocol prefix, assume that the bootfile should be fetched
using TFTP from ${serverip}.
2024-06-17 14:59:27 +02:00
Tobias Waldekranz ccb17b1c91 uboot: Remove dead code 2024-06-17 14:59:27 +02:00
Tobias Waldekranz 0b643f1a78 uboot: Add boot menu
Generate a boot menu, accessible with C-c during a short window, where
a user can interactively select a custom boot source and/or trigger a
factory reset of the device.

With this in place, we should always be able to unbrick a device, as
the image can be fed over the network, and local data can be ignored
by opting in to a factory reset.
2024-06-17 14:59:27 +02:00
Tobias Waldekranz 6eb8a41103 uboot: Import hush fixes from kkit/u-boot-2023.07.y 2024-06-17 14:59:27 +02:00
Tobias Waldekranz 60118fad0d uboot: Remove old unused patches
Patches are now versioned in the expected patches/uboot directory
instead.
2024-06-17 14:59:27 +02:00
Tobias Waldekranz 3b77db13c5 aarch64: Add defconfig to build U-Boot for QEMU 2024-06-17 14:59:27 +02:00
Tobias Waldekranz 81f05d1539 build: Allow relative relative output paths
Before this change, this invocation...

    make O=x-x64 x86_64_defconfig

...would use the output directory...

    /path/to/infix/buildroot/x-x64

...which is not the expected behavior. This would happen because
Buildroot will, naturally, expand relative paths based on _its_ top
directory.

Therefore, translate any relative paths to absolute ones based on
_Infix's_ top directory, before handing control over to Buildroot,
such that the expected...

    /path/to/infix/x-x64

...output directory is used.
2024-06-17 14:59:27 +02:00
Tobias Waldekranz ec5af122f6 qemu: Create UNIX socket for connecting to QEMU's GDB stub
This let's you debug the running operating system kernel, or the
bootloader.
2024-06-17 14:59:27 +02:00
Tobias Waldekranz b536f0c874 doc: Update ChangeLog with QoS improvements 2024-06-07 10:10:38 +02:00
Tobias Waldekranz 640ccea288 test: case: vlan_qos: Add
Verify that we can map VLAN PCP to skb->priority on ingress, and back
to PCP on egress.
2024-06-07 10:10:38 +02:00
Tobias Waldekranz 68b1632f19 test: netns: Add packet capture helper
This tries to improve on the existing sniffer in a couple of ways:

- In addition to being usable as a context manager, also allow
  explicitly starting and stopping the capture.

- Try to synchronize the start of the capture by snooping stderr and
  wait for tcpdump to start up. This should eliminate the need for
  sleeps before starting to send packets.

- By default, execute a safety sleep when terminating the capture to
  ensure that any straggling packets have had time to arrive at their
  destination.
2024-06-07 10:10:38 +02:00
Tobias Waldekranz c39f122014 test: netns: ping: Support specifying an ID
By default, ping(1) will use a random ID in the ICMP packet. Allow
setting it to a fixed value instead.

This makes it easy to identify that particular packet in a packet
capture later on.
2024-06-07 10:10:38 +02:00
Tobias Waldekranz ab8cb7a3ac confd: interfaces: VLAN QoS mappings
Let the ring-bearer^Wuser decide the policy around how VLAN PCP is
mapped to skb->priority on ingress, and back to PCP again on egress.

Either a fixed value is used for all packets, or a 1:1 mapping is done
between the two domains. By default, we follow Linux's defaults of a
fixed 0 value on both ingress and egress.
2024-06-07 10:10:38 +02:00
Tobias Waldekranz 20d7f901a2 confd: interfaces: Translate internal errors to sysrepo domain
Sysrepo expects callbacks to return `sr_error_t`'s, not POSIX errnos.
2024-06-07 10:10:38 +02:00
Tobias Waldekranz f0098059a7 confd: interfaces: Flush addresses when exiting current generation
The interface in question might not exist at init:49 if some other
change requires it to be recreated from scratch, in which case it will
be removed in exit:50. Therefore, run the flush at exit:49, where it
should always still exist.
2024-06-07 10:10:38 +02:00
Tobias Waldekranz de6c624b95 confd: dagger: Add debug statements to trace dagger commands 2024-06-07 10:10:38 +02:00
Tobias Waldekranz d9b14c457a confd: dagger: Detect failing scripts
When timestamping of scripts was added, we unfortunately started to
record the exitstatus of `ts(1)`, rather than the script itself.

Refactor the metadata collection to use `time(1)` instead, which will
propagate the inferior's exitcode. This will also allow us to collect
other parameters in the future.
2024-06-07 10:10:38 +02:00
Tobias Waldekranz 366cc4c8e7 board/common: Disable priority reclassification when forwarding IPv4
By default, Linux will map an IP packet's TOS field into skb->priority
when acting as a router. Unfortunately this is only globally
configurable (per network namespace), which leaves us with the
following dilemma:

If we keep reclassification enabled, then a setup like this...

vlan1 vlan2
   \   /
    br0
    / \
  e1   e2

...would likely not work as expected because any priority information
from hardware, that might be mapped to skb->priority via vlan1's
ingress-qos-map, would then be replaced by the standard TOS-mapping on
the routing boundary.

On the other hand, if we disable reclassification, then we won't be
able to source priority information from the TOS field when no other
source is available, as is the case when the source interface is a
regular NIC.

Given that the primary use-case is to run on switchdev ports, we will
most likely always have priority information available from hardware,
which is why we opt to disable the reclassification.

If this ever becomes configurable per interface, then we could open up
the configuration to let users define the policy of which layer's
priority should take precedence.
2024-06-07 10:10:38 +02:00
Tobias Waldekranz e358e6bc1f board/common: Use mqprio on supported interfaces
Opportunistically look for interfaces with multiple transmit queues
and hardware support for the mqprio queuing discipline. For every
matching interface, set up mappings from kernel-internal packet
priorities, via traffic classes, to transmit queues such that as many
high priorities as possible are scheduled on separate queues.
2024-06-07 10:10:38 +02:00
Tobias Waldekranz a5d98e9351 board/common: Collect all system init in a dedicated runparts dir
This makes it easier to add more scripts without having to update the
finit config file, and it clarifies which of the scripts in
/libexec/infix only execute at boot.
2024-06-07 10:10:38 +02:00
Tobias Waldekranz dfdd3b1090 package/sysrepo: Import upstream datastore corruption fix
See sysrepo/sysrepo#3268
2024-06-07 10:10:38 +02:00
Tobias Waldekranz b4e3c955d8 kernel: Import mqprio support for mv88e6xxx from kkit-linux-6.6.y
...and enable mqprio support in the kernel config.
2024-06-07 10:10:38 +02:00
Joachim WibergandTobias Waldekranz 91148de095 confd: allow ipv6 address with global prefix in factory bridges
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-05 15:08:06 +02:00
Joachim WibergandTobias Waldekranz fe036049b8 Fix #473: bridges never get IPv6 autoconf enabled
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-05 15:08:06 +02:00
Mattias Walström d2d1562c8c sysrepo-cpp: Change to kernelkit-url 2024-06-04 13:38:03 +02:00
Joachim WibergandMattias Walström eebba3b3cb doc: initial RESTCONF scripting examples
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-04 13:38:03 +02:00
Joachim WibergandMattias Walström 310563abda confd: background factory reset to allow time to respond to RPC
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-04 13:38:03 +02:00
Joachim WibergandMattias Walström 37506bcdd9 configs: enable rousette for RESTCONF support
Sync after `make update-defconfig`:

 - avahi selected by mdns-alias package (all)
 - iptables and ca-certs selected by other packages (r2s)

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-04 13:38:03 +02:00
Mattias Walström 23585486de test: Add backend to run tests with restconf
Very simple tests work (hostname.py), more complex
tests (static_routing.py) failes due to the lack of
model prefix, for example. infix-ip:ipv4 instead of just
ipv4.

We need to fix this before you send your configuration, run
it through libyang for example and get the full model-name.
2024-06-04 13:38:03 +02:00
Joachim WibergandMattias Walström 78153e62cf nginx: forward /yang and /.well-known as well to restconf agent
We skip /telemetry/optics for now since we don't support any telementry atm.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-04 13:38:03 +02:00
Joachim WibergandMattias Walström a37dd412e1 netbrowse: add /netbrowse route and RESTCONF mDNS xlate
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-04 13:38:03 +02:00
Joachim WibergandMattias Walström f9bbb86d49 confd: configurable support for RESTCONF using infix-services
This enables access to /restconf on port 443 over HTTP/1.1 and HTTP/2
via rousette when enabled.

Also, slight refactor to allow including /restconf and /netbrowse as
optional locations in the main servier directive.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-04 13:38:03 +02:00
Joachim WibergandMattias Walström 59eb73bf24 confd: minor, whitespace fixes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-04 13:38:03 +02:00
Mattias Walström 44465b679f Add C.UTF-8 locale
Required by rousette
2024-06-04 13:38:03 +02:00
Mattias Walström 4f3ae3b9a4 Add new package: Rousette - a RESTConf server 2024-06-04 13:38:03 +02:00
Joachim WibergandTobias Waldekranz 3339fc5738 doc: update ChangeLog for upcoming v24.06 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Joachim WibergandTobias Waldekranz 90b35affe2 Drop augeas from system completely
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Joachim WibergandTobias Waldekranz ff10f4ee2f confd: drop augeas from build requirements and clean up
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Joachim WibergandTobias Waldekranz 96cdc7c628 confd: simplify, drop augeas for direct hostname update
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Joachim WibergandTobias Waldekranz 189ecd8fb0 confd: clean up internal user mgmg functions from augeas
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Joachim WibergandTobias Waldekranz 23dd84a690 confd: simplify, drop augeas also for add/del user to/from wheel
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Joachim WibergandTobias Waldekranz b5eb566c35 confd: replace malfunctioning augeas for setting password and shell
With increased use of augeas to manage users, groups, and permissions,
we seem to have reached peak complexity.  Because when re-running the
same test[1] over and over, somtimes the aug_save() function fails to
actually save the changes to /etc/shadow to disk!

We have already experienced weird behavior with augeas, see comment in
deleted code, and these latest problems became the last straw.  We have
decided to replace it with standard C APIs.

As a spin-off, thanks to the requried refactoring, the check_shell()
function, used by the change_nacm() callback, could be replaced with a
call to set_shell() for both "is-admin" and "non-admin" cases.  This
means we now also restore Bash privileges (and not just take them away)
when modifying nacm group memberships.

Fixes #468

[1]: test/case/ietf_system/user_admin.py

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Joachim WibergandTobias Waldekranz 21ef50ebfb test: new test, verify handling of non-admin users
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Joachim WibergandTobias Waldekranz 47ee01be96 test: minor, whitespace cleanup
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Joachim WibergandTobias Waldekranz eea5f77be9 confd: refactor nacm user shell check
reuse shells array from sys_find_usable_shell(), used elsewhere.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Joachim WibergandTobias Waldekranz 5f07fc9d9f confd: check if user has administrator rights for shell selection
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Joachim WibergandTobias Waldekranz 43d68289b9 confd: refactor, break out user-in-group check to separate function
No logical changes made.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Joachim WibergandTobias Waldekranz 50e068ef10 confd: fix check for group membership
Checking if a user is an administratr we cannot rely solely on the
return value of sr_get_items() but also ensure at least one group
matches the search criteria.

Fixes #469

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Joachim WibergandTobias Waldekranz 2218901dc7 confd: fix invalid module prefix to legacy motd setting
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Tobias WaldekranzandJoachim Wiberg 8eb67c1d13 test: Fixup permissions of generated files when using docker
Since containers managed by docker runs as root, files created in bind
mounted volumes will be owned by root:root. This is a problem for
files generated during test execution, as the calling user does not
have permission to remove them.

Therefore, add a wrapper entrypoint that hooks up an exit handler that
will fixup the permissions before exiting the container.
2024-05-24 19:10:10 +02:00
Joachim Wiberg 8fdd147d1e .github: ignore any existing output/ directory
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-24 17:40:36 +02:00
Joachim Wiberg f29ad88b16 .github: set up build env. for 'make test'
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-24 17:00:15 +02:00
Joachim Wiberg 3f36c4541d .github: drop make from configure step and fix test
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-24 15:41:05 +02:00
Joachim Wiberg 9f8b27ae4a .github: split build and test in separate jobs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-24 14:43:05 +02:00
Joachim Wiberg b5af266953 .github: simplify build and regression testing
Now that Reggie builds all supported archs there is no point in keeping
two separate (and now very similar) workflows.  So we've decided to lay
off Reggie and let Bob, who has seniority, take over Reggie's tasks.

This simplification also means that jobs will no longer be started on
push to branches, only pull requests.  For half-baked branches a draft
pull request can be used to auto-start builds, if needed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-24 13:23:16 +02:00
Mattias WalströmandTobias Waldekranz 0b3816473d setup.sh: Document the origin of this script. 2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz b9a8d65e61 libsrx: Remove srx_require_module API
Not needed anymore since all YANG modules should be loaded at
build.
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz b1a6606728 confd: Add sysrepo and netopeer as a dependency.
And remove not needed environment variable
2024-05-24 11:58:47 +02:00
Joachim WibergandTobias Waldekranz 453afeb2d7 confd: simplify sysrepo datastore makedev permissions 2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz c3128c4080 Update Changelog regarding updated YANG models 2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz 6e07f5b6f8 test: ipv4_autoconf: Increace possible delay when waiting for link local
No reason to be that narrow (10s) change to 30s
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz d47cc76ab5 libyang: Add upstream segfault patch 2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz a4b1d37763 confd: Update SHM path
Do not use netopeer-created shm-path
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz c4d567f994 infamy: route: ospf: Adopt to changes done in 2c88e1bdf5
Now there is no guarantee that the control-plane-protocol array
exist in operational.
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz 05a46475ed yanger: Change behavior to always genereate a valid YANG
Before we generated an invalid YANG model but it was
still accepted by libyang, but now, since the upgrade
it is not.
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz 2096d93282 ospf-status: Return {} if no status can be retreived (ospfd is disabled)
This helps yanger to generate a valid configuration.
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz dfe0a507fc confd: Always use model prefix for intentityrefs
This is a hardened requirement i latest libyang(/sysrepo)
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz 05f063d81b test: Refactor ipv4 address
More robust and less code duplication
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz fe06bea056 netopeer2: Add a custom PAM configuration file
The one installed with netopeer2 includes files that exist on ubuntu
but not in buildroot.
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz 4975a16446 FRR: Fix compatibility with newer libyang
only minor.
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz 8022bd31dc Refactor gen-key to generate SSH accepted keys. 2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz 58541177aa libnetconf: Add support for passwd accounts
This was removed when the new version of ietf-netconf-server was
introduced with the new version of libnetconf.
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz d3b102d46e Bump sysrepo, netopeer2, libyang and libnetconf
This also adds support in sysrepot to install factory config on boot,
default is only to allow it when installing the module, we can not do
that anymore, since the modules is installed during build and the factory
config (or failure) can only be determed when booted.
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz 3354effc53 Build in required modules on buildtime
This to hopefully speed up boot, do as little as possible
during boot.

* New modules needs to be added to src/confd/scripts/setup.sh
* Permission needs to be changed post-build for YANG files,
  see CONFD_PERMISSIONS in confd.mk
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz bef44b725e Remove ietf-netconf-acm@2018-02-14.yang
Provided by libnetconf
2024-05-24 11:58:47 +02:00
Mattias Walström 115f5c8f52 infamy: igmp_vlan: Refactor
Simplify test, and speed it up when do positive testing.
2024-05-23 08:45:05 +02:00
Mattias Walström 6df2c90d85 test: Refactor routing tests
Make more in parallel and restructure code
2024-05-23 08:45:05 +02:00
Mattias WalströmandJoachim Wiberg 06742cf825 kernel: Upgrade to 6.6.31 2024-05-22 12:01:30 +02:00
Joachim Wiberg c7c1b5b12d .github: build aarch64 target as well in regression workflow
- Add aarch64 to build matrix on Reggie
 - Rename platform -> target in all workflows

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-21 10:10:16 +02:00
Joachim Wiberg 2f4cdd0d9c Fix 'ip addr show proto NAME'
- Add support for proto by name in ip addr show
 - Add missing static protos, needed for show

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-21 09:00:10 +02:00
Joachim Wiberg f1e7fda956 doc: revise developer's guide a bit wrt. packge overrides
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-21 09:00:10 +02:00
Tobias Waldekranz 7bb48ece49 test: Reinstate podman as default runner
Partial revert of 23469bbe3b. When running tests in a GitHub action,
we do not want to run as host root user. Therefore, restore podman as
the default runner, but make sure to prefer docker when attaching to
the host network namespace.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz 508e2287b8 doc: testing: Sync documentation with latest changes
Update docs to match the recent developments in the test system.

Spin off the architecture description to its own document, and focus
testing.md on the day-to-day usage.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz 03d48e9aab test: Unify the different test modes to a smaller number of targets
Now that tests in the host's network namespce can be run inside the
container, simplify test.mk for increased reusability.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz d7c41489e0 test: Always run tests inside container
When we want to test a `make run` instance, or a physical topology,
start the docker in the host's network namespace instead.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz 897faf08d9 qemu: Fix off-by-one in topology generation
When interface naming switched to use 1-based indices instead of
0-based, the topology generation was overlooked thus breaking tests
against a `make run` instance.

Bring everything back in sync.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz 3ad20dfd5b test: Drop support for running tests with podman
When testing in the host's namespace, only docker seems to offer the
required capabilities (due to its daemon/client architecture).

Qeneth tests can still be run in podman. Users will have to install
the docker wrappers for podman to make use of this.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz 3f2ae3f3fc test: case: igmp_basic: Speed up positive reception tests
Use must{,_not}_receive instead of the general sniffer, so that we can
continue the test as soon as we see the transmission at the receiver,
rather than always waiting the full 5s.

While we're here:
- Show the port mappings in the top block-comment
- Define a few more steps to show the user what is going on
2024-05-20 16:21:06 +02:00
Tobias Waldekranz f94815cf46 test: case: static_multicast_filters: Speed up positive reception tests
Use must{,_not}_receive instead of the general sniffer, so that we can
continue the test as soon as we see the transmission at the receiver,
rather than always waiting the full 5s.

While we're here:
- Show the port mappings in the top block-comment
- Define a few more steps to show the user what is going on
- Avoid global variable references in set_static_multicast_filter()
2024-05-20 16:21:06 +02:00
Tobias Waldekranz 2190c3bc52 test: netns: Add must{,_not}_receive
In test cases, it is common that we want to verify that a certain type
of traffic reaches a namespace. This has, up to this point, been
solved by the generic sniffer.Sniffer.

Try to improve the two most common use-cases...
1. Test if a flow reaches a namespace
2. Ensure that a flow does not reach a namespace
...by always exiting as soon as the first packet is received.

This saves time on positive tests, and the synchronous API allows it
to compose well with infamy.parallel().
2024-05-20 16:21:06 +02:00
Tobias Waldekranz e65625e32f test: Add support for attaching to devices via SSH
Support the familiar subprocess.run API, and runsh from netns.py.

This should only be used for debugging, or in the rare instances when
we want to test functionality that is not available via NETCONF.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz af65bbe7f9 test: furl: Cap time spent waiting for HTTP requests
Without an explicit timeout, urllib will wait indefinitely for a
connection to be made.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz 1dbe09b428 test: Spellchecking 2024-05-20 16:21:06 +02:00
Tobias Waldekranz 232c2329af test: netns: Let the default ping timeout be tuned in the topology
QEMU systems seem work fine with the 5s timeout, whereas some physical
devices can't quite keep up with that.

Let the slower systems indicate that they need a bit more time without
punishing faster ones with a longer default.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz 772019db22 test: env: Add support for querying global attributes
This will let other Infamy submodules tune their behavior based on the
particular test system they are running on.

Attributes are defined by creating graph-global attributes with an
"ix_" prefix.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz 52c6c2274e test: topology: Add helper to retrieve graph-global attributes
This will allow us to define attributes that are specific to a
particular test system.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz e53f3362be test: case: routing_basic: Restructure to reuse existing namespace
Rather than setting up and tearing down two identical namespaces,
create it once and use it for the duration of the test.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz c3945a996c test: case: static_routing: Restructure to reuse existing namespace
Rather than setting up and tearing down two identical namespaces,
create it once and use it for the duration of the test. (This is
probably a documentation issue with Infamy: there is no requirement
that test.steps are direct descendants of the test, but until this
point there was no example of this in the source base)

In the process of this, it was also discovered that no positive ping
test was done over v6, so that has been added.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz c2d357a185 test: Use stable MAC addresses when creating MACVLANs
To work around the issue detailed in the method's doc comment.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz 74b0679cf0 test: case: container_*: Use standard ping tests 2024-05-20 16:21:06 +02:00
Tobias Waldekranz dc6dffbff9 test: case: bridge_*: Use standard ping tests 2024-05-20 16:21:06 +02:00
Tobias Waldekranz 4c6dfdf600 test: Run negative ping tests in parallel
Rather than having to wait for each timeout sequentially, run each
test in parallel.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz b62fd627f0 test: Never buffer output
Avoid having log messages stuck in a pipe when stdout is not a tty,
e.g. when running a suite of tests using 9pm.

Two benefits:
- Nicer experience when interactively running a suite
- Timestamps inserted by 9pm are more useful
2024-05-20 16:21:06 +02:00
Tobias Waldekranz 177b65587b test: case: routing_basic: Remove bridge from figure
This a routed setup, no bridge is used.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz b5679aa603 test: Improve robustness of pinging from within namespaces
It turns out that the semantics of ping's -c option does not match our
expectations. The manual says:

> Stop after sending count ECHO_REQUEST packets. With deadline option,
> ping waits for count ECHO_REPLY packets, until the timeout expires.

But in fact, something like an ICMP_DEST_UNREACH will also count as a
response, meaning that the process will terminate with non-zero
exitcode even though the deadline has not yet been crossed, rather
than keep waiting for an ECHO_REPLY.

To add some extra flavor: this is only the case for iputils' ping,
Busybox's implementation will hold out for a response until the
deadline expires.

Therefore, wrap the ping in an ugly retry loop.

Also, return the full available context from must{,_not}_reach on
failures, instead of just the output. This allows us to show the exit
code in the top-level exception handler.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz fb2bd2c2b7 test: Whitespace cleanup 2024-05-20 16:21:06 +02:00
Tobias Waldekranz b9907fa7ae test: Add nsenter helper script to enter Infamy namespaces
When a test starts an isolated MACVLAN namespace, it is often useful
to interactively join that namespace to investigate issues. To do
this, we need to find the "sleeper" process backing the namespace, and
`nsenter` into that process's network namespace.

Add a script that automates this process.

To start a shell in the netns of the MACVLAN stacked on top of d1b,
start a shell in the test environment:

    infix/test $ ./shell
    13:37:00 infamy0:test # ./nsenter d1b
    13:37:01 infamy0(netns:d1b):test #
2024-05-20 16:21:06 +02:00
Tobias Waldekranz 7d6792a638 test: Always log logical-to-physical mappings
For tests using a logical topology, log the resulting mapping to the
physical one. This way, we always have a record of the entire
environment.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz b6cf866f52 test: Log the output of failing subprocesses
It is not uncommon for subprocesses to fail when developing new tests,
but the default representation of CalledProcessError does not print
the stdout of the program, only that it failed.

Catch this common case when a test is about to fail, and make sure to
log any output it produced.
2024-05-20 16:21:06 +02:00
Tobias Waldekranz 2c72aaf6e1 test: Move all test related targets from board/x86_64 to test/
The list of binaries needed inside the test environment is the only
architecture specific bit, so refactor that out to a separate
variable.
2024-05-20 16:21:06 +02:00
Tobias WaldekranzandJoachim Wiberg b5f2252650 kernel: Latest fixes
- Add missing locking around standard counter groups
- Fix reference counting issue with IGMPv3/MLDv2 reports

Found as part of debugging the regression test suite on hardware.
2024-05-20 16:15:23 +02:00
Joachim Wiberg ca026a37fc Add link to Latest Build
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-18 12:11:37 +02:00
Joachim WibergandTobias Waldekranz abd8621e92 doc: split container host interface, add w/ phys-address example
The container host interface text was a bit hard to understand.  This
patch splits it up in two parts, basic routed setup and an advanced
with two interfaces.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-18 09:58:19 +02:00
Joachim WibergandTobias Waldekranz 0df778a5f6 confd: fix custom mac support for veth interfaces
This patch adds support for setting the mac address already when
creating veth interfaces.  Necessary to cooperate with containers.

Fixes #453

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-18 09:58:19 +02:00
Joachim WibergandTobias Waldekranz 0a7f8ce216 confd: always create factory bridges with multicast snooping enabled
The confd `gen-interfaces` script is called for some customers with a
default to create a bridge with all, or a subset of all, ports.  The
safe default, which incidentally coincides with the same customer's
requirements, is to have IGMP/MLD snooping enabled by default.

Fixes #454

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-18 09:58:19 +02:00
Joachim WibergandTobias Waldekranz 7e2d433857 Prepare ChangeLog for next release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-18 09:58:19 +02:00
Joachim Wiberg 413470569e doc: clarify with before and after
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-17 16:54:09 +02:00
Joachim Wiberg b2adf639ff doc: initial section on developing new features for confd
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-17 16:42:06 +02:00
Joachim Wiberg 3ac1dfbf4c .github: ensure clean and recursive submodules
Minor change, mostly for consistency across repos.

[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-17 14:38:57 +02:00
Joachim Wiberg 975a7b466c .github: introduce issue templates
We already have a pull request template.  This is a propsal to add issue
templates as well.  These yml templates change the behavior of reporting
issues to more a of a pre-formatted form with guard rails.

It is still possible to report blank issues the old way.

[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-16 13:32:35 +02:00
Joachim Wiberg bdefe9452c .github: revise and update contributing guidelines
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-16 13:32:35 +02:00
Joachim Wiberg 9211fba6d5 .github: simplify pull-request template slightly
Referencing/Linking to issues is now supported in the GitHub GUI.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-16 13:32:35 +02:00
Joachim Wiberg 1d58d2058d package/gencert: declare dependency on pkg-config and libopenssl
Plain openssl is a meta-package, gencert requires libopenssl v3.x and
later, and use pkg-config to detect its presence.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-16 13:32:35 +02:00
Joachim WibergandMattias Walström 23dc237403 Switch to PAM for system authentication
- Add sshd 'UsePAM yes'
 - Buildroot automatically adds and enables:
   - /etc/pam.d/ with authentication for login, sshd, and sudo
   - PAM support in BusyBox login

Also, prepare for adding RADIUS authentication support to ietf-system
the only tricky part is testing against a RADIUS server.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-15 16:06:08 +02:00
Joachim Wiberg 406dbfdff4 Update release date for v24.04.2
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 15:50:12 +02:00
Joachim WibergandTobias Waldekranz 9d7817356f statd: support for enabling DEBUG() logs with env, like confd
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz 16c21f0da8 doc: update ChangeLog for v24.04.2 patch release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz aa20f29b36 confd: fix missing /etc/resolv.conf after 'no system'
When a CLI user performs the following command, the DNS resolver was
left in an undefined state.

    admin@infix-00-00-00:/config/> no system
    admin@infix-00-00-00:/config/> leave
    admin@infix:/>

The avahi-daemon reported the missing /etc/resolv.conf and the fix is to
ensure `resolvconf -u` runs on every major change ot ietf-system, even
if there is no new resolv.conf to roll in.  At bootstrap this has been
handled by another mechanism so has not been seen by most users.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz c6b818d0bc confd: fix error handling for sr_get_data()
The sr_get_data() API may return SR_ERR_OK and still set the cfg pointer
to NULL!  This happens when, e.g., executing 'no system' from the CLI.

This patch adds a check for this in all occurrences of sr_get_data().

Also, in ietf-routing.c there was *no* error handling for this API, this
required some restructuring to ensure a FILE *fp was closed properly in
all cases.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz 89c9a12db2 confd: on failure to load startup-config, reset and regroup
With the sysrepo patch from the previous commit, we can now properly
detect if a callback failed to apply its changes in SR_EV_DONE.  When
this occurs the system may be in an undefined state, so we must try
to recover it before loading failure-config.

This patch tries to perform a factory-default RPC, which is an Infix
specifc RPC that does "copy factory-config running-config".  We give
sysrepocfg some time to clean up any stale SHM connections before we
do a hard scratch of the db state and restart sysrepo-plugind.

Fixes #429

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz 9df97d9a1b patches/sysrepo: add support for non-zero exit code from syrepocfg
This local patch of sysrepo adds support for detecting non-zero return
code from sysrepo callbacks during SR_EV_DONE, which upstream sysrepo
currently, as of v2.2.105, discards.

With this change failure to load startup-config results in the system
detecting the failure applying failure-config instead.

Fixes #429

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz d0cfe429c4 confd: fix regression, loss of admin account after upgrade to v24.04
Fix regression introduced in 3f87945, which tries to map a user to an
existing home directory.  The root cause for the problem is basically an
invalid check of the /home/admin UID being in use by any system account
or not.  This patch uses the same check used by the BusyBox adduser
command.

In addition to the uid-already-in-use fix, several other checks have
been added to ensure we do not end up with an invalid system state:

 - If reusing an existing /home/admin fails in the 'adduser admin'
   command, wipe out /home/admin and retry adding the user cleanly
 - Always delete any group with the same name before trying to add
   the user, regardless if /home/$user exists or not, this prevents
   issues with stale group records if we end up failing to load the
   startup-config and need to load failure-config
 - For the same reason (failure-config), make sure to always clean
   up any stale user in the retry step.  The same step is used when
   there is a uid:gid mismapping (the original bug)

Fixes #428

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz adf37394f4 confd: follow-up to 2412fff3, simplify chown of startup-config
Instead of having a chown process started by Finit in runlevel S, we can
just chown in the confd load script instead.

Issue #415

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz bc020436e7 confd: increased severity for log messages caught on stdout/stderr
Error messages from system() calls, like adduser, should be logged with
severity LOG_ERR to not arrive out of sequence with ERROR() messages.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz ad8a74fa7b confd: minor, fix variable shadowing
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz 3315a46423 confd: minor, skip shell update when deleting user
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz 334d222f7c confd: minor, logging cleanup
- Drop unnecessary \n
 - Drop needless ERROR() message triggered when deleting users

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz d624203815 confd: minor, match syslog tag with other log messages
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz ab21eff6c8 confd: minor, use initial hostname from /etc/os-release as fallback
Instead of hard-coding the fallback hostname we can now use the one
generated to /etc/os-release (for netbrowse).

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Jon-Olov Vatnandjovatn a05e28d349 Updating text after feedback.
I found similar error in other parts of the doc, as well
as some typos, and fixed them there too.

[skip ci]
2024-05-13 07:50:34 +02:00
Jon-Olov Vatnandjovatn 81c8f1c944 Fixing more typos.
[skip ci]
2024-05-13 07:50:34 +02:00
Jon-Olov Vatnandjovatn d039d9fc2b Fix typo.
[skip ci]
2024-05-13 07:50:34 +02:00
Jon-Olov Vatnandjovatn e1dd636ed0 Update link list and fixing typo.
[skip ci]
2024-05-13 07:50:34 +02:00
Jon-Olov Vatnandjovatn c4236eaa80 Yet another try for anchors for cross-references 2024-05-13 07:50:34 +02:00
Jon-Olov Vatnandjovatn a8c47779a2 New try for explicit anchors for cross-references
[skip ci]
2024-05-13 07:50:34 +02:00
Jon-Olov Vatnandjovatn 3178d5aae4 Adding script examples for production tests
- reading out eeprom/vpd data
- led testing
- power supply testing
- ethernet port test (example for looping ports)

[skip ci]
2024-05-13 07:50:34 +02:00
Tobias Waldekranz e63256edbb cn9130-crb: Document bootstrapping procedure 2024-05-07 15:34:47 +02:00
Tobias Waldekranz 68a0b289d2 board/aarch64: Separate board specific documentation
This should make it easier to find what you're after as the number of
supported boards increase.
2024-05-07 15:34:47 +02:00
Tobias Waldekranz 8a7eb80878 cn9130-crb: Set Infix default password
Since we don't have any VPD defined on this board, supply a default
password hash via the device tree instead.

Also, specify the path to external USB port, so that Infix will pick
it up in ietf-hardware.
2024-05-07 15:34:47 +02:00
Tobias Waldekranz 473d48097c cn9130-crb: Enable eth2, avoid polling of SFP io lines
Provide a patched device tree that:

- Uses the correct phy-mode for eth2, allowing it to be probed
  properly

- Wires up the interrupt signal to the GPIO expander, so that the SFP
  cage's I/O lines can be configured as interrupts, rather than having
  to poll them
2024-05-07 15:34:47 +02:00
Tobias Waldekranz 50a9bba1c7 board/common: fdisk: Allow reformatting of disks
Assume that the caller always want to create a new partition table,
even in scenarios where one already exists. This allows devices to be
reprovisioned with a newer image, for example.

Fixes #394
2024-05-07 15:34:47 +02:00
Tobias Waldekranz 21ab842357 board/common: Fix incorrect path to /etc/partition-uuid
While we're here, fix some whitespace nits.
2024-05-07 15:34:47 +02:00
Tobias Waldekranz b5abcc8af9 cn9130-crb: Add a small bootdelay in U-Boot
This is not a production target, so we choose the more developer
friendly option of allowing the boot process to be interrupted.

Also, remove the old update cruft and rely on Marvell's `bubt`
instead.
2024-05-07 15:34:47 +02:00
Tobias Waldekranz ca968c7d87 cn9130-crb: Switch to using SPI FLASH for bootloader storage
The BootROM wants the bootloader to be located on LBA1, which is not
ideal when using a GPT to describe the partition table.

Make sure the `bubt` command targets SPI by default.
2024-05-07 15:34:47 +02:00
Tobias Waldekranz d96f3ae2e9 defconfig: cn9130_crb_boot: Pin ATF version after Buildroot update
Buildroot's default ATF version changed from 2.9 to 2.10 when we
upgraded to 24.02.x. This meant that our patches were not applied,
which broke the build.

Take a conservative approach for now, and just pin the ATF version to
the known-good 2.9 series.
2024-05-07 15:34:47 +02:00
Tobias Waldekranz f45e1d57a0 defconfig: cn9130_crb_boot: Restore image signing functionality
During the addition of multi-key support to RAUC and U-Boot, the
bootloader defconfig for CN9130 CRB was overlooked, which meant that
the Infix specific U-Boot hooks never ran, thereby ultimately breaking
the build.

Restore the required options to build in the dev-key by default.
2024-05-07 15:34:47 +02:00
Joachim Wiberg f5b0f37386 confd: rename 10-infix-system.json -> 10-infix-services.json
Mislabled from the start, the file holds default services.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-05 18:20:03 +02:00
Joachim Wiberg f0205b0a35 board/common: document reserved syslog facilities
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-05 18:15:03 +02:00
Joachim Wiberg 80659ef299 Final ChangeLog update for v24.04.1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-03 17:06:15 +02:00
Joachim Wiberg 59b3e583f1 doc: update build deps, bison needed new uboot-tools
The Buildroot 2024.02.x-kkit branch recently had uboot-tools upgraded
and the patches needed require bison to rebuild.

The recommendation is to also install flex, they always go together.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-03 17:03:03 +02:00
Joachim WibergandMattias Walström 6a8eaacc6e Replace python + rust based gencert2 with C based gencert3
Also, sync r2s_defconfig with latest major changes.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-03 15:33:00 +02:00
Joachim WibergandMattias Walström 6b8bd4caf3 package/gencert: new package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-03 15:33:00 +02:00
Joachim WibergandMattias Walström 39f868fc61 gencert: C replacement for python+rust gencert
Smaller, fewer dependencies, and quicker to cross-compile.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-03 15:33:00 +02:00
Joachim WibergandMattias Walström be1c00f469 package/factory: add checksum for LICENSE
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-03 15:33:00 +02:00
Joachim WibergandMattias Walström 71e63de0c1 execd: minor, drop dummy line from configure summary
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-03 15:33:00 +02:00
Tobias WaldekranzandJoachim Wiberg 6c1c31e5c0 doc: testing: Document how to use deterministic topology mappings 2024-05-03 14:44:54 +02:00
Tobias WaldekranzandJoachim Wiberg a2906acdf7 test: Optionally use deterministic topology mappings
Due to the salting being applied to Python's `hash()` (see [1]), the
hash of an object is not stable across different Python processes. As
a result, neither are the topology mappings generated by networkx.

The upside of this is randomness that we get better test coverage over
time, especially on physical devices where the underlying hardware
could differ between ports, for example.

On the other hand, it can be very frustrating to track down a bug when
locial nodes are suffled around between phyical nodes on each
invocation of a test case.

Therefore, use a random seed by default, but allow the user to specify
a fixed value if they so choose. We then add a meta test that logs the
seed being used for the current suite - which means we can simply
copy&paste that value to rerun the suite (or single test) with the
same topology mappings.

[1]: https://docs.python.org/3/reference/datamodel.html#object.__hash__
2024-05-03 14:44:54 +02:00
Tobias WaldekranzandJoachim Wiberg 753f3806a1 test: Improve efficiency of logical to physical topology matching
- Present the topologies to networkx as multigraphs, rather than
  expaning each port of the record shape as a separate node.

- Create a topology mapping by locating a subgraph monomorphism of the
  logical topology in the physical ditto.

This cuts down the time of finding a mapping by several orders of
magnitude. Example:

Before:

time python3 test/infamy/topology.py \
     	     test/virt/quad/topology.dot.in \
	     test/infamy/topologies/ring-4-duts.dot >/dev/null

real    13m1,213s
user    13m0,112s
sys     0m0,732s

After:

time python3 test/infamy/topology.py \
     	     test/virt/quad/topology.dot.in \
	     test/infamy/topologies/ring-4-duts.dot >/dev/null

real    0m0,153s
user    0m0,128s
sys     0m0,024s
2024-05-03 14:44:54 +02:00
Joachim WibergandTobias Waldekranz 2a218ce6e9 doc: update ChangeLog for v24.04.1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-03 07:54:48 +02:00
Joachim WibergandTobias Waldekranz 474820c44b Fix #424: regression, root user can log in without password
This fixes a serious security regression introduced late in the v24.04
release cycle.  The root cause is the placement of the shadow file in
the rootfs overlay, which causes any changes made by the Buildroot
setting BR2_TARGET_ENABLE_ROOT_LOGIN to be discarded/overwritten just
before creating the squashfs image.

The fix in this commit relocates all files from b4eb450 to the skeleton
in Infix, package/skeleton-init-finit/skeleton/etc, which is one of the
first packages to be installed when starting a build.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-03 07:54:48 +02:00
Joachim WibergandTobias Waldekranz 9609fc144d confd: add timestamps to dagger .log files
Sample output:

    root@infix-00-00-00:~# cat /run/net/0/action/init/lo/45-init.sysctl.log
    May 02 13:45:58 net.ipv6.conf.lo.autoconf = 1
    May 02 13:45:58 net.ipv6.conf.lo.dad_transmits = 1
    May 02 13:45:58 net.ipv6.conf.lo.temp_prefered_lft = 86400
    May 02 13:45:58 net.ipv6.conf.lo.temp_valid_lft = 604800
    May 02 13:45:58 [exit:0]

Fixes #374

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-03 07:54:48 +02:00
Joachim WibergandTobias Waldekranz a0df130852 board/common: relocate dagger script to confd tree
The dagger tool is a helper for scripts generated by confd and should
therefore be installed by confd instead of the rootfs overlay.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-03 07:54:48 +02:00
Joachim WibergandTobias Waldekranz 22c911f85e package/landing: new package
Relocate the default landing page from the rootfs overlay to a package
so that customer repos can override it.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-03 07:54:48 +02:00
Tobias WaldekranzandJoachim Wiberg 3d8b64f939 aarch64: kernel: Enable DCB
In order to make use of the DCB support in mv88e6xxx we also enable it
in the kernel config.

Fixes: 3a73ce3cfb ("kernel: Import EtherType based priority override support")
2024-05-02 15:30:02 +02:00
Joachim Wiberg 1176560bb2 package/python-statd: update LICENSE hash
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-01 17:44:26 +02:00
Joachim Wiberg ec4a311f47 package/statd: update LICENSE hash
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-01 17:42:38 +02:00
Joachim Wiberg 7fd746e56f doc: add markdown link to v24.04.0 diff
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-01 15:17:50 +02:00
Joachim Wiberg 258368d814 .github: drop build in /mnt workaround for release build
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-01 15:16:11 +02:00
Joachim Wiberg 9dfb0ea1f1 doc: update ChangeLog for v24.04
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-01 12:35:13 +02:00
Joachim Wiberg 3408f02709 doc: follow-up to aaaad535, ACLs for guest and operator dropped
As mentioned previously, the NACM default ACLs in `factory-config` were
removed as part of the work on the nacm-basic branch.

Adjust text to not mention any pre-configured user levels, for now.  A
future update may change the defaults when we've found resonable levels.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-01 11:09:01 +02:00
Joachim Wiberg b557d69b8a package/confd: follow-up to 2412fff, chown only in runlevel S
Run chown only at bootstrap, after confd has started and we've loaded
startup-config.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-01 11:08:50 +02:00
Joachim Wiberg 3a2579ec9e board/common: follow-up to bb18afa, adjust qemu.sh interface names
This adjusts the name of the first interface in all network modes, not
just tap, for consistency.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-01 11:08:36 +02:00
Joachim Wiberg ab3a09b260 board/x86_64: follow-up to c637ab4, allow console also on ttyS0
Fixes #419

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-01 10:45:17 +02:00
Tobias Waldekranz f1d21a4bae uboot: Install all trusted keys into U-Boot's control DT
Now that RAUC can have multiple keys in its keyring, we should include
the same set of keys in the bootloader.
2024-04-30 16:03:09 +02:00
Tobias Waldekranz 6e4aa0d7be buildroot: Bump to latest 2024.02.x-kkit for new uboot-tools 2024-04-30 16:03:09 +02:00
Joachim WibergandTobias Waldekranz 0629022b1f confd: minor, adjust log levels and drop duplicate log messages
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz cffaf71d6e board/common: generate a small aux partition for 'make run'
This patch helps silence kernel errors to console at boot.  To fully
silence errors, enable emulated /var in your Qemu runs as well.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz d1b0f69e18 board/common: minor, whitespace
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz fe33d0d733 patches/linux: adjust log level for unauthorized usb devices
The fact that a USB device currently is not authorized is not an error.
This patch adjusts the log level to slip below 'quiet' to prevent logs
to console at boot.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz aaaad53549 doc: new section, multiple users, and multiple admins
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz 053d9c2131 test: reenable infix-services test with a link toggle
Since we do not yet have lldpTxFast, or similar, to enable on LLDP, we
tickle both services to resend their HELLO frames on link down/up event
instead.

 + Reduces turnaround times drastically
 + Restore regression test for mDNS, which we lost recently

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz db628ee3f3 test: revert back to tcpdump output format when reading pcap
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz dee36ce801 confd: fix mDNS service type generation
In the 34fa6a3 refactor we lost announcement of mDNS completely:

 - The type of all services was set to 'all', instead of, e.g., _ssh._tcp
 - The web console service was not added properly
 - Web services for plain HTTP/HTTPS were not created at all

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz 3f87945f75 confd: map new users to existing home directories
UNIX home directories are persistent across reboots, but user accounts
are not.  If multiple users exist in startup-config and one or more are
removed, we must use the UID of their $HOME on the next reboot to ensure
they do not lose their files.

If a home directory exists and its UID is already in /etc/passwd we have
triggered an unsupported use-case and must remove the home directory on
disk before recreating it empty.  This should not happen, but may occur
on upgrades from a time before UIDs started at 1000 and instead shared
the UID range with reserved system accounts.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz fbeeed7a2c confd: refactor add/remove user from UNIX sysadmin group (wheel)
In review discussions we've decided to go for Augeas to modify the file
/etc/group instead of relying on the BusyBox tools adduser and delgroup,
which check for the existence of the user in /etc/passwd -- which we, at
the point in time the NACM callback runs, cannot guarantee.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz b03db7f994 confd: disable shell for non-admin users
A user that is not part of the 'admin' group may only have /bin/false or
/bin/clish as login shells for ssh/console.  Any POSIX shell is reserved
for administrators.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz 26820111f7 confd: add basic support for nacm
This patch adds basic NACM support to detect users assigned to a group
granting full access privileges.  Full privileges require membership of
at least one group listed in an ACL rule with:

   module-name=*
   access-operations=*
   action=permit

This matches the `admin-acl` rule in factory-config, which the 'admin'
group is part of, and in turn the 'admin' *user* is a member of.

Also, drop unused guest and limited ACLs from factory-config.  Added
from the RFC as an example, but is likely more confusing than helpful.

Note: this does not add all NACM groups to the system, it maps users
      with administrator privileges to the UNIX 'wheel' group, which
      grants access to all IPC sockets (klish, finit, mctl), and sudo
      access to all other parts of the system.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz e395c90958 confd: create admin user without -S flag to adduser
After the upgrade to Buildroot 2024.02 a new system user was added to
/etc/passwd, sshd.  Used for drop-privs sshd.  This caused files that
were previously owned by the 'admin' user to now be owned by 'sshd'.

This patch drops the `-S` flag from adduser for the adin user, ensuring
no future clashes with system system users and instead mapping the uid
to a range starting from uid 1000 (default for BusyBox adduser).

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz 969ec1dd11 board/common: drop operator and staff, add backup user and group
- Free up 'operator' and 'staff' groups for NETCONF use
 - Reserve 'backup' user and group for future auto-backup (Debian)

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz a972966a02 board/common: override default Buildroot passwd and group files
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Joachim WibergandTobias Waldekranz 1d7eeb5c53 doc: minor, follow-up to scripting.md
Drop sysrepocfg commands from first section.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-30 15:51:17 +02:00
Tobias Waldekranz 5e2475c742 confd: Avoid needless Ethernet flow-control reconfigurations
Unless some configuration has changed that affects flow-control (only
auto-neg for now, until we allow actual configuration of flow-control
itself), do not issue any commands that might trigger a link down/up
cycle.

Additionally, make sure that we always configure it on boot, as the
driver defaults might not necessarily line up with our defaults.
2024-04-29 14:31:40 +02:00
Tobias Waldekranz 824b911f49 confd: Unify determination of Ethernet auto-negotiation config
As detailed in the block comment in iface_uses_autoneg(), we make some
special considerations around this, so make sure we always reach the
same conclusion.
2024-04-29 14:31:40 +02:00
Joachim WibergandTobias Waldekranz 66ae2eb2e8 Update src/confd/src/ietf-interfaces.c
Co-authored-by: Tobias Waldekranz <tobias@waldekranz.com>
2024-04-29 14:31:40 +02:00
Joachim WibergandTobias Waldekranz f5408d9fbc doc: update ChangeLog with latest fixes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 14:31:40 +02:00
Joachim WibergandTobias Waldekranz 0f7983008e confd: allow admin user to send factory reset rpc using sysrepocfg
Fixes #416

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 14:31:40 +02:00
Joachim WibergandTobias Waldekranz 2412fff39c confd: ensure correct ownership of startup-config after factory reset
Fixes #415

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 14:31:40 +02:00
Joachim WibergandTobias Waldekranz 809e6b44be confd: spellcheck infix-hardware.yang
Fixes #414

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 14:31:40 +02:00
Joachim WibergandTobias Waldekranz 7c7b9ee1f6 confd: fix missing support for globally disable dhcp client
Fixes #412

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 14:31:40 +02:00
Joachim WibergandTobias Waldekranz 132dca844a board/common: disable lldpd on dsa0 interface
Fixes #404

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 14:31:40 +02:00
Joachim WibergandTobias Waldekranz 8a007d61d0 Disable Ethernet flow-control completely by default
We have previously stated configuration and status flow-control as not
supported, see infix-ethernet-interface.yang.  This is also the default
for flow-control in the ieee-ethernet-interface.yang model.

This patch change the actual value to disabled, so that devices properly
advertise flow-control as disabled/not-supported in auto-negotiation.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 14:31:40 +02:00
Jon-Olov VatnandJoachim Wiberg c58a624a51 Updating scripting file with sysrepo examples
[skip ci]
2024-04-29 11:09:01 +02:00
Jon-Olov VatnandJoachim Wiberg 9326812430 Updating sysrepocfg scripting examples
[skip ci]
2024-04-29 11:09:01 +02:00
Jon-Olov VatnandJoachim Wiberg 9bf4f1d982 Adding sysrepocfg examples
Initial examples added.
More can be done to show how config files are transferred to infix.

[skip ci]
2024-04-29 11:09:01 +02:00
Joachim Wiberg d722b108dc .github: let Coverity Scan run on GitHub infra
Our local runners do not allow sudo, e.g., when installing libyang and
the other dependencies.

[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 11:08:27 +02:00
Joachim WibergandTobias Waldekranz d1a7e1d744 .github: revert massive-parallel builds and select new runners
The massive-parallel build change added recently is a bit shaky still,
so while we stabilze that, we revert it and also take the oppportunity
to tag the new build server.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 08:44:44 +02:00
Joachim WibergandTobias Waldekranz 286d5e9c0d .github: cleanup and minor changes for consistency.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 08:44:44 +02:00
Joachim WibergandTobias Waldekranz 7dc0542d01 test/virt: override default Qeneth OUI
Over the lifetime of Infix, so far, we've run into at least one customer
issue where we had qualms about our use of the local bit causing issues
with 3rd party software.  In the end that was not the root cause of our
problems, but we spent way too much time worrying about it.  Hence this
patch, which brings our virtual environments another step closer to the
real hardware that Infix runs on.

The OUI used is one of the "private" ones, taken completly at random.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 08:44:44 +02:00
Joachim WibergandTobias Waldekranz 0480d0f16b test/virt: rename according to new interface naming standard
Ethernet ports start with 'e'
Port numbers start with '1'

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 08:44:44 +02:00
Joachim WibergandTobias Waldekranz 59f81e9391 test/qeneth: bump for new mac ranges and mactab support
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 08:44:44 +02:00
Joachim WibergandTobias Waldekranz 3f2ead2528 doc: update list of required packages
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 08:44:44 +02:00
Joachim WibergandTobias Waldekranz 3f1c360287 doc: add section on multicast filtering and snooping
Final work item for the Infix bridge MDB support epic.

Fixes #334

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 08:44:44 +02:00
Joachim WibergandTobias Waldekranz c3a227289d confd: allow setting factory hostname from qemu_fw_cfg
This patch adds support for overriding the default hostname generation
on Qemu systems with the /sys/firmware/qemu_fw_cfg/by_name/opt/hostname
file.  E.g., virtual Infamy test systems using Qeneth.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 08:44:44 +02:00
Joachim WibergandTobias Waldekranz bb18afa883 board/common: probe system base mac also on qemu systems
The base mac address is used by bridges in Infix.  This patch adds
support for extracting a base mac from the first interface "- 1",
e.g., if the mac address of e1 is 08:00:20:00:00:01, the base mac
will be 08:00:20:00:00:00.

This works with the Infamy test framework (Qeneth) and also with
the qemu script, included in this patch.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 08:44:44 +02:00
Joachim WibergandTobias Waldekranz adab286bf9 board/common: ensure /run/system.json is readable only wheel group
Writable by root, readble only by wheel members, e.g. admin.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 08:44:44 +02:00
Joachim WibergandTobias Waldekranz b993c8daa7 board/common: minor, fix a few pylint warnings
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 08:44:44 +02:00
Joachim WibergandTobias Waldekranz e59bab16c0 confd: set mcast_vlan_snooping and correct IGMP/MLD versions
As described in issue #396, multicast filtering on VLAN filtering
bridges did not work at all.  This because bridge_mcast_settings()
exited when no global multicast settings were found -- a change to
the YANG model made previously triggered this fauled behavior.

Also, the initial IGMP/MLD versions were set to 2/1 (kernel default)
instead of 3/2 (Infix default).

Fixes #396

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 08:44:44 +02:00
Joachim WibergandTobias Waldekranz 4ce1be6f0a package/mcd: bump from v2.1 to v2.3
For a full ChangeLog, see:

  - https://github.com/kernelkit/mcd/releases/tag/v2.2
  - https://github.com/kernelkit/mcd/releases/tag/v2.3

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 08:44:44 +02:00
Mattias Walström a0804b15fe Add possibility to have multiple trusted certificates
Today, only one certificate is shipped with infix, it is
selectable in menuconfig. It is also possible to add extra
certificates, useful when using infix as a submodule.
2024-04-25 13:29:24 +02:00
Tobias Waldekranz 886132600a kernel: Import 6393X fixes
- Isolation of ports in standalone mode was broken in multi-chip trees
- Let the CPU send FORWARDs to IEEE reserved L2 groups
2024-04-25 11:24:19 +02:00
Joachim Wiberg b5c0bfea62 .github: relocate all builds to self-hosted runners
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-25 09:20:32 +02:00
Joachim Wiberg c3900ec710 confd: allow VLAN interfaces as bridge ports
Fixes #406

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-25 09:20:32 +02:00
Joachim Wiberg 4fb7969de8 execd: install into /lib/tmpfiles.d
The CNI directories must be created before the podman tmpfiles
are called, so move our tmpfiles to /lib/tmpfiles.d

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-25 09:20:32 +02:00
Joachim Wiberg dcd7cb1a77 package/sysklogd: backport fix for kernel logs to console
- Backport fix to allow raw kernel logs to console
 - Save 10 rotated (and gzipped) backups of all logs

The latter change was discussed a few weeks ago.  We determined it was a
safe number since all active products have eMMC with *lots* of storage.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-25 09:20:32 +02:00
Joachim Wiberg 8f8805a1ee package/finit: backport support for allowing kernel logs to console
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-25 09:20:32 +02:00
Joachim Wiberg c21c94f851 package/finit: backport fix for tty @console
Only the first listed console in /sys/class/tty/console/active starts
properly, the remaining one(s) were registered using the wrong :ID and
no arguments to getty.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-25 09:20:32 +02:00
Mattias Walström 45cc13ccfe statd: Add libyang as dependancy 2024-04-24 21:10:05 +02:00
Mattias Walström 096b7edee2 confd: add libglib2 as a dependency 2024-04-24 21:10:05 +02:00
Mattias Walström 6f962fcadf libsrx: add libite dependancy 2024-04-24 21:10:05 +02:00
Mattias Walström fef8dd5072 Enable parallell build of packages
Build all packages in parallell to cut building time.
2024-04-24 21:10:05 +02:00
Mattias Walström 9cd7737d7e Change to self-hosted runner 2024-04-24 21:10:05 +02:00
Mattias WalströmandJoachim Wiberg 2f61aaaaf8 Revert "Change to self-hosted runner"
This reverts commit b2fef1585f.
2024-04-23 21:05:35 +02:00
Mattias WalströmandJoachim Wiberg dcc80d0d8a Allow to run testsystem using disk image
This will run the testsystem with a disk
image containing grub bootloader.
2024-04-23 16:24:18 +02:00
Mattias WalströmandJoachim Wiberg c637ab4edb grub: Use same console for qeneth and make run
Console is now located on hvc0
2024-04-23 16:24:18 +02:00
Mattias WalströmandJoachim Wiberg 4add90e601 qemu: Synchronize with qeneth setting for console
Change default console to hvc0 (same as qeneth)
This is the only working console for now.
2024-04-23 16:24:18 +02:00
Mattias WalströmandJoachim Wiberg 72fe0ac963 Bump qeneth to add new infix templates
Adds infix-kernel-x86_64
and infix-bios-x86_64
2024-04-23 16:24:18 +02:00
Tobias WaldekranzandJoachim Wiberg c9a30d20cb board/aarch64: alder: Use in-band-status on USXGMII links
This avoids the issue with unidirectional links described in the
parent commit.
2024-04-23 07:57:32 +02:00
Tobias WaldekranzandJoachim Wiberg d36899b49e kernel: Import mv88e6xxx in-band-status fix
Even when `managed = "in-band-status";` was specified on a port,
mv88e6xxx would insist on forcing the values that were supposed to be
automatically picked up by the MAC via in-band signaling.

In the case of USXGMII links on 6393X, forcing the link bit would
sometimes, for reasons that are not understood, cause the SERDES to
reset its USXGMII link partner base page (register 4.0xf0a2) to 0,
which it would then interpret as 10M/half-duplex. As a result, the
SERDES would erroneously perform rate-matching to 10M on egress
towards the PHY (which is configured for 10G/full-duplex), leading to
nothing but dropped packets and much sadness.

This can most easily be reproduced by the following setup:

.------------.
|        .-----.   .-------.
|        | p9  +---+ 3310P +--.
| 6393X  :-----:   :-------:  | T- or X-Units looped via external cable
|        | p10 +---+ 3310P +--'
|        '-----'   '-------'
'------------'

Make sure that neither p9 nor p10 are managed using in-band-status.

1. ip link set dev p9 up; ip link set dev p10 up
2. ip link set dev p9 down
3. ip link set dev p9 up

After step (3), p10 will experience the failure described above in
about 3/4 of the cases. In the cases where the issue does not arise,
simply repeat steps (2) and (3).
2024-04-23 07:57:32 +02:00
Mattias WalströmandTobias Waldekranz 9b02782f57 Build: Fix recursive dependency in statd and python-statd 2024-04-22 14:22:50 +02:00
Mattias WalströmandTobias Waldekranz ced93c89c7 grub: Select root partion from UUID 2024-04-22 14:22:50 +02:00
Mattias WalströmandTobias Waldekranz e6def82be1 grub2: Add patch to add search by partition uuid 2024-04-22 14:22:50 +02:00
Mattias WalströmandTobias Waldekranz f36f805a77 grub2: Require to run autogen.sh before configure 2024-04-22 14:22:50 +02:00
Tobias WaldekranzandJoachim Wiberg 36716dab42 utils: ixll: Add link-local wrappers for ping/ssh/scp 2024-04-19 15:25:02 +02:00
510 changed files with 20930 additions and 5857 deletions
+36 -20
View File
@@ -11,7 +11,7 @@ Talking about code and problems first is often the best way to get started
before submitting a pull request.
When submitting a bug report, patch, or pull request, please start by
stating the version the change is made against, what it does, and why.
stating the version the change is made against, what it does, *and why*.
Please take care to ensure you follow the project coding style and the
commit message format. If you follow these recommendations you help
@@ -21,13 +21,28 @@ the maintainer(s) and make it easier for them to include your code.
Coding Style
------------
> **Tip:** Always submit code that follows the style of surrounding code!
Before jumping into code, remember to **document new features** and bug
fixes. Both the manual and ChangeLog are in the `doc/` sub-directory
and it is expected that you provide a human-readable summary for the
release notes (ChangeLog) and at least a configuration example in the
manual for new features.
First of all, lines are allowed to be longer than 72 characters these
days. In fact, there exist no enforced maximum, but keeping it around
100 chars is OK.
> **Tip:** consider ["Readme driven development"][RDD] for new features.
> It is amazing how many flaws in your own bright ideas come to bare
> when you suddenly have to explain them to someone else!
The coding style itself is otherwise strictly Linux [KNF][].
We expect code contributions for:
- C code in [Linux Coding Style][Linux]
- Python code should follow [PEP-8][]
> **However,** always submit code that follows the style of surrounding
> code! Legacy takes precedence, and remember, we read code a lot more
> than write it, so legibility is important.
As a final note, lines are allowed to be longer than 72 characters these
days. There is no enforced maximum, but the team usually keep it around
100 characters for both C and Python.
Commit Messages
@@ -37,22 +52,21 @@ Commit messages exist to track *why* a change was made. Try to be as
clear and concise as possible in your commit messages, and always, be
proud of your work and set up a proper GIT identity for your commits:
git config --global user.name "Jane Doe"
git config --global user.email jane.doe@example.com
$ git config --global user.name "Jacky Linker"
$ git config --global user.email jacky.linker@example.com
Example commit message from the [Pro Git][gitbook] online book, notice
how `git commit -s` is used to automatically add a `Signed-off-by`:
Brief, but clear and concise summary of changes
subsystem: brief, but clear and concise summary of changes
More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as
the subject of an email and the rest of the text as the body. The
blank line separating the ummary from the body is critical (unless
you omit the body entirely); tools like rebase can get confused if
you run the two together.
empty line separating summary from body is critical. Tools like
rebase can get confused if the empty line is missing.
Further paragraphs come after blank lines.
Further paragraphs should be separated with empty lines.
- Bullet points are okay, too
@@ -60,17 +74,19 @@ how `git commit -s` is used to automatically add a `Signed-off-by`:
by a single space, with blank lines in between, but conventions
vary here
Signed-off-by: Jane Doe <jane.doe@example.com>
Signed-off-by: Jacky Linker <jacky.linker@example.com>
Code of Conduct
---------------
It is expected of everyone to respect the [Code of Conduct][conduct].
The *"maintainers have the right and responsibility to remove, edit,
or reject comments, commits, code, wiki edits, issues, and other
contributions that are not aligned to this Code of Conduct."*
The *"maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, discussion forum threads, issues, and
other contributions that are not aligned to this Code of Conduct."*
[KNF]: https://en.wikipedia.org/wiki/Kernel_Normal_Form
[gitbook]: https://git-scm.com/book/ch5-2.html
[conduct]: CODE-OF-CONDUCT.md
[Linux]: https://www.kernel.org/doc/html/v6.9/process/coding-style.html
[PEP-8]: https://peps.python.org/pep-0008/
[RDD]: https://tom.preston-werner.com/2010/08/23/readme-driven-development
[gitbook]: https://git-scm.com/book/ch5-2.html
[conduct]: CODE-OF-CONDUCT.md
+69
View File
@@ -0,0 +1,69 @@
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
name: "\U0001F41E Bug report"
description: Create a bug report
labels:
- "bug"
- "triage"
body:
- type: markdown
attributes:
value: |
**Thank :heart: you for taking the time to fill out this bug report!**
We kindly ask that you search to see if an issue [already exists](https://github.com/kernelkit/infix/issues?q=is%3Aissue+sort%3Acreated-desc+) for the bug you encountered.
- type: textarea
attributes:
label: Current Behavior
description: |
A clear and concise description of the issue you're experiencing.
value: |
For code snippets, logs, commands, etc., please use triple backticks:
```
admin@infix-c0-ff-ee:/> show log
May 15 07:21:02 infix-00-00-00 container[3192]: Failed creating container test from curios-httpd-v24.03.0
- (press h for help or q to quit)
```
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: |
A clear and concise description of what you expected to happen.
value: |
```
admin@infix-c0-ff-ee:/> show log
May 15 07:21:02 infix-c0-ff-ee container[3192]: Successfully created container test from curios-httpd-v24.03.0
- (press h for help or q to quit)
```
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: |
Steps to reproduce the issue. For example:
1. Built from source
2. Upgrade to latest release, vYY.MM.P
3. Factory reset
4. Enable feature
5. Check the logs/show command/operational status
validations:
required: false
- type: textarea
attributes:
label: Additional information
description: |
- Relevant parts of `startup-config`
- Output from `show interfaces`, if applicable
- Other observations, screenshots, log files ...
**Tip:** You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
+7
View File
@@ -0,0 +1,7 @@
contact_links:
- name: "🔍 Look for my Issue"
url: https://github.com/kernelkit/infix/issues?q=is%3Aissue+sort%3Acreated-desc+
about: Thank ❤️ you for your time! We kindly ask that you first check if an issue already exists.
- name: "💬 Discussions and Q&A"
url: https://github.com/kernelkit/infix/discussions
about: Discussions are perfect for quick questions, bouncing ideas, and things that may be a bug.
@@ -0,0 +1,45 @@
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
name: "\U0001F6E0 Feature request"
description: Suggest a new feature, idea or improvement of the OS
labels:
- "feature"
- "triage"
body:
- type: markdown
attributes:
value: |
**Thank :heart: you for taking the time to fill out this feature request!**
We kindly ask that you search to see if an issue [already exists](https://github.com/kernelkit/infix/issues?q=is%3Aissue+sort%3Acreated-desc+) for your feature. We are also happy to accept contributions from our users. For details see [CONTRIBUTING](https://github.com/kernelkit/infix/blob/master/.github/CONTRIBUTING.md).
- type: textarea
attributes:
label: Description
description: |
A clear and concise description of the problem or missing feature.
**Example:** *I'm always frustrated when [...]*, or *I'd like to see support for [...]*
validations:
required: true
- type: textarea
attributes:
label: Additional Information
description: |
Any other related information, e.g. existing YANG model(s), or possibly screenshots about the feature request here.
validations:
required: false
- type: textarea
attributes:
label: General Information
description: |
Appended to all feature requests for future readers.
value: |
Anyone can help out by [sponsoring][1] development of new features or [contributing][2] pull requests.
Please use this issue for discussions related to the feature.
[1]: https://github.com/kernelkit/infix/blob/main/.github/SUPPORT.md
[2]: https://github.com/kernelkit/infix/blob/main/.github/CONTRIBUTING.md
validations:
required: true
+1 -7
View File
@@ -1,5 +1,3 @@
<!--- **Summarize** your changes in the title above -->
## Description
<!--
@@ -15,7 +13,7 @@
## Checklist
Tick relevant boxes, this PR is-a or has-a:
Tick *relevant* boxes, this PR is-a or has-a:
- [ ] Bugfix
- [ ] Regression tests
@@ -31,7 +29,3 @@ Tick relevant boxes, this PR is-a or has-a:
- [ ] Documentation content changes
- [ ] Other (please describe):
## References
<!-- Please list references to related issue(s) -->
+88 -33
View File
@@ -1,6 +1,7 @@
name: Bob the Builder
on:
pull_request:
push:
branches:
- main
@@ -8,30 +9,32 @@ on:
jobs:
build:
name: Build Infix ${{ matrix.platform }}
runs-on: ubuntu-latest
name: Build Infix ${{ matrix.target }}
runs-on: [ self-hosted, latest ]
strategy:
matrix:
platform: [aarch64, x86_64]
target: [aarch64, x86_64]
fail-fast: false
steps:
- name: Maintenance
- name: Cleanup Build Folder
run: |
docker image prune -af
docker volume prune -f
docker container prune -f
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
- uses: actions/checkout@v4
with:
clean: true
submodules: recursive
- name: Set Build Variables
id: vars
run: |
target=${{ matrix.platform }}
target=${{ matrix.target }}
echo "dir=infix-$target" >> $GITHUB_OUTPUT
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
if [ "$target" = x86_64 ]; then
echo "out=$PWD/output" >> $GITHUB_OUTPUT
else
echo "out=/mnt/x-$target" >> $GITHUB_OUTPUT
fi
- name: Restore Cache of dl/
uses: actions/cache@v4
with:
@@ -39,42 +42,86 @@ jobs:
key: dl-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
restore-keys: |
dl-
- name: Restore Cache of .ccache/
uses: actions/cache@v4
with:
path: .ccache/
key: ccache-${{ matrix.platform }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
key: ccache-${{ matrix.target }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
restore-keys: |
ccache-${{ matrix.platform }}-
ccache-${{ matrix.target }}-
ccache-
- name: Configure & Build
- name: Configure ${{ matrix.target }}
run: |
target=${{ matrix.platform }}_defconfig
echo "Building $target ..."
sudo mkdir ${{ steps.vars.outputs.out }}
sudo chown $(id -un):$(id -gn) ${{ steps.vars.outputs.out }}
export O=${{ steps.vars.outputs.out }}
make $target
make ${{ matrix.target }}_defconfig
- name: Unit Test ${{ matrix.target }}
run: |
make test-unit
- name: Build ${{ matrix.target }}
run: |
echo "Building ${{ matrix.target }}_defconfig ..."
make
- name: Prepare Artifact
- name: Check SBOM from Build
run: |
cd ${{ steps.vars.outputs.out }}
make legal-info
- name: Prepare ${{ matrix.target }} Artifact
run: |
cd output/
mv images ${{ steps.vars.outputs.dir }}
ln -s ${{ steps.vars.outputs.dir }} images
tar chfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
- name: Test
if: matrix.platform == 'x86_64'
run: |
export O=${{ steps.vars.outputs.out }}
make test-qeneth
- uses: actions/upload-artifact@v4
with:
path: ${{ steps.vars.outputs.out }}/${{ steps.vars.outputs.tgz }}
name: artifact-${{ matrix.platform }}
path: output/${{ steps.vars.outputs.tgz }}
name: artifact-${{ matrix.target }}
test:
name: Regression Test of Infix x86_64
needs: build
runs-on: [ self-hosted, regression ]
steps:
- uses: actions/checkout@v4
with:
clean: true
submodules: recursive
- name: Configure x86_64
run: |
make x86_64_defconfig
- uses: actions/download-artifact@v4
with:
pattern: "artifact-*"
merge-multiple: true
- name: Restore x86-64 output/
run: |
ls -l
mkdir -p output
mv infix-x86_64.tar.gz output/
cd output/
tar xf infix-x86_64.tar.gz
ln -s infix-x86_64 images
- name: Regression Test
run: |
make test
- name: Publish Test Result
# Ensure this runs even if Regression Test fails
if: always()
run: cat test/.log/last/result-gh.md >> $GITHUB_STEP_SUMMARY
release:
if: ${{github.repository_owner == 'kernelkit' && github.ref_name == 'main'}}
name: Upload Latest Build
needs: build
needs: test
runs-on: ubuntu-latest
permissions:
contents: write
@@ -83,6 +130,13 @@ jobs:
with:
pattern: "artifact-*"
merge-multiple: true
- name: Create checksums ...
run: |
for file in *.tar.gz; do
sha256sum $file > $file.sha256
done
- uses: ncipollo/release-action@v1
with:
allowUpdates: true
@@ -92,7 +146,8 @@ jobs:
prerelease: true
tag: "latest"
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "*.tar.gz"
artifacts: "*.tar.gz*"
- name: Summary
run: |
cat <<EOF >> $GITHUB_STEP_SUMMARY
+9 -2
View File
@@ -2,7 +2,7 @@ name: Coverity Scan
on:
schedule:
- cron: '5 0 * * *'
- cron: '5 0 * * 6'
workflow_dispatch:
env:
@@ -24,6 +24,7 @@ jobs:
--post-data "token=$TOKEN&project=${PROJECT_NAME}&md5=1" \
-O coverity-latest.tar.gz.md5
echo "md5=$(cat coverity-latest.tar.gz.md5)" | tee -a $GITHUB_OUTPUT
- uses: actions/cache@v4
id: cache
with:
@@ -33,6 +34,7 @@ jobs:
${{ runner.os }}-coverity-${{ steps.var.outputs.md5 }}
${{ runner.os }}-coverity-
${{ runner.os }}-coverity
- name: Download Coverity Scan
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
@@ -47,12 +49,14 @@ jobs:
fi
mkdir coverity
tar xzf coverity-latest.tar.gz --strip 1 -C coverity
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install pkg-config libjansson-dev libev-dev \
libaugeas-dev libglib2.0-dev libpcre2-dev \
libcrypt-dev libglib2.0-dev libpcre2-dev \
libuev-dev libite-dev
- name: Build dependencies
run: |
git clone https://github.com/CESNET/libyang.git
@@ -62,10 +66,12 @@ jobs:
mkdir sysrepo/build
(cd sysrepo/build && cmake .. && make all && sudo make install)
make dep
- name: Check applications
run: |
export PATH=`pwd`/coverity/bin:$PATH
cov-build --dir cov-int make check
- name: Submit results to Coverity Scan
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
@@ -78,6 +84,7 @@ jobs:
--form version=$(git rev-parse HEAD) \
--form description="${PROJECT_NAME} $(git rev-parse HEAD)" \
https://scan.coverity.com/builds?project=${PROJECT_NAME}
- name: Upload build.log
uses: actions/upload-artifact@v4
with:
-77
View File
@@ -1,77 +0,0 @@
name: Reggie Regression
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Regression Testing
runs-on: self-hosted
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Clean up cruft ...
run: |
./test/env -c
- name: Set Build Variables
id: vars
run: |
target=x86_64
echo "dir=infix-$target" >> $GITHUB_OUTPUT
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
- name: Restore Cache of dl/
uses: actions/cache@v4
with:
path: dl/
key: dl-netconf-${{ hashFiles('.git/modules/buildroot/refs/heads/master', 'package/*/*.hash') }}
restore-keys: |
dl-netconf-
dl-
- name: Restore Cache of .ccache/
uses: actions/cache@v4
with:
path: .ccache/
key: ccache-x86_64-${{ hashFiles('.git/modules/buildroot/refs/head/master', 'package/*/*.hash') }}
restore-keys: |
ccache-x86_64-
ccache-
- name: Configure NETCONF
run: |
make x86_64_defconfig
- name: Unit Test
run: make test-unit
- name: Build
run: |
make
- name: Prepare Artifact
run: |
cd output
mv images ${{ steps.vars.outputs.dir }}
ln -s ${{ steps.vars.outputs.dir }} images
tar cfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
path: output/${{ steps.vars.outputs.tgz }}
- name: Regression Test
run: make test-qeneth
- name: Publish Test Result
# Ensure this runs even if Regression Test fails
if: always()
run: cat test/.log/last/result-gh.md >> $GITHUB_STEP_SUMMARY
+30 -20
View File
@@ -20,19 +20,18 @@ on:
jobs:
build:
if: github.repository == 'kernelkit/infix' && startsWith(github.ref, 'refs/tags/')
name: Build Infix ${{ github.ref_name }} [${{ matrix.platform }}]
runs-on: ubuntu-latest
name: Build Infix ${{ github.ref_name }} [${{ matrix.target }}]
runs-on: [ self-hosted, release ]
strategy:
matrix:
platform: [aarch64, x86_64]
target: [aarch64, x86_64]
fail-fast: false
steps:
- name: Maintenance
run: |
docker image prune -af
docker volume prune -f
docker container prune -f
- uses: actions/checkout@v4
with:
clean: true
submodules: recursive
- name: Set Release Variables
id: vars
run: |
@@ -43,10 +42,10 @@ jobs:
fi
echo "ver=${ver}" >> $GITHUB_OUTPUT
fver=${ver#v}
target=${{ matrix.platform }}-${fver}
target=${{ matrix.target }}-${fver}
echo "dir=infix-$target" >> $GITHUB_OUTPUT
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
echo "out=/mnt/x-$target" >> $GITHUB_OUTPUT
- name: Restore Cache of dl/
uses: actions/cache@v4
with:
@@ -54,49 +53,55 @@ jobs:
key: dl-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
restore-keys: |
dl-
- name: Restore Cache of .ccache/
uses: actions/cache@v4
with:
path: .ccache/
key: ccache-${{ matrix.platform }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
key: ccache-${{ matrix.target }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
restore-keys: |
ccache-${{ matrix.platform }}-
ccache-${{ matrix.target }}-
ccache-
- name: Configure & Build
env:
INFIX_RELEASE: ${{ steps.vars.outputs.ver }}
run: |
target=${{ matrix.platform }}_defconfig
target=${{ matrix.target }}_defconfig
echo "Building $target ..."
sudo mkdir ${{ steps.vars.outputs.out }}
sudo chown $(id -un):$(id -gn) ${{ steps.vars.outputs.out }}
export O=${{ steps.vars.outputs.out }}
make $target
make
- name: Generate SBOM from Build
run: |
make legal-info
- name: Prepare Artifacts
run: |
cd ${{ steps.vars.outputs.out }}
cd output/
mv images ${{ steps.vars.outputs.dir }}
ln -s ${{ steps.vars.outputs.dir }} images
tar chfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
mv legal-info legal-info-$target
tar chfz legal-info-$target.tar.gz legal-info-$target
- uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.platform }}
path: ${{ steps.vars.outputs.out }}/*.tar.gz
name: artifact-${{ matrix.target }}
path: output/*.tar.gz
release:
name: Release Infix ${{ github.ref_name }}
needs: build
runs-on: ubuntu-latest
runs-on: [ self-hosted, release ]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Set Release Variables
id: rel
run: |
@@ -118,20 +123,24 @@ jobs:
fi
echo "pre=${{ steps.rel.outputs.pre }}"
echo "latest=${{ steps.rel.outputs.latest }}"
- uses: actions/download-artifact@v4
with:
pattern: "artifact-*"
merge-multiple: true
- name: Create checksums ...
run: |
for file in *.tar.gz; do
sha256sum $file > $file.sha256
done
- name: Extract ChangeLog entry ...
run: |
awk '/^-----*$/{if (x == 1) exit; x=1;next}x' doc/ChangeLog.md \
|head -n -1 > release.md
cat release.md
- uses: ncipollo/release-action@v1
with:
name: Infix ${{ github.ref_name }}
@@ -139,6 +148,7 @@ jobs:
makeLatest: ${{ steps.rel.outputs.latest }}
bodyFile: release.md
artifacts: "*.tar.gz*"
- name: Summary
run: |
cat <<EOF >> $GITHUB_STEP_SUMMARY
+1 -5
View File
@@ -112,10 +112,6 @@ config INFIX_ARCH
default "riscv64" if BR2_riscv
default "x86_64" if BR2_x86_64
menu "Packages"
source "$BR2_EXTERNAL_INFIX_PATH/package/Config.in"
endmenu
source "$BR2_EXTERNAL_INFIX_PATH/package/Config.in.host"
source "$BR2_EXTERNAL_INFIX_PATH/board/common/Config.in"
+7 -2
View File
@@ -1,8 +1,13 @@
export BR2_EXTERNAL := $(CURDIR)
export BR2_EXTERNAL ?= $(CURDIR)
export PATH := $(CURDIR)/bin:$(PATH)
ARCH ?= $(shell uname -m)
O ?= $(CURDIR)/output
O ?= output
# If a relative output path is specified, we have to translate it to
# an absolute one before handing over control to Buildroot, which will
# otherwise treat it as relative to ./buildroot.
override O := $(if $(filter /%,$O),$O,$(CURDIR)/$O)
config := $(O)/.config
bmake = $(MAKE) -C buildroot O=$(O) $1
+10 -7
View File
@@ -5,8 +5,8 @@
Infix is a free, Linux based, immutable Network Operating System (NOS)
built on [Buildroot][1], and [sysrepo][2]. A powerful mix that ease
porting to different platforms, simplify long-term maintenance, and
provide made-easy management using NETCONF[^1] or the built-in command
line interface (CLI) from a console or SSH login.
provide made-easy management using NETCONF, RESTCONF[^2], or the
built-in command line interface (CLI) from a console or SSH login.
> Click the **▶ Example CLI Session** foldout below for an example, or
> head on over to the [Infix Documentation](doc/README.md) for more
@@ -22,7 +22,7 @@ may be appealing for other use-cases as well:
- Atomic upgrades to secondary partition
- Highly security focused
An immutable[^2] operating system enhances security and inherently makes
An immutable[^1] operating system enhances security and inherently makes
it maintenance-free. Configuration and data, e.g, containers, is stored
on separate partitions to ensure complete separation from system files
and allow for seamless backup, restore, and provisioning.
@@ -93,6 +93,7 @@ The [following boards](board/aarch64/README.md) are fully supported:
- Marvell CN9130 CRB
- Marvell EspressoBIN
- Microchip SparX-5i PCB135 (eMMC)
- StarFive VisionFive2
- NanoPi R2S
An x86_64 build is also available, primarily intended for development
@@ -100,22 +101,24 @@ and testing, but can also be used for evaluation and demo purposes. For
more information, see: [Infix in Virtual Environments](doc/virtual.md).
> See the [GitHub Releases](https://github.com/kernelkit/infix/releases)
> page for our pre-built images. The *Latest Build* has the bleeding
> page for our pre-built images. The *[Latest Build][]* has bleeding
> edge images, if possible we recommend using a versioned release.
>
> For *customer specific builds* of Infix, see your product repository.
[^1]: NETCONF or RESTCONF, <https://datatracker.ietf.org/doc/html/rfc8040>
[^2]: An immutable operating system is one with read-only file systems,
[^1]: An immutable operating system is one with read-only file systems,
atomic updates, rollbacks, declarative configuration, and workload
isolation. All to improve reliability, scalability, and security.
For more information, see <https://ceur-ws.org/Vol-3386/paper9.pdf>
and <https://www.zdnet.com/article/what-is-immutable-linux-heres-why-youd-run-an-immutable-linux-distro/>.
[^2]: Partial RESTCONF support, features like HTTP PATCH, OPTIONS, HEAD,
and copying between datastores are still missing.
[1]: https://buildroot.org/
[2]: https://www.sysrepo.org/
[3]: doc/cli/introduction.md
[Latest Build]: https://github.com/kernelkit/infix/releases/tag/latest
[License]: https://en.wikipedia.org/wiki/GPL_license
[License Badge]: https://img.shields.io/badge/License-GPL%20v2-blue.svg
[GitHub]: https://github.com/kernelkit/infix/actions/workflows/build.yml/
+5 -63
View File
@@ -1,67 +1,9 @@
aarch64
=======
Microchip SparX-5i PCB135 (eMMC)
--------------------------------
Board Specific Documentation
----------------------------
At present, only FIT images are supported via the SparX-5i eval
board's U-Boot, which must contain a valid load address. If you are
using this board, after selecting your base configuration, run the
following command to supplement the existing config with the required
FIT options:
make board-enable-sparx-fit
### Unbricking
1. Don't load a corrupt bootloader to begin with
2. Done
If, for some reason, you didn't manage to follow step 1, you can use
the `FLASH_PROG`(`J4`) connector on the board to access the SPI flash
directly.
Using a [Bus Blaster][BB3] in combination with [dangerspi][dangerspi],
you can load a new bootloader. The schematic below details how to
connect the Bus Blaster to the board, but the concept should be
portable to any debugger/device based around an FTDI2232 chip.
```
Bus Blaster: FLASH_PROG (J4):
.---. .---.
VTG >o o| VTG SCK >o o| GND
TRST |o o| GND MISO |o o| #RESET_FLASH
TDI |o o| GND o o| 3V3
TMS |o o| GND #CS |o o| #SYSRESET
TCK o o| GND MOSI |o o| GND
RTCK o o| GND '---'
TDO |o o| GND
TSRST |o o| GND
DBGRQ |o o| GND
DBGACK |o o| GND
'---'
```
| Bus Blaster | FLASH_PROG |
|-------------|----------------|
| `VTG` | `3V3` |
| `GND` | `GND` |
| | |
| `VTG` | `#RESET_FLASH` |
| `GND` | `#SYSRESET` |
| | |
| `TDI` | `MOSI` |
| `TMS` | `#CS` |
| `TCK` | `SCK` |
| `TDO` | `MISO` |
With the cable in place, build U-Boot with the correct configuration:
make fireant_boot_defconfig && make
To flash it to the board, connect the cable to `J4` and run:
make board-sparx-flash-uboot
[BB3]: http://dangerousprototypes.com/docs/Bus_Blaster#Bus_Blaster_v3
[dangerspi]: https://github.com/wkz/dangerspi
- [Marvell CN9130-CRB](cn9130-crb/)
- [Microchip SparX-5i PCB135 (eMMC)](sparx5-pcb135/)
- [NanoPi R2S](r2s/)
+132
View File
@@ -0,0 +1,132 @@
Marvell CN9130-CRB
==================
## Build instructions
### Bootloader
Build the bootloader from the supplied `defconfig`. It might be useful
to build in a separate output directory if you want to build Infix
from the same working tree later:
make O=$(pwd)/x-cn9130-boot cn9130_crb_boot_defconfig
cd x-cn9130-boot
make
The artifact of interest is called `flash-image.bin`, which will be
located in the `images/` directory once the build completes.
### Infix
> If you do not want to build Infix from source, feel free to use a pre-built [release]
The standard `aarch64_defconfig` is compatible with this board:
make O=$(pwd)/x-aarch64 aarch64_defconfig
cd x-aarch64
make
Two artifacts from the `images/` directory of this build are required
to provision a new board:
- `rootfs.itb`: Netbootable image
- `infix-aarch64.pkg`: Standard upgrade bundle
## Provisioning
The overall provisioning flow, in which each step in described in
details in the following sections, is as follows:
- Strap board to boot from SPI FLASH
- Load `flash-image.bin` over UART
- Burn `flash-image.bin` to SPI FLASH
- Netboot `rootfs.itb`
- Run Infix's built-in provisioning script
- Reboot, now booting from the primary partition of the SD-card
#### Strap Board to Boot from SPI FLASH
By default, the board is strapped to boot from eMMC. However, Infix
assumes that the board will boot from SPI FLASH. Therefore we have to
ensure that the DIP switches of `SW2` on the board selects a
`BOOT_MODE` of `0x32`, meaning that the switches on positions 4, 3,
and 1 should be enabled (i.e. these need to be tied to ground):
```
.-----. .-----. .-----.
| | | | | PWR |
| SIM | | uSD | | |
| | | | '-----'
'-----' '-----'
|
v
.-----. .-----.
| SW1 | | SW2 |
'-----' '-----'
.--------------------------.
| |
| |
| CN9130 |
```
#### UART Boot U-Boot
Make sure that:
- [mvebu64boot] is installed and available in your shell's `$PATH`
- No other program is attached to `ttyUSB0`
- No power is applied to the board
1. Start `mvebu64boot`:
mvebu64boot -b /path/to/flash-image.bin /dev/ttyUSB0
2. Apply power
As soon as `mvebu64boot` completes, attach to the serial port,
e.g. using `screen(1)`, or `console(1)` and stop the normal boot
process by hitting any key.
#### Burn U-Boot to SPI FLASH
Make sure that:
- `eth1` is connected to a machine which serves `flash-image.bin` over
TFTP
- U-Boot can reach the TFTP server. If the neighboring machine is also
set up as a DHCP server, simply run the command `dhcp -`
To burn the bootloader to SPI FLASH, run the `bubt` command:
bubt flash-image.bin
Once the command completes, reset the board to verify that it can now
boot unassisted:
reset
#### Boot up `rootfs.itb`
U-Boot will automatically fallback to netboot since the SD-card is
still blank. Make sure that the PC provides the path to `rootfs.itb`
in DHCP option 67 ("bootfile").
#### Install Firmware
Login as `admin`/`admin`, setup networking to the PC, ensure that the date on
the device is reasonably correct, and run the provisioning script:
admin@infix:~$ sudo -i
root@infix:~$ udhcpc -i e28
root@infix:~$ date -us YYYY-MM-DD
root@infix:~$ /usr/libexec/infix/prod/provision tftp://<PC-IP>/infix-aarch64.pkg /dev/mmcblk0
After successful completion, the device is fully provisioned. On the
next boot, the device will boot of its own accord from the primary
SD-card partition.
> If possible, serve `infix-aarch64.pkg` over HTTP instead, as
> libcurl's TFTP implementation is quite slow.
[release]: https://github.com/kernelkit/infix/releases
[mvebu64boot]: https://github.com/addiva-elektronik/mvebu64boot
@@ -17,35 +17,11 @@ run ixboot
boot_targets = "mmc1";
ethprime = "eth1";
/* Uncomment this if you're debugging U-Boot
*
* This will allow you to break out of the
* normal boot flow and into the interactive
* console.
*
* To upgrade U-Boot itself, simply set the
* `bootfile` variable to the path of
* `flash-image.bin` on your TFTP server, then
* issue `run ixupgradeboot`.
/* This is a development platform, keep
* developer mode statically enabled.
*/
/* bootdelay = "2"; */
/* ixupgradeboot = " */
/* dhcp */
/* setexpr fileblks ${filesize} + 0x1ff */
/* setexpr fileblks ${fileblks} / 0x200 */
/* mmc dev 1 */
/* part start mmc 1 boot bootstart */
/* part size mmc 1 boot bootsize */
/* mmc erase ${bootstart} ${bootsize} */
/* mmc write ${fileaddr} ${bootstart} ${fileblks} */
/* "; */
ixbtn-devmode = "setenv dev_mode yes; echo Enabled";
ixbtn-factory = "echo \"No button available, use bootmenu\"";
};
};
};
/* &cp0_eth0 { */
/* phy-mode = "10gbase-r"; */
/* }; */
@@ -1,4 +1,6 @@
CONFIG_DEVICE_TREE_INCLUDES="infix-env.dtsi infix-key.dtsi cn9130-crb-env.dtsi"
CONFIG_SYS_PROMPT="(cn9130-crb) "
CONFIG_ENV_IS_NOWHERE=y
# CONFIG_ENV_IS_IN_MMC is not set
CONFIG_MVEBU_SPI_BOOT=y
+1 -4
View File
@@ -14,10 +14,6 @@
#include "alder-mpp.h"
&ap_crit {
temperature = <115000>;
};
/ {
model = "Alder";
compatible = "alder,alder",
@@ -358,6 +354,7 @@
#define XSWP(_n, _label, _mac_offs, _phy) \
port@_n { \
SWP_COMMON(_n, _label, _mac_offs, "usxgmii", _phy); \
managed = "in-band-status"; \
}
#define GSWP(_n, _label, _mac_offs, _phy) \
@@ -0,0 +1,69 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2020 Marvell International Ltd.
*/
#include "cn9130-crb.dtsi"
/ {
model = "Marvell Armada CN9130-CRB-A";
chosen {
infix {
/* "admin" */
factory-password-hash = "$5$mI/zpOAqZYKLC2WU$i7iPzZiIjOjrBF3NyftS9CCq8dfYwHwrmUK097Jca9A";
usb-ports = <&cp0_usb3_1>;
usb-port-names = "USB";
};
};
};
&cp0_pcie0 {
status = "okay";
num-lanes = <4>;
num-viewport = <8>;
/* Generic PHY, providing serdes lanes */
phys = <&cp0_comphy0 0
&cp0_comphy1 0
&cp0_comphy2 0
&cp0_comphy3 0>;
iommu-map =
<0x0 &smmu 0x480 0x20>,
<0x100 &smmu 0x4a0 0x20>,
<0x200 &smmu 0x4c0 0x20>;
iommu-map-mask = <0x031f>;
};
&cp0_usb3_0 {
status = "okay";
usb-phy = <&cp0_usb3_0_phy0>;
phy-names = "usb";
};
&cp0_usb3_1 {
status = "okay";
usb-phy = <&cp0_usb3_0_phy1>;
phy-names = "usb";
};
&cp0_eth2 {
status = "okay";
phy-mode = "2500base-x";
};
&cp0_pinctrl {
cp0_expander0_pins: cp0-expander-pins-0 {
marvell,pins = "mpp39";
marvell,function = "gpio";
};
};
&expander0 {
pinctrl-names = "default";
pinctrl-0 = <&cp0_expander0_pins>;
interrupt-parent = <&cp0_gpio2>;
interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
interrupt-controller;
#interrupt-cells=<2>;
microchip,irq-mirror;
};
+1 -1
View File
@@ -92,7 +92,7 @@
compatible = "atmel,24c256";
reg = <0x50>;
infix,board = "cpu";
infix,board = "product";
infix,trusted;
nvmem-layout {
+7
View File
@@ -175,9 +175,15 @@ CONFIG_VLAN_8021Q=y
CONFIG_VLAN_8021Q_GVRP=y
CONFIG_VLAN_8021Q_MVRP=y
CONFIG_NET_SCHED=y
CONFIG_NET_SCH_MQPRIO=y
CONFIG_NET_CLS_BASIC=y
CONFIG_NET_CLS_BPF=y
CONFIG_NET_CLS_FLOWER=y
CONFIG_NET_CLS_ACT=y
CONFIG_NET_ACT_GACT=y
CONFIG_NET_ACT_MIRRED=y
CONFIG_NET_ACT_SKBEDIT=y
CONFIG_DCB=y
CONFIG_NETLINK_DIAG=y
CONFIG_MPLS=y
CONFIG_NET_MPLS_GSO=y
@@ -506,6 +512,7 @@ CONFIG_FUSE_FS=y
CONFIG_VIRTIO_FS=y
CONFIG_OVERLAY_FS=y
CONFIG_VFAT_FS=y
CONFIG_EXFAT_FS=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_SQUASHFS=y
+165
View File
@@ -0,0 +1,165 @@
FriendlyELC NanoPi R2S
======================
The [NanoPi R2S][1] is a very low-cost 64-bit ARM min router, powered by
the Rockchip RK3328, quad-core Cortex-A53.
The R2S does not have any onboard eMMC, so the only way to boot Infix on
it is using and SD card.
LEDs
----
The front system LEDs work as follows in Infix:
| **Stage** | **SYS** | **LAN** | **WAN** |
|----------------|---------|---------|---------|
| Power-on | dimmed | off | off |
| Factory reset | on | on | on |
| Linux loading | on | off | off |
| System loading | 1 Hz | off | off |
| System up | off | on | off |
| WAN address | off | on | on |
| Locate | 1 Hz | 1 Hz | 1 Hz |
| Fail safe | 5 Hz | off | off |
| Panic | 5 Hz | 5 Hz | 5 Hz |
Powering on the device the SYS LED is turned on faintly (dimmed). It
remains dimmed while U-Boot loads the kernel, and turns bright red when
the kernel starts. It remains steady on until the system has started
the LED daemon, `iitod`, which sets it blinking at 1 Hz while the rest
of the system starts up. When the system has come up successfully, the
SYS LED is turned off and the green LAN LED turns on. The WAN LED will
turn on (green) when the WAN interface is up and has an IP address.
> Compared to the `x86_64` Qemu target, it takes a while to parse all
> YANG models and load `startup-config`, but the whole process should
> not take more than 60 seconds, and usually a lot less.
If a "find my device" function exists, it will blink all LEDs at 1 Hz.
If `startup-config` fails to load Ínfix reverts to `failure-config`,
putting the device in fail safe (or fail secure) mode. Indicated by
the SYS LED blinking at 5 Hz instead of turning off.
If Infix for some reason also fails to load `failure-config`, then all
LEDs will blink at 5 Hz to clearly indicate something is very wrong.
In all error cases the console shows the problem.
Factory Reset
-------------
The reset button on the side can be used not only to safely reboot the
device, but can also be used to trigger a factory reset at power on.
At power-on, keep the reset button pressed for 10 seconds. The system
LEDs (SYS, WAN, LAN) will all blink at 1 Hz, to help you count down the
seconds. When the 10 seconds have passed all LEDs are turned off before
loading Linux.
When Linux boots up it confirms the factory reset by lighting up the
LEDs again, no blinking this time. The LEDs stay on until all files and
directories on read/writable partitions (`/cfg` and `/var`) have been
safely erased.
The system then continues loading, turning off all LEDs except SYS,
which blinks calmly at 1 Hz as usual until the system has completed
loading, this time with a `startup-config` freshly restored from the
device's `factory-config`.
How to Build
------------
```
$ make r2s_defconfig
$ make
```
Once the build has finished you will have `output/images/sdcard.img`
which you can flash to an SD card.
```
$ sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 bs=1M status=progress oflag=direct
```
> **WARNING:** ensure `/dev/mmcblk0` really is the correct device for
> your SD card, and not used by the system!
Booting the Board
-----------------
1. Connect a TTL cable to three UART pins, GND is closest to the edge
2. Insert the flashed SD card
3. Power-up the board using an USB-C cable (ensure good power source!)
Worth noting, unlike many other boards, the Rockchip family of chipsets
runs the UART at 1500000 bps (1.5 Mbps) 8N1.
Secure Boot
-----------
Like other Infix builds, the R2S enjoys secure boot. Please note,
however that the default signing keys are the public!
Also, default builds allow modifying and saving the U-Boot environment
(see below), which you may want to disable to secure the device. The
device also runs in *developer mode*, allowing full U-Boot shell access,
which you may also want to disable in a full production setting.
Caveat
------
Most (all?) of these boards do not have any Vital Product Data (VPD)
EEPROM mounted. This means they do not come with unique MAC addresses
allocated to the two Ethernet ports.
The bootloader (U-Boot) default environment for the board is usually
what provides a default, the same default MAC addresses to Linux:
- 4a:dc:d8:20:0d:84
- 4a:dc:d8:20:0d:85
This is important in case you want to run multiple R2S devices on the
same LAN. Meaning you either have to change the MAC address in the
U-Boot environment (below), or modify your `phys-address` setting in
Infix for the interface(s).
Break into U-Boot using Ctrl-C at power-on, preferably when the text
`Press Ctrl-C NOW to enter boot menu` is displayed. Exit the menu to
get to the prompt:
```
(r2s) printenv
...
eth1addr=4a:dc:d8:20:0d:84
ethact=ethernet@ff540000
ethaddr=4a:dc:d8:20:0d:85
ethprime=eth0
...
```
Here we change both addresses, using the *Locally Administered* bit:
```
(r2s) setenv eth1addr 02:00:c0:ff:ee:01
(r2s) setenv ethaddr 02:00:c0:ff:ee:00
(r2s) saveenv
```
Boot the system, log into Linux, and inspect the MAC addresses:
```
admin@infix-00-00-00:~$ ip -br l
lo UP 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
eth0 UP 02:00:c0:ff:ee:00 <BROADCAST,MULTICAST,UP,LOWER_UP>
eth1 UP 02:00:c0:ff:ee:01 <BROADCAST,MULTICAST,UP,LOWER_UP>
```
[1]: https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R2S
-4
View File
@@ -1,4 +0,0 @@
label Infix on NanoPi R2S
kernel /boot/Image
devicetree /boot/rk3328-nanopi-r2s.dtb
append root=/dev/mmcblk0p1 rw rootwait bonding.max_bonds=0 dummy.numdummies=0 fb_tunnels=none quiet
+40 -7
View File
@@ -1,37 +1,70 @@
image cfg.ext4 {
empty = true
temporary = true
size = 16M
ext4 {
label = "cfg"
}
}
image var.ext4 {
empty = true
size = 16M
temporary = true
size = 512M
ext4 {
label = "var"
use-mke2fs = true
}
}
image sdcard.img {
hdimage {
partition-table-type = "gpt"
}
partition u-boot-tpl-spl-dtb {
in-partition-table = "no"
image = "idbloader.img"
offset = 32K
image = "idbloader.img"
}
partition u-boot-dtb {
in-partition-table = "no"
image = "u-boot.itb"
offset = 8M
image = "u-boot.itb"
}
partition rootfs {
partition-type = 0x83
partition aux {
partition-uuid = D4EF35A0-0652-45A1-B3DE-D63339C82035
offset = 16M
image = "rootfs.ext4"
image = "aux.ext4"
}
partition primary {
partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4
bootable = true
size = 200M
image = "rootfs.squashfs"
}
partition secondary {
partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4
bootable = true
size = 200M
image = "rootfs.squashfs"
}
partition cfg {
partition-type = 0x83
partition-uuid = 7aa497f0-73b5-47e5-b2ab-8752d8a48105
image = "cfg.ext4"
}
partition var {
partition-uuid = 8046A06A-E45A-4A14-A6AD-6684704A393F
image = "var.ext4"
}
}
# Silence genimage warnings
+176 -85
View File
@@ -3,22 +3,31 @@ CONFIG_POSIX_MQUEUE=y
CONFIG_AUDIT=y
CONFIG_NO_HZ_IDLE=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT=y
CONFIG_PREEMPT=y
CONFIG_IRQ_TIME_ACCOUNTING=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_PSI=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_NUMA_BALANCING=y
CONFIG_LOG_BUF_SHIFT=18
CONFIG_MEMCG=y
CONFIG_BLK_CGROUP=y
CONFIG_CFS_BANDWIDTH=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_HUGETLB=y
CONFIG_CPUSETS=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_PERF=y
CONFIG_CGROUP_BPF=y
CONFIG_NAMESPACES=y
CONFIG_USER_NS=y
CONFIG_SCHED_AUTOGROUP=y
@@ -27,19 +36,14 @@ CONFIG_EXPERT=y
CONFIG_KALLSYMS_ALL=y
CONFIG_PROFILING=y
CONFIG_KEXEC_FILE=y
CONFIG_CRASH_DUMP=y
CONFIG_ARCH_ACTIONS=y
CONFIG_ARCH_ROCKCHIP=y
CONFIG_ARCH_VEXPRESS=y
CONFIG_ARM64_VA_BITS_48=y
CONFIG_SCHED_MC=y
CONFIG_SCHED_SMT=y
CONFIG_NUMA=y
CONFIG_NR_CPUS=8
CONFIG_COMPAT=y
CONFIG_RANDOMIZE_BASE=y
CONFIG_HIBERNATION=y
CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y
CONFIG_ENERGY_MODEL=y
# CONFIG_SUSPEND is not set
CONFIG_ARM_PSCI_CPUIDLE=y
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_STAT=y
@@ -48,8 +52,8 @@ CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
CONFIG_CPUFREQ_DT=y
CONFIG_ACPI_CPPC_CPUFREQ=m
CONFIG_ARM_SCMI_CPUFREQ=y
CONFIG_ACPI_CPPC_CPUFREQ=m
CONFIG_ACPI=y
CONFIG_ACPI_APEI=y
CONFIG_ACPI_APEI_GHES=y
@@ -57,6 +61,7 @@ CONFIG_ACPI_APEI_MEMORY_FAILURE=y
CONFIG_ACPI_APEI_EINJ=y
CONFIG_VIRTUALIZATION=y
CONFIG_KVM=y
CONFIG_KPROBES=y
CONFIG_JUMP_LABEL=y
# CONFIG_GCC_PLUGINS is not set
CONFIG_MODULES=y
@@ -67,8 +72,11 @@ CONFIG_KSM=y
CONFIG_MEMORY_FAILURE=y
CONFIG_TRANSPARENT_HUGEPAGE=y
CONFIG_CMA=y
CONFIG_CMA_AREAS=20
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_XDP_SOCKETS=y
CONFIG_XDP_SOCKETS_DIAG=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
@@ -76,24 +84,66 @@ CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_NET_IPIP=y
CONFIG_NET_IPGRE_DEMUX=y
CONFIG_NET_IPIP=m
CONFIG_NET_IPGRE_DEMUX=m
CONFIG_NET_IPGRE=m
CONFIG_NET_IPGRE_BROADCAST=y
CONFIG_IP_MROUTE=y
CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
CONFIG_IPV6=m
CONFIG_SYN_COOKIES=y
CONFIG_IPV6_SIT=m
CONFIG_IPV6_GRE=m
CONFIG_IPV6_MULTIPLE_TABLES=y
CONFIG_IPV6_SUBTREES=y
CONFIG_IPV6_MROUTE=y
CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y
CONFIG_IPV6_PIMSM_V2=y
CONFIG_NETWORK_PHY_TIMESTAMPING=y
CONFIG_NETFILTER=y
CONFIG_NF_CONNTRACK=m
CONFIG_BRIDGE_NETFILTER=y
CONFIG_NETFILTER_NETLINK_QUEUE=y
CONFIG_NETFILTER_NETLINK_LOG=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CONNTRACK_EVENTS=y
CONFIG_NF_CONNTRACK_FTP=y
CONFIG_NF_TABLES=y
CONFIG_NF_TABLES_INET=y
CONFIG_NF_TABLES_NETDEV=y
CONFIG_NFT_CT=m
CONFIG_NFT_CONNLIMIT=m
CONFIG_NFT_LOG=m
CONFIG_NFT_LIMIT=m
CONFIG_NFT_MASQ=m
CONFIG_NFT_REDIR=m
CONFIG_NFT_NAT=m
CONFIG_NFT_TUNNEL=m
CONFIG_NFT_QUEUE=m
CONFIG_NFT_REJECT=m
CONFIG_NFT_COMPAT=m
CONFIG_NFT_HASH=m
CONFIG_NFT_SOCKET=m
CONFIG_NFT_OSF=m
CONFIG_NFT_DUP_NETDEV=m
CONFIG_NFT_FWD_NETDEV=m
CONFIG_NFT_REJECT_NETDEV=m
CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
CONFIG_NETFILTER_XT_TARGET_LOG=m
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
CONFIG_NETFILTER_XT_MATCH_BPF=m
CONFIG_NETFILTER_XT_MATCH_CGROUP=m
CONFIG_NETFILTER_XT_MATCH_COMMENT=m
CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m
CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
CONFIG_NETFILTER_XT_MATCH_DSCP=m
CONFIG_NETFILTER_XT_MATCH_HELPER=m
CONFIG_NETFILTER_XT_MATCH_LIMIT=m
CONFIG_NETFILTER_XT_MATCH_MAC=m
CONFIG_NETFILTER_XT_MATCH_MARK=m
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
CONFIG_IP_NF_IPTABLES=m
CONFIG_IP_NF_FILTER=m
CONFIG_IP_NF_TARGET_REJECT=m
@@ -101,17 +151,46 @@ CONFIG_IP_NF_NAT=m
CONFIG_IP_NF_TARGET_MASQUERADE=m
CONFIG_IP_NF_MANGLE=m
CONFIG_IP6_NF_IPTABLES=m
CONFIG_IP6_NF_MATCH_AH=m
CONFIG_IP6_NF_MATCH_EUI64=m
CONFIG_IP6_NF_MATCH_IPV6HEADER=m
CONFIG_IP6_NF_FILTER=m
CONFIG_IP6_NF_TARGET_REJECT=m
CONFIG_IP6_NF_MANGLE=m
CONFIG_IP6_NF_RAW=m
CONFIG_IP6_NF_NAT=m
CONFIG_IP6_NF_TARGET_MASQUERADE=m
CONFIG_BRIDGE=m
CONFIG_IP6_NF_TARGET_NPT=m
CONFIG_NF_TABLES_BRIDGE=m
CONFIG_NFT_BRIDGE_META=m
CONFIG_NFT_BRIDGE_REJECT=m
CONFIG_NF_CONNTRACK_BRIDGE=y
CONFIG_BRIDGE_NF_EBTABLES=m
CONFIG_BRIDGE_EBT_BROUTE=m
CONFIG_BRIDGE_EBT_T_FILTER=m
CONFIG_BRIDGE_EBT_T_NAT=m
CONFIG_BRIDGE_EBT_802_3=m
CONFIG_BRIDGE_EBT_AMONG=m
CONFIG_BRIDGE_EBT_ARP=m
CONFIG_BRIDGE_EBT_IP=m
CONFIG_BRIDGE_EBT_IP6=m
CONFIG_BRIDGE_EBT_LIMIT=m
CONFIG_BRIDGE_EBT_MARK=m
CONFIG_BRIDGE_EBT_PKTTYPE=m
CONFIG_BRIDGE_EBT_STP=m
CONFIG_BRIDGE_EBT_VLAN=m
CONFIG_BRIDGE_EBT_ARPREPLY=m
CONFIG_BRIDGE_EBT_DNAT=m
CONFIG_BRIDGE_EBT_MARK_T=m
CONFIG_BRIDGE_EBT_REDIRECT=m
CONFIG_BRIDGE_EBT_SNAT=m
CONFIG_BRIDGE_EBT_LOG=m
CONFIG_BRIDGE_EBT_NFLOG=m
CONFIG_BRIDGE=y
CONFIG_BRIDGE_VLAN_FILTERING=y
CONFIG_NET_DSA=m
CONFIG_NET_DSA_TAG_OCELOT=m
CONFIG_NET_DSA_TAG_OCELOT_8021Q=m
CONFIG_VLAN_8021Q=m
CONFIG_BRIDGE_MRP=y
CONFIG_BRIDGE_CFM=y
CONFIG_VLAN_8021Q=y
CONFIG_VLAN_8021Q_GVRP=y
CONFIG_VLAN_8021Q_MVRP=y
CONFIG_NET_SCHED=y
@@ -121,13 +200,22 @@ CONFIG_NET_SCH_TAPRIO=m
CONFIG_NET_SCH_MQPRIO=m
CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_CLS_BASIC=m
CONFIG_NET_CLS_BPF=m
CONFIG_NET_CLS_FLOWER=m
CONFIG_NET_CLS_ACT=y
CONFIG_NET_ACT_GACT=m
CONFIG_NET_ACT_MIRRED=m
CONFIG_NET_ACT_GATE=m
CONFIG_NET_ACT_GACT=y
CONFIG_NET_ACT_MIRRED=y
CONFIG_NET_ACT_NAT=y
CONFIG_NET_ACT_SKBEDIT=y
CONFIG_NET_ACT_VLAN=y
CONFIG_NET_ACT_BPF=y
CONFIG_DCB=y
CONFIG_NETLINK_DIAG=y
CONFIG_MPLS=y
CONFIG_NET_MPLS_GSO=y
CONFIG_MPLS_ROUTING=m
CONFIG_NET_PKTGEN=y
CONFIG_BT=m
CONFIG_BT_HIDP=m
# CONFIG_BT_LE is not set
CONFIG_BT_LEDS=y
# CONFIG_BT_DEBUGFS is not set
@@ -142,6 +230,7 @@ CONFIG_MAC80211_LEDS=y
CONFIG_RFKILL=y
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
# CONFIG_ETHTOOL_NETLINK is not set
CONFIG_PCI=y
CONFIG_PCIEPORTBUS=y
CONFIG_PCI_IOV=y
@@ -157,6 +246,7 @@ CONFIG_PCI_EPF_TEST=m
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_FW_LOADER_USER_HELPER=y
CONFIG_VEXPRESS_CONFIG=y
CONFIG_ARM_SCMI_PROTOCOL=y
CONFIG_ARM_SCPI_PROTOCOL=y
CONFIG_EFI_CAPSULE_LOADER=y
@@ -171,6 +261,7 @@ CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_OF=y
CONFIG_MTD_DATAFLASH=y
CONFIG_MTD_SST25L=y
CONFIG_MTD_BLOCK2MTD=y
CONFIG_MTD_RAW_NAND=y
CONFIG_MTD_NAND_DENALI_DT=y
CONFIG_MTD_SPI_NOR=y
@@ -191,6 +282,7 @@ CONFIG_SCSI_HISI_SAS=y
CONFIG_SCSI_HISI_SAS_PCI=y
CONFIG_MEGARAID_SAS=y
CONFIG_SCSI_MPT3SAS=m
CONFIG_SCSI_VIRTIO=y
CONFIG_ATA=y
CONFIG_SATA_AHCI=y
CONFIG_SATA_AHCI_PLATFORM=y
@@ -198,24 +290,29 @@ CONFIG_AHCI_CEVA=y
CONFIG_SATA_SIL24=y
CONFIG_PATA_OF_PLATFORM=y
CONFIG_MD=y
CONFIG_BLK_DEV_MD=m
CONFIG_BLK_DEV_DM=m
CONFIG_DM_MIRROR=m
CONFIG_DM_ZERO=m
# CONFIG_MD_BITMAP_FILE is not set
CONFIG_BLK_DEV_DM=y
CONFIG_DM_INIT=y
CONFIG_DM_VERITY=y
CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y
CONFIG_NETDEVICES=y
CONFIG_BONDING=m
CONFIG_DUMMY=y
CONFIG_DUMMY=m
CONFIG_WIREGUARD=m
CONFIG_MACVLAN=m
CONFIG_MACVTAP=m
CONFIG_VXLAN=y
CONFIG_IPVLAN=m
CONFIG_IPVTAP=m
CONFIG_VXLAN=m
CONFIG_GENEVE=m
CONFIG_BAREUDP=m
CONFIG_TUN=y
CONFIG_MACSEC=m
CONFIG_TUN=m
CONFIG_VETH=m
CONFIG_VIRTIO_NET=m
CONFIG_VIRTIO_NET=y
CONFIG_NLMON=y
CONFIG_NET_VRF=y
# CONFIG_NET_VENDOR_3COM is not set
# CONFIG_NET_VENDOR_ACTIONS is not set
# CONFIG_NET_VENDOR_ADAPTEC is not set
# CONFIG_NET_VENDOR_AGERE is not set
# CONFIG_NET_VENDOR_ALACRITECH is not set
@@ -283,15 +380,12 @@ CONFIG_STMMAC_ETH=y
# CONFIG_NET_VENDOR_VIA is not set
# CONFIG_NET_VENDOR_WIZNET is not set
# CONFIG_NET_VENDOR_XILINX is not set
CONFIG_LED_TRIGGER_PHY=y
CONFIG_AX88796B_PHY=y
CONFIG_MICREL_PHY=y
CONFIG_MICROSEMI_PHY=y
CONFIG_AT803X_PHY=m
CONFIG_DAVICOM_PHY=m
CONFIG_REALTEK_PHY=y
CONFIG_ROCKCHIP_PHY=y
CONFIG_MDIO_BITBANG=y
CONFIG_MDIO_BCM_UNIMAC=m
CONFIG_MDIO_THUNDER=y
CONFIG_MDIO_BUS_MUX_MULTIPLEXER=y
CONFIG_MDIO_BUS_MUX_MMIOREG=y
CONFIG_USB_RTL8150=m
@@ -299,6 +393,7 @@ CONFIG_USB_RTL8152=m
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=m
CONFIG_USB_NET_AX88179_178A=m
CONFIG_USB_NET_CDC_NCM=m
CONFIG_USB_NET_DM9601=m
CONFIG_USB_NET_SMSC75XX=m
CONFIG_USB_NET_SMSC95XX=m
@@ -306,13 +401,12 @@ CONFIG_USB_NET_NET1080=m
CONFIG_USB_NET_PLUSB=m
CONFIG_USB_NET_MCS7830=m
CONFIG_USB_NET_CDC_SUBSET=m
CONFIG_USB_NET_ZAURUS=m
# CONFIG_USB_NET_ZAURUS is not set
CONFIG_ATH10K=m
CONFIG_ATH10K_PCI=m
CONFIG_WCN36XX=m
# CONFIG_WLAN_VENDOR_ATMEL is not set
# CONFIG_WLAN_VENDOR_BROADCOM is not set
# CONFIG_WLAN_VENDOR_CISCO is not set
# CONFIG_WLAN_VENDOR_INTEL is not set
# CONFIG_WLAN_VENDOR_INTERSIL is not set
# CONFIG_WLAN_VENDOR_MARVELL is not set
@@ -355,9 +449,11 @@ CONFIG_RTW89_DEBUGMSG=y
# CONFIG_WLAN_VENDOR_TI is not set
# CONFIG_WLAN_VENDOR_ZYDAS is not set
# CONFIG_WLAN_VENDOR_QUANTENNA is not set
CONFIG_NET_FAILOVER=y
CONFIG_INPUT_FF_MEMLESS=y
# CONFIG_INPUT_KEYBOARD is not set
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_EVBUG=y
CONFIG_KEYBOARD_GPIO=y
CONFIG_KEYBOARD_GPIO_POLLED=y
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_MISC=y
CONFIG_INPUT_RK805_PWRKEY=y
@@ -404,47 +500,38 @@ CONFIG_PPS=y
CONFIG_DEBUG_PINCTRL=y
CONFIG_PINCTRL_RK805=y
CONFIG_PINCTRL_SINGLE=y
CONFIG_GPIO_ALTERA=m
CONFIG_GPIO_DWAPB=y
CONFIG_GPIO_MB86S7X=y
CONFIG_GPIO_PL061=y
CONFIG_GPIO_XGENE=y
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_GENERIC_PLATFORM=y
CONFIG_GPIO_MAX732X=y
CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCA953X_IRQ=y
CONFIG_POWER_RESET_XGENE=y
CONFIG_POWER_RESET_GPIO_RESTART=y
CONFIG_POWER_RESET_SYSCON=y
CONFIG_SYSCON_REBOOT_MODE=y
CONFIG_BATTERY_SBS=m
CONFIG_BATTERY_BQ27XXX=y
CONFIG_BATTERY_MAX17042=m
CONFIG_CHARGER_BQ25890=m
CONFIG_CHARGER_BQ25980=m
CONFIG_CHARGER_RK817=y
CONFIG_SENSORS_ARM_SCMI=y
CONFIG_SENSORS_ARM_SCPI=y
CONFIG_SENSORS_LM90=m
CONFIG_SENSORS_PWM_FAN=m
CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y
CONFIG_CPU_THERMAL=y
CONFIG_THERMAL_EMULATION=y
CONFIG_ROCKCHIP_THERMAL=m
CONFIG_WATCHDOG=y
CONFIG_ARM_SP805_WATCHDOG=y
CONFIG_ARM_SBSA_WATCHDOG=y
CONFIG_DW_WATCHDOG=y
CONFIG_ARM_SMC_WATCHDOG=y
CONFIG_WATCHDOG_SYSFS=y
CONFIG_SOFT_WATCHDOG=y
CONFIG_MFD_RK8XX_I2C=y
CONFIG_MFD_RK8XX_SPI=y
CONFIG_MFD_STMFX=y
# CONFIG_MFD_VEXPRESS_SYSREG is not set
CONFIG_REGULATOR=y
CONFIG_REGULATOR_DEBUG=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_REGULATOR_USERSPACE_CONSUMER=y
CONFIG_REGULATOR_NETLINK_EVENTS=y
CONFIG_REGULATOR_GPIO=y
CONFIG_REGULATOR_PWM=y
CONFIG_REGULATOR_RK808=y
CONFIG_REGULATOR_VCTRL=y
CONFIG_REGULATOR_VEXPRESS=m
# CONFIG_HID_GENERIC is not set
# CONFIG_USB_HID is not set
# CONFIG_HID_SUPPORT is not set
CONFIG_USB_ULPI_BUS=y
CONFIG_USB_CONN_GPIO=y
CONFIG_USB=y
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
@@ -452,6 +539,7 @@ CONFIG_USB_DYNAMIC_MINORS=y
CONFIG_USB_OTG=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PLATFORM=y
@@ -460,10 +548,6 @@ CONFIG_USB_STORAGE=y
CONFIG_USB_MUSB_HDRC=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC2=y
CONFIG_USB_CHIPIDEA=y
CONFIG_USB_CHIPIDEA_UDC=y
CONFIG_USB_CHIPIDEA_HOST=y
CONFIG_USB_ISP1760=y
CONFIG_USB_SERIAL=m
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_SIMPLE=m
@@ -471,7 +555,6 @@ CONFIG_USB_SERIAL_CP210X=m
CONFIG_USB_SERIAL_FTDI_SIO=m
CONFIG_USB_SERIAL_PL2303=m
CONFIG_USB_SERIAL_OPTION=m
CONFIG_USB_HSIC_USB3503=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_ULPI=y
CONFIG_USB_GADGET=y
@@ -488,12 +571,6 @@ CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_EEM=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_TYPEC=m
CONFIG_TYPEC_TCPM=m
CONFIG_TYPEC_TCPCI=m
CONFIG_TYPEC_FUSB302=m
CONFIG_TYPEC_TPS6598X=m
CONFIG_TYPEC_HD3SS3220=m
CONFIG_MMC=y
CONFIG_MMC_BLOCK_MINORS=32
CONFIG_MMC_ARMMMCI=y
@@ -505,13 +582,9 @@ CONFIG_MMC_SDHCI_CADENCE=y
CONFIG_MMC_SDHCI_F_SDH30=y
CONFIG_MMC_SPI=y
CONFIG_MMC_DW=y
CONFIG_MMC_DW_EXYNOS=y
CONFIG_MMC_DW_HI3798CV200=y
CONFIG_MMC_DW_K3=y
CONFIG_MMC_DW_ROCKCHIP=y
CONFIG_MMC_MTK=y
CONFIG_MMC_SDHCI_XENON=y
CONFIG_MMC_SDHCI_AM654=y
CONFIG_SCSI_UFSHCD=y
CONFIG_SCSI_UFSHCD_PLATFORM=y
CONFIG_NEW_LEDS=y
@@ -527,6 +600,7 @@ CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_CPU=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_LEDS_TRIGGER_PANIC=y
CONFIG_LEDS_TRIGGER_NETDEV=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_RK808=y
CONFIG_RTC_DRV_EFI=y
@@ -541,7 +615,6 @@ CONFIG_VIRTIO_INPUT=y
CONFIG_VIRTIO_MMIO=y
# CONFIG_VHOST_MENU is not set
CONFIG_STAGING=y
CONFIG_PRISM2_USB=m
CONFIG_RTLLIB=m
CONFIG_RTL8192E=m
CONFIG_RTL8723BS=m
@@ -565,7 +638,6 @@ CONFIG_ROCKCHIP_IODOMAIN=y
CONFIG_ROCKCHIP_DTPM=m
CONFIG_ROCKCHIP_PM_DOMAINS=y
CONFIG_DEVFREQ_GOV_USERSPACE=m
CONFIG_EXTCON_PTN5150=m
CONFIG_EXTCON_USB_GPIO=y
CONFIG_MEMORY=y
CONFIG_IIO=y
@@ -578,6 +650,7 @@ CONFIG_IIO_ST_MAGN_3AXIS=m
CONFIG_MPL3115=m
CONFIG_PWM=y
CONFIG_PWM_ROCKCHIP=y
CONFIG_RESET_GPIO=y
CONFIG_PHY_ROCKCHIP_DPHY_RX0=m
CONFIG_PHY_ROCKCHIP_EMMC=y
CONFIG_PHY_ROCKCHIP_INNO_HDMI=m
@@ -590,8 +663,6 @@ CONFIG_PHY_ROCKCHIP_USB=m
CONFIG_POWERCAP=y
CONFIG_ARM_SCMI_POWERCAP=y
CONFIG_DTPM=y
CONFIG_DTPM_CPU=y
CONFIG_DTPM_DEVFREQ=y
CONFIG_ARM_SMMU_V3_PMU=m
CONFIG_NVMEM_RMEM=m
CONFIG_NVMEM_ROCKCHIP_EFUSE=m
@@ -603,30 +674,48 @@ CONFIG_INTERCONNECT=y
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
CONFIG_FANOTIFY=y
CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
CONFIG_QUOTA=y
CONFIG_OVERLAY_FS=m
CONFIG_AUTOFS_FS=y
CONFIG_FUSE_FS=y
CONFIG_VIRTIO_FS=y
CONFIG_OVERLAY_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_FAT_DEFAULT_UTF8=y
CONFIG_EXFAT_FS=y
CONFIG_PROC_KCORE=y
CONFIG_PROC_CHILDREN=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_HUGETLBFS=y
CONFIG_EFIVAR_FS=y
CONFIG_JFFS2_FS=y
CONFIG_JFFS2_FS_XATTR=y
CONFIG_SQUASHFS=y
CONFIG_SQUASHFS_LZO=y
CONFIG_SQUASHFS_XZ=y
CONFIG_SQUASHFS_ZSTD=y
CONFIG_NFS_FS=y
CONFIG_NFS_V4=y
CONFIG_NFS_V4_1=y
CONFIG_NFS_V4_2=y
CONFIG_ROOT_NFS=y
CONFIG_9P_FS=y
CONFIG_NLS_DEFAULT="iso8859-15"
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_ISO8859_15=y
CONFIG_NLS_UTF8=y
CONFIG_SECURITY=y
CONFIG_CRYPTO_DH=m
CONFIG_CRYPTO_CURVE25519=m
CONFIG_CRYPTO_ECHAINIV=y
CONFIG_CRYPTO_BLAKE2B=m
CONFIG_CRYPTO_XXHASH=m
CONFIG_CRYPTO_LZO=y
CONFIG_CRYPTO_ZSTD=y
CONFIG_CRYPTO_ANSI_CPRNG=y
CONFIG_CRYPTO_USER_API_RNG=m
CONFIG_CRYPTO_GHASH_ARM64_CE=y
@@ -635,20 +724,22 @@ CONFIG_CRYPTO_SHA2_ARM64_CE=y
CONFIG_CRYPTO_SHA512_ARM64_CE=m
CONFIG_CRYPTO_SHA3_ARM64=m
CONFIG_CRYPTO_SM3_ARM64_CE=m
CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
CONFIG_CRYPTO_AES_ARM64_BS=m
CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
CONFIG_CRYPTO_CRCT10DIF_ARM64_CE=m
CONFIG_CRYPTO_DEV_ROCKCHIP=y
CONFIG_CRYPTO_DEV_CCREE=m
CONFIG_PACKING=y
CONFIG_INDIRECT_PIO=y
CONFIG_CRC_CCITT=m
CONFIG_CRC8=y
CONFIG_DMA_CMA=y
CONFIG_CMA_SIZE_MBYTES=32
CONFIG_PRINTK_TIME=y
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_FS=y
CONFIG_DETECT_HUNG_TASK=y
# CONFIG_SCHED_DEBUG is not set
# CONFIG_FTRACE is not set
CONFIG_FUNCTION_TRACER=y
CONFIG_MEMTEST=y
@@ -0,0 +1,189 @@
{
"ieee802-dot1ab-lldp:lldp": {
"infix-lldp:enabled": true
},
"ietf-interfaces:interfaces": {
"interface": [
{
"name": "lo",
"type": "infix-if-type:loopback",
"ietf-ip:ipv4": {
"address": [
{
"ip": "127.0.0.1",
"prefix-length": 8
}
]
},
"ietf-ip:ipv6": {
"address": [
{
"ip": "::1",
"prefix-length": 128
}
]
}
},
{
"name": "lan",
"type": "infix-if-type:ethernet",
"ietf-ip:ipv4": {
"address": [
{
"ip": "192.168.2.1",
"prefix-length": 24
}
]
},
"ietf-ip:ipv6": {}
},
{
"name": "wan",
"type": "infix-if-type:ethernet"
}
]
},
"ietf-keystore:keystore": {
"asymmetric-keys": {
"asymmetric-key": [
{
"name": "genkey",
"public-key-format": "ietf-crypto-types:ssh-public-key-format",
"public-key": "",
"private-key-format": "ietf-crypto-types:rsa-private-key-format",
"cleartext-private-key": "",
"certificates": {}
}
]
}
},
"ietf-netconf-acm:nacm": {
"groups": {
"group": [
{
"name": "admin",
"user-name": [
"admin"
]
}
]
},
"rule-list": [
{
"name": "admin-acl",
"group": [
"admin"
],
"rule": [
{
"name": "permit-all",
"module-name": "*",
"access-operations": "*",
"action": "permit",
"comment": "Allow 'admin' group complete access to all operations and data."
}
]
}
]
},
"ietf-netconf-server:netconf-server": {
"listen": {
"endpoints": {
"endpoint": [
{
"name": "default-ssh",
"ssh": {
"tcp-server-parameters": {
"local-address": "::"
},
"ssh-server-parameters": {
"server-identity": {
"host-key": [
{
"name": "default-key",
"public-key": {
"central-keystore-reference": "genkey"
}
}
]
}
}
}
}
]
}
}
},
"ietf-system:system": {
"hostname": "r2s",
"ntp": {
"enabled": true,
"server": [
{
"name": "ntp.org",
"udp": {
"address": "pool.ntp.org"
}
}
]
},
"authentication": {
"user": [
{
"name": "admin",
"password": "$factory$",
"infix-system:shell": "bash"
}
]
},
"infix-system:motd-banner": "Li0tLS0tLS0uCnwgIC4gLiAgfCBJbmZpeCAtLSBhIE5ldHdvcmsgT3BlcmF0aW5nIFN5c3RlbQp8LS4gdiAuLXwgaHR0cHM6Ly9rZXJuZWxraXQuZ2l0aHViLmlvCictJy0tLSctJwo="
},
"infix-dhcp-client:dhcp-client": {
"client-if": [
{
"if-name": "wan",
"option": [
{
"name": "broadcast"
},
{
"name": "dns"
},
{
"name": "domain"
},
{
"name": "hostname"
},
{
"name": "ntpsrv"
},
{
"name": "router"
},
{
"name": "subnet"
}
]
}
]
},
"infix-meta:meta": {
"infix-meta:version": "1.0"
},
"infix-services:mdns": {
"enabled": true
},
"infix-services:web": {
"enabled": true,
"console": {
"enabled": true
},
"netbrowse": {
"enabled": true
},
"restconf": {
"enabled": true
}
}
}
@@ -0,0 +1 @@
../available/input-event-daemon.conf
@@ -0,0 +1 @@
service [12345789] log wan-monitor.sh -- WAN Health monitor
+91
View File
@@ -0,0 +1,91 @@
{
"input": {
"path": {
"locate": { "path": "/run/led/locate" },
"status-prime": { "path": "/run/led/status-prime" },
"status-ok": { "path": "/run/led/status-ok" },
"status-err": { "path": "/run/led/status-err" },
"status-crit": { "path": "/run/led/status-crit" },
"fault-prime": { "path": "/run/led/fault-prime" },
"fault-ok": { "path": "/run/led/fault-ok" },
"fault-err": { "path": "/run/led/fault-err" },
"fault-crit": { "path": "/run/led/fault-crit" },
"wan-up": { "path": "/run/led/wan-up" },
"startup": { "path": "/run/finit/cond/run/startup/success" },
"fail-safe": { "path": "/run/finit/cond/run/failure/success" },
"panic": { "path": "/run/finit/cond/run/failure/failure" }
},
"udev": {
"power-a": { "subsystem": "power_supply" },
"power-b": { "subsystem": "power_supply" }
}
},
"output": {
"led-group": {
"port-link-act": {
"match": ["*:green:tp", "*:green:sfp", "*:green:port" ],
"rules": [
{ "if": "true", "then": { "trigger": "netdev", "link": 1, "rx": 1, "tx": 1 } }
]
},
"port-alarm": {
"match": ["*:yellow:tp", "*:yellow:sfp", "*:yellow:port" ],
"rules": [
]
}
},
"led": {
"nanopi-r2s:red:sys": {
"rules": [
{ "if": "locate", "then": "@blink-1hz" },
{ "if": "panic", "then": "@blink-5hz" },
{ "if": "fail-safe", "then": "@blink-5hz" },
{ "if": "startup", "then": "@off" },
{ "if": "true", "then": "@blink-1hz" }
]
},
"nanopi-r2s:green:lan": {
"rules": [
{ "if": "locate", "then": "@blink-1hz" },
{ "if": "panic", "then": "@blink-5hz" },
{ "if": "startup", "then": "@on" }
]
},
"nanopi-r2s:green:wan": {
"rules": [
{ "if": "locate", "then": "@blink-1hz" },
{ "if": "panic", "then": "@blink-5hz" },
{ "if": "wan-up", "then": "@on" }
]
}
}
},
"aliases": {
"on": {
"brightness": true
},
"off": {
"brightness": false
},
"blink-1hz": {
"trigger": "timer",
"delay_on": 500,
"delay_off": 500
},
"blink-5hz": {
"trigger": "timer",
"delay_on": 100,
"delay_off": 100
}
}
}
@@ -0,0 +1,5 @@
[Global]
listen = /dev/input/event1
[Keys]
RESTART = reboot
@@ -0,0 +1,2 @@
ACTION=="add", SUBSYSTEM=="net", DEVPATH=="/devices/platform/ff540000.ethernet/net/eth0", NAME="wan"
ACTION=="add", SUBSYSTEM=="net", DEVPATH=="/devices/platform/ff600000.usb/xhci-hcd.0.auto/usb3/3-1/3-1:1.0/net/*", NAME="lan"
+41
View File
@@ -0,0 +1,41 @@
#!/bin/sh
# Background WAN interface monitor. Lights up WAN LED
# while the interface has a DHCP address.
LED_FILE="/run/led/wan-up"
PID_FILE="/run/$(basename "$0").pid"
check_wan()
{
ip_info=$(ip a show wan)
if echo "$ip_info" | grep -q "inet .* proto dhcp"; then
[ ! -f "$LED_FILE" ] && touch "$LED_FILE"
else
[ -f "$LED_FILE" ] && rm "$LED_FILE"
fi
}
cleanup()
{
rm -f "$LED_FILE"
rm -f "$PID_FILE"
exit 0
}
trap 'cleanup' TERM INT HUP QUIT
echo $$ > "$PID_FILE"
remaining_time=$((1800 - $(awk '{print int($1)}' /proc/uptime)))
[ "$remaining_time" -lt 0 ] && remaining_time=0
while [ "$remaining_time" -gt 0 ]; do
check_wan
sleep 1
remaining_time=$((remaining_time - 1))
done
while :; do
check_wan
sleep 5
done
+16
View File
@@ -0,0 +1,16 @@
CONFIG_BUTTON=y
CONFIG_BUTTON_GPIO=y
CONFIG_LED=y
CONFIG_LED_GPIO=y
# CONFIG_MMC_PCI is not set
CONFIG_DEVICE_TREE_INCLUDES="infix-env.dtsi infix-key.dtsi r2s-env.dtsi"
CONFIG_SYS_PROMPT="(r2s) "
CONFIG_ENV_OVERWRITE=y
# CONFIG_ENV_IS_NOWHERE is not set
CONFIG_ENV_IS_IN_EXT4=y
# CONFIG_ENV_IS_IN_MMC is not set
CONFIG_ENV_EXT4_INTERFACE="mmc"
CONFIG_ENV_EXT4_DEVICE_AND_PART="1:1"
+47
View File
@@ -0,0 +1,47 @@
/ {
config {
environment {
boot_targets = "mmc1";
ethprime = "eth0";
/* This is a development platform, hard code developer mode */
ixbtn-devmode = "setenv dev_mode yes; echo Enabled";
/* Override default definitiion to add LED feedback */
ixbtn-factory = "
if button factory-reset; then
echo \"Keep button pressed for 10 seconds to engage factory reset ...\"
for tick in . . . . . . . . . .; do
led nanopi-r2s:red:sys on
led nanopi-r2s:green:lan on
led nanopi-r2s:green:wan on
sleep 0.5
led nanopi-r2s:red:sys off
led nanopi-r2s:green:lan off
led nanopi-r2s:green:wan off
sleep 0.5
echo -n \"Checking button: \"
button factory-reset || exit
done
echo -n \"Final button check: \"
if button factory-reset; then
setenv factory_reset yes
echo \"FACTORY RESET ENGAGED\"
fi
fi
";
};
};
keys {
compatible = "gpio-keys";
factory-reset {
gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
linux,code = <KEY_POWER>;
label = "factory-reset";
};
};
};
+64
View File
@@ -0,0 +1,64 @@
Microchip SparX-5i PCB135 (eMMC)
================================
At present, only FIT images are supported via the SparX-5i eval
board's U-Boot, which must contain a valid load address. If you are
using this board, after selecting your base configuration, run the
following command to supplement the existing config with the required
FIT options:
make board-enable-sparx-fit
## Unbricking
1. Don't load a corrupt bootloader to begin with
2. Done
If, for some reason, you didn't manage to follow step 1, you can use
the `FLASH_PROG`(`J4`) connector on the board to access the SPI flash
directly.
Using a [Bus Blaster][BB3] in combination with [dangerspi][dangerspi],
you can load a new bootloader. The schematic below details how to
connect the Bus Blaster to the board, but the concept should be
portable to any debugger/device based around an FTDI2232 chip.
```
Bus Blaster: FLASH_PROG (J4):
.---. .---.
VTG >o o| VTG SCK >o o| GND
TRST |o o| GND MISO |o o| #RESET_FLASH
TDI |o o| GND o o| 3V3
TMS |o o| GND #CS |o o| #SYSRESET
TCK o o| GND MOSI |o o| GND
RTCK o o| GND '---'
TDO |o o| GND
TSRST |o o| GND
DBGRQ |o o| GND
DBGACK |o o| GND
'---'
```
| Bus Blaster | FLASH_PROG |
|-------------|----------------|
| `VTG` | `3V3` |
| `GND` | `GND` |
| | |
| `VTG` | `#RESET_FLASH` |
| `GND` | `#SYSRESET` |
| | |
| `TDI` | `MOSI` |
| `TMS` | `#CS` |
| `TCK` | `SCK` |
| `TDO` | `MISO` |
With the cable in place, build U-Boot with the correct configuration:
make fireant_boot_defconfig && make
To flash it to the board, connect the cable to `J4` and run:
make board-sparx-flash-uboot
[BB3]: http://dangerousprototypes.com/docs/Bus_Blaster#Bus_Blaster_v3
[dangerspi]: https://github.com/wkz/dangerspi
+38 -1
View File
@@ -18,7 +18,27 @@ endchoice
config SIGN_KEY
string "Signing key"
depends on SIGN_ENABLED
default "${BR2_EXTERNAL_INFIX_PATH}/board/common/dev-key" if SIGN_SRC_DIR
default "${BR2_EXTERNAL_INFIX_PATH}/board/common/signing-keys/development" if SIGN_SRC_DIR
menuconfig TRUSTED_KEYS
bool "Trusted keys for image"
depends on SIGN_ENABLED
help
Keys that will be accepted for this image
config TRUSTED_KEYS_DEVELOPMENT
bool "Development key"
depends on TRUSTED_KEYS
config TRUSTED_KEYS_DEVELOPMENT_PATH
string
depends on TRUSTED_KEYS_DEVELOPMENT
default "${BR2_EXTERNAL_INFIX_PATH}/board/common/signing-keys/development/infix.crt"
config TRUSTED_KEYS_EXTRA_PATH
string "Path to extra keys to include in image"
depends on TRUSTED_KEYS
menuconfig DISK_IMAGE
bool "Disk image"
@@ -87,6 +107,18 @@ config DISK_IMAGE_BOOT_OFFSET
to make sure that the GPT still fits at the start of the
image.
config DISK_IMAGE_TEST_MODE
bool "Enable Test Mode"
depends on DISK_IMAGE
default y
help
Enable the test mode option by default. This setting creates a test-mode flag
in the auxiliary partition of the disk image, initiating the system with the test-config
instead of regular startup-config. The primary purpose of running an image in this mode
is to ensure proper execution of all Infix tests. Additionally, it enables extra RPCs
related to system restart and configuration overrides, allowing tests to be run even on
systems where the factory configuration may potentially create L2 loops.
config DISK_IMAGE_RELEASE_URL
string "Infix URL"
depends on DISK_IMAGE
@@ -141,3 +173,8 @@ config FIT_KERNEL_LOAD_ADDR
string "Kernel load address"
depends on FIT_IMAGE
config SDCARD_AUX
bool "Create SD-card aux partition"
help
Create and populate aux.ext4 with rootfs.itbh and rauc.status
For use with a static genimage.cfg for, e.g., SD-cards.
+3 -1
View File
@@ -1,11 +1,13 @@
ifeq ($(SIGN_ENABLED),y)
include $(BR2_EXTERNAL_INFIX_PATH)/board/common/uboot/uboot.mk
TRUSTED_KEYS=$(TRUSTED_KEYS_DEVELOPMENT_PATH) $(TRUSTED_KEYS_EXTRA_PATH)
define RAUC_POST_BUILD_INSTALL_CERT
@$(call IXMSG,"Installing signing cert for RAUC")
mkdir -p $(TARGET_DIR)/etc/rauc/keys
$(foreach crt,$(shell ls $(SIGN_KEY)/*.crt), \
$(foreach crt,$(shell ls $(TRUSTED_KEYS)), \
cp $(crt) $(TARGET_DIR)/etc/rauc/keys/$(shell openssl x509 -hash -noout <$(crt)).0;)
endef
RAUC_POST_BUILD_HOOKS += RAUC_POST_BUILD_INSTALL_CERT
endif
+3
View File
@@ -44,16 +44,19 @@ image @DISKIMG@ {
partition aux {
offset = @AUXOFFS@
image = "aux.ext4"
partition-uuid = @AUXUUID@
}
partition primary {
image = "rootfs.squashfs"
size = @IMGSIZE@
partition-uuid = @PRIMARYUUID@
}
partition secondary {
image = "rootfs.squashfs"
size = @IMGSIZE@
partition-uuid = @SECONDARYUUID@
}
partition cfg {
+39
View File
@@ -0,0 +1,39 @@
#!/bin/sh
rootdir=$BUILD_DIR/genimage.root
tempdir=$BUILD_DIR/genimage.tmp
cat <<EOF > /tmp/mkaux.cfg
image aux.ext4 {
mountpoint = "/aux"
size = 16M
ext4 {
label = "aux"
use-mke2fs = true
features = "^metadata_csum,^metadata_csum_seed"
}
}
# Silence genimage warnings
config {}
EOF
rm -rf "$rootdir/aux"
mkdir -p "$rootdir/aux"
cp -f "$BINARIES_DIR/rootfs.itbh" "$rootdir/aux/primary.itbh"
cp -f "$BINARIES_DIR/rootfs.itbh" "$rootdir/aux/secondary.itbh"
cp -f "$BINARIES_DIR/rauc.status" "$rootdir/aux/rauc.status"
mkenvimage -s 0x4000 -o "$rootdir/aux/uboot.env" \
"$BR2_EXTERNAL_INFIX_PATH/board/common/uboot/aux-env.txt"
rm -rf "$BINARIES_DIR/aux.ext4"
rm -rf "$tempdir"
genimage \
--rootpath "$rootdir" \
--tmppath "$tempdir" \
--inputpath "$BINARIES_DIR" \
--outputpath "$BINARIES_DIR" \
--config "/tmp/mkaux.cfg"
+19 -2
View File
@@ -1,7 +1,8 @@
#!/bin/sh
set -e
. $BR2_EXTERNAL_INFIX_PATH/board/common/rootfs/etc/partition-uuid
K=10
M=20
G=30
@@ -127,7 +128,7 @@ diskimg=disk.img
bootimg=
bootpart=
while getopts "a:b:B:n:s:" opt; do
while getopts "a:b:B:n:s:t" opt; do
case ${opt} in
a)
arch=$OPTARG
@@ -144,6 +145,9 @@ while getopts "a:b:B:n:s:" opt; do
s)
total=$(size2int $OPTARG)
;;
t)
testmode=true
;;
esac
done
shift $((OPTIND - 1))
@@ -157,6 +161,9 @@ genboot
# Use awk over sed because replacement text may contain newlines,
# which sed does not approve of.
awk \
-vauxuuid=$AUX_UUID \
-vprimaryuuid=$PRIMARY_UUID \
-vsecondaryuuid=$SECONDARY_UUID \
-vtotal=$total \
-vauxsize=$auxsize -vauxoffs=$auxoffs \
-vimgsize=$imgsize \
@@ -174,6 +181,10 @@ awk \
sub(/@DISKIMG@/, diskimg);
sub(/@BOOTIMG@/, bootimg);
sub(/@BOOTPART@/, bootpart);
sub(/@AUXUUID@/, auxuuid);
sub(/@PRIMARYUUID@/, primaryuuid);
sub(/@SECONDARYUUID@/, secondaryuuid);
}1' \
< $common/genimage.cfg.in >$root/genimage.cfg
@@ -182,6 +193,12 @@ cp -f $BINARIES_DIR/rootfs.itbh $root/aux/primary.itbh
cp -f $BINARIES_DIR/rootfs.itbh $root/aux/secondary.itbh
cp -f $BINARIES_DIR/rauc.status $root/aux/rauc.status
if [ "$testmode" = true ]; then
touch "$root/aux/test-mode"
else
rm -f "$root/aux/test-mode"
fi
case "$arch" in
aarch64)
mkenvimage -s 0x4000 -o "$root/aux/uboot.env" \
+12 -12
View File
@@ -2,30 +2,30 @@
set -e
GIT_VERSION=$(git -C $BR2_EXTERNAL_INFIX_PATH describe --always --dirty --tags)
GIT_VERSION=$(git -C "$BR2_EXTERNAL_INFIX_PATH" describe --always --dirty --tags)
name=$1
arch=$2
compat=$2
sign=$3
crt=$(ls $sign/*.crt)
key=$(ls $sign/*.key)
common=$(dirname $(readlink -f "$0"))
common=$(dirname "$(readlink -f "$0")")
work=$BUILD_DIR/mkrauc
mkdir -p $work
mkdir -p "$work"
cp -f $common/rauc-hooks.sh $work/hooks.sh
cp -f "$common/rauc-hooks.sh" "$work/hooks.sh"
# RAUC internally uses the file extension to find a suitable install
# handler, hence the name must be .img
cp -f $BINARIES_DIR/rootfs.squashfs $work/rootfs.img
cp -f $BINARIES_DIR/rootfs.itbh $work/rootfs.itbh
cp -f "$BINARIES_DIR/rootfs.squashfs" "$work/rootfs.img"
cp -f "$BINARIES_DIR/rootfs.itbh" "$work/rootfs.itbh"
cat >$work/manifest.raucm <<EOF
cat >"$work/manifest.raucm" <<EOF
[update]
compatible=infix-${arch}
compatible=${compat}
version=${GIT_VERSION}
[bundle]
@@ -39,7 +39,7 @@ filename=rootfs.img
hooks=post-install
EOF
rm -f $BINARIES_DIR/$name.pkg
rm -f "$BINARIES_DIR/$name.pkg"
rauc --cert=$crt --key=$key \
bundle $work $BINARIES_DIR/$name.pkg
rauc --cert="$crt" --key="$key" \
bundle "$work" "$BINARIES_DIR/$name.pkg"
+49
View File
@@ -4,6 +4,37 @@ common=$(dirname "$(readlink -f "$0")")
. "$BR2_CONFIG" 2>/dev/null
. "$TARGET_DIR/usr/lib/os-release"
# Extract list of loaded YANG modules and their features for yangdoc.html
mkyangdoc()
{
cmd="yangdoc -o $1 -p $TARGET_DIR/usr/share/yang"
# shellcheck disable=SC2155
export SYSREPO_SHM_PREFIX="yangdoc"
while IFS= read -r line; do
if echo "$line" | grep -q '^[a-z]'; then
module=$(echo "$line" | awk '{print $1}')
cmd="$cmd -m $module"
feature=$(echo "$line" | awk -F'|' '{print $8}' | sed 's/^ *//;s/ *$//')
if [ -n "$feature" ]; then
feature_list=$(echo "$feature" | tr ' ' '\n')
for feat in $feature_list; do
cmd="$cmd -e $feat"
done
fi
fi
done <<EOF
$(sysrepoctl -l; rm -f /dev/shm/${SYSREPO_SHM_PREFIX}*)
EOF
# Ignore a few top-level oddballs not used by core Infix
cmd="$cmd -x supported-algorithms"
# Execute the command
echo "Calling: $cmd"
$cmd
}
if [ -n "${ID_LIKE}" ]; then
ID="${ID} ${ID_LIKE}"
fi
@@ -24,6 +55,16 @@ else
VERSION=$GIT_VERSION
fi
if [ -n "$INFIX_IMAGE_ID" ]; then
NAME="$INFIX_IMAGE_ID"
else
NAME="$INFIX_ID"-$(echo "$BR2_ARCH" | tr _ - | sed 's/x86-64/x86_64/')
fi
if [ -f "$TARGET_DIR/etc/rauc/system.conf" ]; then
sed -i "s/compatible=.*/compatible=$NAME/" "$TARGET_DIR/etc/rauc/system.conf"
fi
# This is a symlink to /usr/lib/os-release, so we remove this to keep
# original Buildroot information.
rm -f "$TARGET_DIR/etc/os-release"
@@ -69,6 +110,9 @@ if [ -L "$TARGET_DIR/var/lib/avahi-autoipd" ]; then
mkdir "$TARGET_DIR/var/lib/avahi-autoipd"
fi
# Drop Buildroot default pam_lastlog.so from login chain
sed -i '/^[^#]*pam_lastlog.so/s/^/# /' "$TARGET_DIR/etc/pam.d/login"
# Allow pdmenu (setup) and bash to be login shells, bash is added
# automatically when selected in menuyconfig, but not when BusyBox
# provides a symlink (for ash). The /bin/{true,false} are old UNIX
@@ -85,3 +129,8 @@ grep -qsE '^/bin/false$$' "$TARGET_DIR/etc/shells" \
# Allow clish (symlink to /usr/bin/klish) to be a login shell
grep -qsE '^/bin/clish$$' "$TARGET_DIR/etc/shells" \
|| echo "/bin/clish" >> "$TARGET_DIR/etc/shells"
# Create YANG documentation
if [ "$BR2_PACKAGE_HOST_PYTHON_YANGDOC" = "y" ]; then
mkyangdoc "$BINARIES_DIR/yangdoc.html"
fi
+19 -3
View File
@@ -12,6 +12,9 @@ load_cfg BR2_ARCH
load_cfg BR2_DEFCONFIG
load_cfg BR2_EXTERNAL_INFIX_PATH
load_cfg BR2_TARGET_ROOTFS
# The default IMAGE_ID is infix-$BR2_ARCH but can be overridden
# for imaage names, and compat strings, like infix-r2s
if [ -n "$IMAGE_ID" ]; then
NAME="$IMAGE_ID"
else
@@ -36,7 +39,7 @@ if [ "$SIGN_ENABLED" = "y" ]; then
$common/sign.sh $BR2_ARCH $SIGN_KEY
ixmsg "Creating RAUC Update Bundle"
$common/mkrauc.sh "$NAME$(ver)" $BR2_ARCH $SIGN_KEY
$common/mkrauc.sh "$NAME$(ver)" $NAME $SIGN_KEY
fi
load_cfg DISK_IMAGE
@@ -56,8 +59,21 @@ if [ "$DISK_IMAGE" = "y" ]; then
tar -xa --strip-components=1 -C "$BINARIES_DIR" -f "$archive"
fi
testmode_flag=""
if [ "$DISK_IMAGE_TEST_MODE" = "y" ]; then
testmode_flag="-t"
fi
$common/mkrauc-status.sh "$BINARIES_DIR/${NAME}.pkg" >"$BINARIES_DIR/rauc.status"
$common/mkdisk.sh -a $BR2_ARCH -n $diskimg -s $DISK_IMAGE_SIZE $bootcfg
$common/mkdisk.sh -a $BR2_ARCH -n $diskimg $testmode_flag -s $DISK_IMAGE_SIZE $bootcfg
fi
load_cfg SDCARD_AUX
if [ "$SDCARD_AUX" = "y" ]; then
ixmsg "Creating initial rauc.status"
$common/mkrauc-status.sh "$BINARIES_DIR/${NAME}.pkg" >"$BINARIES_DIR/rauc.status"
ixmsg "Creating aux.ext4 for sdcard.img"
$common/mkaux.sh
fi
load_cfg GNS3_APPLIANCE
@@ -81,7 +97,7 @@ if [ "$BR2_TARGET_ROOTFS_SQUASHFS" = "y" ]; then
fi
# Menuconfig support for modifying Qemu args in release tarballs
cp "$BR2_EXTERNAL_INFIX_PATH/board/common/rootfs/bin/onieprom" "$BINARIES_DIR/"
cp "$BR2_EXTERNAL_INFIX_PATH/board/common/rootfs/usr/bin/onieprom" "$BINARIES_DIR/"
cp "$BR2_EXTERNAL_INFIX_PATH/board/common/qemu/qemu.sh" "$BINARIES_DIR/"
sed -e "s/@ARCH@/QEMU_$BR2_ARCH/" \
-e "s/@DISK_IMG@/$diskimg/" \
+9 -4
View File
@@ -4,6 +4,10 @@ choice
prompt "Target Architecture"
default @ARCH@
config QEMU_riscv64
bool "risv64"
select QEMU_ARCH_IS_64
config QEMU_x86_64
bool "x86_64"
select QEMU_ARCH_IS_64
@@ -54,11 +58,10 @@ choice
config QEMU_CONSOLE_VIRTIO
bool "Virtio (hvc0)"
depends on QEMU_LOADER_KERNEL
config QEMU_CONSOLE_SERIAL
bool "Serial (ttyS0/ttyAMA0)"
depends on !QEMU_LOADER_OVMF
endchoice
config QEMU_MACHINE
@@ -109,10 +112,12 @@ config QEMU_RW
default "cfg.ext4"
config QEMU_RW_VAR_OPT
bool "Separate writable /var (256MB)"
bool "Separate writable /var"
if QEMU_RW_VAR_OPT
config QEMU_RW_VAR_SIZE
string "Size of /var"
default "256M"
config QEMU_RW_VAR
string "Writable /var layer"
default "var.ext4"
+39 -14
View File
@@ -117,7 +117,7 @@ rootfs_args()
echo -n "-device sd-card,drive=mmc "
echo -n "-drive id=mmc,file=$CONFIG_QEMU_ROOTFS,if=none,format=raw "
elif [ "$CONFIG_QEMU_ROOTFS_VSCSI" = "y" ]; then
echo -n "-drive file=$CONFIG_QEMU_ROOTFS,if=virtio,format=raw,bus=0,unit=0 "
echo -n "-drive file=$CONFIG_QEMU_ROOTFS.qcow2,if=virtio,format=qcow2,bus=0,unit=0 "
fi
}
@@ -146,16 +146,31 @@ usb_args()
USBSTICK="usb.vfat"
if ! [ -f $USBSTICK ]; then
dd if=/dev/zero of=${USBSTICK} bs=8M count=1 >/dev/null 2>&1
mkfs.vfat $USBSTICK >/dev/null 2>&1
if command -v mkfs.vfat >/dev/null; then
mkfs.vfat -n "log" $USBSTICK >/dev/null 2>&1
else
if command -v mkfs.exfat >/dev/null; then
mkfs.exfat -L "log" $USBSTICK >/dev/null 2>&1
fi
fi
fi
echo -n "-drive if=none,id=usbstick,format=raw,file=${USBSTICK} "
echo -n "-drive if=none,id=usbstick,format=raw,file=$USBSTICK "
echo -n "-usb "
echo -n "-device usb-ehci,id=ehci "
echo -n "-device usb-storage,bus=ehci.0,drive=usbstick "
}
rw_args()
{
[ "$CONFIG_QEMU_RW" ] || return
[ "$CONFIG_QEMU_RW" ] || return
if ! [ -f "aux.ext4" ]; then
dd if=/dev/zero of="aux.ext4" bs=1M count=1 >/dev/null 2>&1
mkfs.ext4 -L aux "aux.ext4" >/dev/null 2>&1
fi
echo -n "-drive file=aux.ext4,if=virtio,format=raw,bus=0,unit=3 "
if ! [ -f "$CONFIG_QEMU_RW" ]; then
dd if=/dev/zero of="$CONFIG_QEMU_RW" bs=16M count=1 >/dev/null 2>&1
@@ -166,7 +181,7 @@ rw_args()
if [ "$CONFIG_QEMU_RW_VAR_OPT" ]; then
if ! [ -f "$CONFIG_QEMU_RW_VAR" ]; then
dd if=/dev/zero of="$CONFIG_QEMU_RW_VAR" bs=256M count=1 >/dev/null 2>&1
dd if=/dev/zero of="$CONFIG_QEMU_RW_VAR" bs=$CONFIG_QEMU_RW_VAR_SIZE count=1 >/dev/null 2>&1
mkfs.ext4 -L var "$CONFIG_QEMU_RW_VAR" >/dev/null 2>&1
fi
@@ -198,10 +213,10 @@ net_args()
echo -n "-fw_cfg name=opt/mactab,file=$mactab "
if [ "$CONFIG_QEMU_NET_BRIDGE" = "y" ]; then
echo -n "-netdev bridge,id=e0,br=$CONFIG_QEMU_NET_BRIDGE_DEV "
net_dev_args 0
echo -n "-netdev bridge,id=e1,br=$CONFIG_QEMU_NET_BRIDGE_DEV "
net_dev_args 1
elif [ "$CONFIG_QEMU_NET_TAP" = "y" ]; then
for i in $(seq 0 $(($CONFIG_QEMU_NET_TAP_N - 1))); do
for i in $(seq 1 $(($CONFIG_QEMU_NET_TAP_N))); do
echo -n "-netdev tap,id=e$i,ifname=qtap$i "
net_dev_args $i
done
@@ -209,8 +224,8 @@ net_args()
local useropts=
[ "$CONFIG_QEMU_NET_USER_OPTS" ] && useropts=",$CONFIG_QEMU_NET_USER_OPTS"
echo -n "-netdev user,id=e0${useropts} "
net_dev_args 0
echo -n "-netdev user,id=e1${useropts} "
net_dev_args 1
else
echo -n "-nic none"
fi
@@ -249,8 +264,17 @@ wdt_args()
echo -n "-device i6300esb -rtc clock=host"
}
gdb_args()
{
echo -n "-chardev socket,id=gdbqemu,path=gdbqemu.sock,server=on,wait=off "
echo -n "-gdb chardev:gdbqemu"
}
run_qemu()
{
if [ "$CONFIG_QEMU_ROOTFS_VSCSI" = "y" ]; then
qemu-img create -f qcow2 -o backing_file=$CONFIG_QEMU_ROOTFS -F raw $CONFIG_QEMU_ROOTFS.qcow2 > /dev/null
fi
local qemu
read qemu <<EOF
$CONFIG_QEMU_MACHINE -m $CONFIG_QEMU_MACHINE_RAM \
@@ -263,6 +287,7 @@ run_qemu()
$(net_args) \
$(wdt_args) \
$(vpd_args) \
$(gdb_args) \
$CONFIG_QEMU_EXTRA
EOF
@@ -303,10 +328,10 @@ generate_dot()
{
[ "$CONFIG_QEMU_NET_TAP" = "y" ] || return
hostports="<qtap0> qtap0"
targetports="<e0> e0"
edges="host:qtap0 -- target:e0 [kind=mgmt];"
for tap in $(seq 1 $(($CONFIG_QEMU_NET_TAP_N - 1))); do
hostports="<qtap1> qtap1"
targetports="<e1> e1"
edges="host:qtap1 -- target:e1 [kind=mgmt];"
for tap in $(seq 2 $(($CONFIG_QEMU_NET_TAP_N - 1))); do
hostports="$hostports | <qtap$tap> qtap$tap "
targetports="$targetports | <e$tap> e$tap "
edges="$edges host:qtap$tap -- target:e$tap;"
-67
View File
@@ -1,67 +0,0 @@
#!/usr/bin/env python3
# Generate a self signed certificate with unlimited expire time
import argparse
from cryptography import x509
from cryptography.x509.oid import NameOID
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.backends import default_backend
from datetime import datetime, timedelta
# Generate private key
private_key = rsa.generate_private_key(
public_exponent=65537,
key_size=2048,
backend=default_backend()
)
parser = argparse.ArgumentParser(description="Generate a self signed certificate")
parser.add_argument('--country', required=True, help="Set country")
parser.add_argument('--state', required=True, help="Set state or province name")
parser.add_argument('--city', required=True, help="Set city name")
parser.add_argument('--organisation', required=True, help="Set organisation name")
parser.add_argument('--organisation-unit', required=True, help="Set organisation unit name")
parser.add_argument('--common-name', required=True, help="Set common name")
parser.add_argument('--out-certificate', required=True, help="Output certificate")
parser.add_argument('--out-key', required=True, help="Output key")
args = parser.parse_args()
# Builder for certificate
subject = issuer = x509.Name([
x509.NameAttribute(NameOID.COUNTRY_NAME, args.country),
x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, args.state),
x509.NameAttribute(NameOID.LOCALITY_NAME, args.city),
x509.NameAttribute(NameOID.ORGANIZATION_NAME, args.organisation),
x509.NameAttribute(NameOID.ORGANIZATIONAL_UNIT_NAME, args.organisation_unit),
x509.NameAttribute(NameOID.COMMON_NAME, args.common_name),
])
certificate = x509.CertificateBuilder().subject_name(
subject
).issuer_name(
issuer
).public_key(
private_key.public_key()
).serial_number(
x509.random_serial_number()
).not_valid_before(
datetime(2000, 1, 1)
).not_valid_after(
datetime(9999, 1, 1)
).add_extension(
x509.SubjectAlternativeName([x509.DNSName(args.common_name)]),
critical=False,
).sign(private_key, hashes.SHA256(), default_backend())
# Serialize certificate and private key
with open(args.out_certificate, "wb") as f:
f.write(certificate.public_bytes(serialization.Encoding.PEM))
with open(args.out_key, "wb") as f:
f.write(private_key.private_bytes(
encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.PKCS8,
encryption_algorithm=serialization.NoEncryption()
))
-1
View File
@@ -1 +0,0 @@
/sbin/ip
-5
View File
@@ -1,5 +0,0 @@
#!/bin/sh
sleep 30
stress-ng --cpu 8 --io 4 --vm 2 --vm-bytes 128M --fork 4 -t 0
-76
View File
@@ -1,76 +0,0 @@
#!/bin/sh
tstamp()
{
if [ "$1" = "head" ]; then
printf '%9s' time
else
printf '%9s' $(date +%T)
fi
}
thermal()
{
for th in /sys/class/thermal/thermal_zone*; do
if [ "$1" = "head" ]; then
printf '%5s' $(cat $th/type | \
sed -e 's/-thermal//' -e 's/ap-cpu/cpu/' -e 's/-ic//')
else
printf '%5d' \
$((($(cat $th/temp) + 500) / 1000))
fi
done
}
hwmon()
{
for hw in /sys/class/hwmon/*; do
[ -f $hw/temp1_input ] || continue
if [ "$1" = "head" ]; then
printf '%5s' \
$(cat $hw/name | sed -e 's/cp0configspacef2000000mdio12a200switch0mdio0/p/' -e 's/f212a600mdiomii0/xp/')
else
printf '%5d' \
$((($(cat $hw/temp1_input) + 500) / 1000))
fi
done
}
xphys()
{
for xphy in 4 5; do
mdio f212a6* $xphy:31 0xf08a 0x4d00
if [ "$1" = "head" ]; then
printf '%5s' \
p$((xphy + 5))
else
printf '%5d' \
$(($(mdio f212a6* $xphy:31 0xf08a) & 0xff - 75))
fi
done
}
if [ "$1" != "-H" ]; then
# tstamp head
thermal head
hwmon head
# xphys head
echo
fi
while :; do
# tstamp
thermal
hwmon
# xphys
echo
if [ "$1" == "-n" ]; then
sleep ${2:-10}
else
break
fi
done
+28
View File
@@ -1,3 +1,4 @@
# Hey Emacs, this is -*-sh-*-
# System-wide .bashrc file for interactive bash(1) shells.
# If not running interactively, don't do anything
@@ -13,3 +14,30 @@ export PROMPT_COMMAND=prompt_command
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
log()
{
local fn="/var/log/syslog"
[ -n "$1" ] && fn="/var/log/$1"
less +G "$fn"
}
follow()
{
local fn="/var/log/syslog"
[ -n "$1" ] && fn="/var/log/$1"
tail -F "$fn"
}
_logfile_completions()
{
local cur=${COMP_WORDS[COMP_CWORD]}
local files=$(compgen -f -- "/var/log/$cur")
COMPREPLY=()
for file in $files; do
[ -f "$file" ] && COMPREPLY+=("$(basename "$file")")
done
}
complete -F _logfile_completions log
complete -F _logfile_completions follow
@@ -1,3 +1,3 @@
run [S] log:console /libexec/infix/probe -- Probing system information
run [S] <pid/syslogd> /libexec/infix/sysctl-sync-ip-conf --
run [S] <pid/syslogd> /libexec/infix/nameif -- Probing network interfaces
task name:ixinit log:tag:ixinit [S] <pid/syslogd> \
/usr/libexec/finit/runparts -bp /usr/libexec/infix/init.d \
-- Probing system
@@ -1,4 +1,4 @@
service :%i pid:!/run/k8s-logger-%i.pid <usr/container:%i> \
[2345] k8s-logger -cni %i -f local1 /run/containers/%i.fifo -- Logger for container %i
sysv :%i pid:!/run/container:%i.pid <pid/k8s-logger:%i> kill:10 \
sysv :%i pid:!/run/container:%i.pid <pid/k8s-logger:%i> log kill:10 \
[2345] container -n %i -- container %i
@@ -1 +1 @@
task [S] <service/confd/ready> /libexec/infix/mkcert -- Verifying self-signed https certificate
task [S] <service/confd/ready> /usr/libexec/infix/mkcert -- Verifying self-signed https certificate
@@ -0,0 +1,3 @@
service name:rousette notify:none log <pid/confd> \
[12345] rousette --syslog -t 60 \
-- RESTCONF server
@@ -1,3 +0,0 @@
service [2345789] log:/var/log/temp.log /bin/temp.sh -n 10 -- Temperature monitor
service [2345789] log:/var/log/load.log /bin/load.sh -- CPU load generator
service [2345789] log:/var/log/memtester.log /usr/bin/memtester 1G -- Memory load generator
@@ -1 +0,0 @@
../available/temp.conf
+3 -2
View File
@@ -7,16 +7,17 @@ tmpfs /dev/shm tmpfs mode=0777 0 0
proc /proc proc defaults 0 0
tmpfs /tmp tmpfs mode=1777,nosuid,nodev 0 0
tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
tmpfs /media tmpfs mode=1755,nosuid,nodev 0 0
sysfs /sys sysfs defaults 0 0
debugfs /sys/kernel/debug debugfs nofail 0 0
cfgfs /config configfs nofail,noauto 0 0
# The chosen backing storage for the overlays placed on /cfg, /etc,
# /home, /root, and /var, are determined dynamically by /libexec/infix/mnt
# /home, /root, and /var, are determined dynamically by /usr/libexec/infix/mnt
# depending on the available devices.
mnttmp /mnt/tmp tmpfs defaults 0 0
LABEL=aux /mnt/aux auto noatime,nodiratime,noauto 0 0
LABEL=var /mnt/var auto noatime,nodiratime,noauto 0 0
LABEL=cfg /mnt/cfg auto noatime,nodiratime,noauto 0 0
hostfs /mnt/host 9p cache=none,msize=16384,noauto 0 0
/libexec/infix/mnt# /cfg helper none 0 0
/usr/libexec/infix/mnt# /cfg helper none 0 0
@@ -1,3 +1,7 @@
0 unspec
1 kernel_lo
2 kernel_ra
3 kernel_ll
4 static
5 dhcp
6 random
@@ -0,0 +1 @@
configure ports dsa0 lldp status disabled
+1 -1
View File
@@ -1,4 +1,4 @@
.-------.
| . . | Infix -- a Network Operating System
|-. v .-| https://kernelkit.github.io
|-. v .-| https://kernelkit.org
'-'---'-'
@@ -24,4 +24,6 @@ server {
root html;
index index.html index.htm;
}
include /etc/nginx/app/*.conf;
}
@@ -5,14 +5,6 @@ server {
include ssl.conf;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
include /etc/nginx/netbrowse.conf;
}
}
@@ -0,0 +1,6 @@
location /netbrowse/ {
return 301 /netbrowse;
}
location /netbrowse {
include /etc/nginx/netbrowse.conf;
}
@@ -0,0 +1,9 @@
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
@@ -0,0 +1,8 @@
# /telemetry/optics is for streaming (not used atm)
location ~ ^/(restconf|yang|.well-known)/ {
grpc_pass grpc://[::1]:10080;
grpc_set_header Host $host;
grpc_set_header X-Real-IP $remote_addr;
grpc_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
grpc_set_header X-Forwarded-Proto $scheme;
}
@@ -0,0 +1,19 @@
#%PAM-1.0
auth requisite pam_nologin.so
auth [success=1 default=ignore] pam_unix.so nullok
auth requisite pam_deny.so
auth required pam_permit.so
account requisite pam_nologin.so
account [success=1 default=ignore] pam_unix.so
account requisite pam_deny.so
account required pam_permit.so
password [success=1 default=ignore] pam_unix.so
password requisite pam_deny.so
password required pam_permit.so
session required pam_loginuid.so
session include common-session
session optional pam_keyinit.so force revoke
session optional pam_motd.so
+19
View File
@@ -0,0 +1,19 @@
#%PAM-1.0
auth requisite pam_nologin.so
auth [success=1 default=ignore] pam_unix.so nullok
auth requisite pam_deny.so
auth required pam_permit.so
account requisite pam_nologin.so
account [success=1 default=ignore] pam_unix.so
account requisite pam_deny.so
account required pam_permit.so
password [success=1 default=ignore] pam_unix.so
password requisite pam_deny.so
password required pam_permit.so
session required pam_loginuid.so
session include common-session
session optional pam_keyinit.so force revoke
session optional pam_motd.so
+3
View File
@@ -0,0 +1,3 @@
AUX_UUID="78460f84-de84-4fe7-89bd-4c1f433b2230"
PRIMARY_UUID="107ae911-a97b-4380-975c-7ce1a2dde1e0"
SECONDARY_UUID="352bd9b2-2ca9-44e2-bdc7-edbc87ba1e02"
@@ -6,6 +6,7 @@ alias ls='ls --color=auto'
export EDITOR=/usr/bin/edit
export VISUAL=/usr/bin/edit
export LESS="-P %f (press h for help or q to quit)"
export LESSOPEN="|/usr/bin/lesspipe.sh %s"
alias vim='vi'
alias view='vi -R'
alias emacs='mg'
@@ -0,0 +1 @@
UsePAM yes
@@ -1,2 +1,3 @@
net.ipv4.ip_forward=1
net.ipv4.ip_forward_update_priority=0
net.ipv6.conf.all.forwarding=1
+84
View File
@@ -0,0 +1,84 @@
# /etc/syslog.conf - Configuration file for syslogd(8)
#
# For information about the format of this file, see syslog.conf(5)
#
#
# First some standard log files. Log by facility.
#
auth,authpriv.* /var/log/auth.log
#*.*;auth,authpriv.none -/var/log/syslog
#cron.* /var/log/cron.log
#daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
#lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
#user.* -/var/log/user.log
#
# Logging for the mail system. Split it up so that
# it is easy to write scripts to parse these files.
#
#mail.info -/var/log/mail.info
#mail.warn -/var/log/mail.warn
mail.err /var/log/mail.err
#mail.*;mail.!=info -/var/log/mail
#mail,news.=info -/var/log/info
# The tcp wrapper loggs with mail.info, we display all
# the connections on tty12
#
#mail.=info /dev/tty12
#
# Some "catch-all" log files.
#
#*.=debug;\
# auth,authpriv.none;\
# news.none;mail.none -/var/log/debug
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
cron,daemon.none;\
mail,news.none -/var/log/messages
#
# Store all critical events, except kernel logs, in critical RFC5424 format.
# Overide global log rotation settings, rotate every 10MiB, keep 5 old logs,
#
#*.=crit;kern.none /var/log/critical ;rotate=10M:5,RFC5424
# Example of sending events to remote syslog server.
# All events from notice and above, except auth, authpriv
# and any kernel message are sent to server finlandia in
# RFC5424 formatted output.
#
#*.notice;auth,authpriv.none;
# kern.none\ @finlandia ;RFC5424
# Emergencies are sent to anyone logged in
#
*.=emerg *
# Priority alert and above are sent to the operator
#
#*.alert root,joey
#
# Secure mode, same as -s, none(0), on(1), full(2). When enabled
# only logging to remote syslog server possible, with full secure
# mode, not even that is possible. We default to prevent syslogd
# from opening UDP/514 and receving messages from other systems.
#
secure_mode 1
#
# Global log rotation, same as -r SIZE:COUNT, command line wins.
#
#rotate_size 1M
#rotate_count 5
#
# Include all config files in /etc/syslog.d/
#
include /etc/syslog.d/*.conf
@@ -0,0 +1,2 @@
rotate_size 1M
rotate_count 10
@@ -0,0 +1,2 @@
# Log critical and above to console, system likely unusable.
*.=crit;*.=alert;*.=emerg /dev/console
@@ -0,0 +1,10 @@
Reserved facilities for logging in various subsystems:
- local0: rauc
- local1: containers
- local2: routing (frr)
- local3:
- local5:
- local6: reserved
- local7: nginx
@@ -0,0 +1 @@
local2.* -/var/log/routing
@@ -0,0 +1,3 @@
# Skip debug level messages in our /var/log/syslog, we have a dedicate
# debug log instead, as well as facility specific logs, e.g., routing
*.info;auth,authpriv.none -/var/log/syslog
@@ -0,0 +1,5 @@
KERNEL=="sd[a-z]", SUBSYSTEMS=="usb", ACTION=="add|change", RUN+="/usr/libexec/infix/media add %k"
KERNEL=="sd[a-z]", SUBSYSTEMS=="usb", ACTION=="remove", RUN+="/usr/libexec/infix/media del %k"
KERNEL=="sd[a-z][0-9]", SUBSYSTEMS=="usb", ACTION=="add|change", RUN+="/usr/libexec/infix/media add %k"
KERNEL=="sd[a-z][0-9]", SUBSYSTEMS=="usb", ACTION=="remove", RUN+="/usr/libexec/infix/media del %k"
@@ -1,17 +0,0 @@
#!/bin/sh
# When changing default IPv4/6 settings, this does not apply to
# existing interfaces. This syncs the default settings to all known
# interfaces at boot, such that physical interfaces will start from
# the same point as virtual ones.
tmp=$(mktemp)
sysctl net.ipv4.conf.default >$tmp
sysctl net.ipv6.conf.default >>$tmp
for iface in $(ip -j link show | jq -r .[].ifname); do
sed -e "s/.default./.${iface}./g" $tmp | sysctl -p -
done
rm $tmp
@@ -19,5 +19,5 @@ if [ -z "$OUTPUT" ]; then
fi
umask 0177
echo "$password" | mkpasswd > "$OUTPUT"
echo "$password" | mkpasswd -s > "$OUTPUT"
exit 0
+27
View File
@@ -0,0 +1,27 @@
#!/bin/sh
dir()
{
path=$1
if [ -z "$COLUMS" ]; then
TTY=$(resize)
eval "$TTY"
fi
printf "\033[7m%-*s\033[0m\n" "$COLUMNS" "$path directory"
if [ -d "$path" ]; then
ls -p "$path/"
else
echo "Directory $path does not exist."
fi
echo
}
if [ -d "$1" ]; then
dir "$1"
else
dir "$HOME"
dir "/cfg"
dir "/log"
fi
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
# Silly wrapper around sudo to prevent it from printing an error for
# unprivileged users: sudo: a password is required
id -nG $LOGNAME | grep -qw wheel && sudo -n $@
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
case "$1" in
*.gz)
zcat "$1"
;;
*)
cat "$1"
;;
esac
@@ -0,0 +1 @@
d /var/run/frr 0755 frr frr -
@@ -3,12 +3,13 @@
import importlib.machinery
import json
import os
import shutil
import struct
import subprocess
import sys
onieprom = importlib.machinery.SourceFileLoader("onieprom","/bin/onieprom").load_module()
SYSTEM_JSON = "/run/system.json"
KKIT_IANA_PEM = 61046
class DTSystem:
@@ -233,8 +234,36 @@ def vpd_inject(out, vpds):
out["factory-password-hash"] = pwhash
break
def qemu_base_mac():
"""Find MAC address of first non-loopback interface, subtract with 1"""
base_path = '/sys/class/net'
interfaces = []
for iface in os.listdir(base_path):
if iface == 'lo':
continue
try:
# pylint: disable=invalid-name
with open(os.path.join(base_path, iface, 'address'), 'r', encoding='ascii') as f:
mac = f.read().strip()
interfaces.append((mac, iface))
except FileNotFoundError:
continue
if interfaces:
interfaces.sort()
mac = interfaces[0][0]
mac = int(mac.replace(':', ''), 16)
mac -= 1
mac %= 1 << 48
mac = ':'.join(f"{(mac >> 8 * i) & 0xff:02x}" for i in range(5, -1, -1))
return mac
return None
def probe_qemusystem(out):
ADMINHASH = "$5$mI/zpOAqZYKLC2WU$i7iPzZiIjOjrBF3NyftS9CCq8dfYwHwrmUK097Jca9A"
"""Probe Qemu based test systems and 'make run'"""
admin_hash = "$5$mI/zpOAqZYKLC2WU$i7iPzZiIjOjrBF3NyftS9CCq8dfYwHwrmUK097Jca9A"
qsys = QEMUSystem()
vpds = qsys.vpds()
@@ -244,6 +273,7 @@ def probe_qemusystem(out):
for (attr, default) in (
("vendor", "QEMU"),
("product-name", "VM"),
("mac-address", qemu_base_mac()),
):
if not out[attr]:
out[attr] = default
@@ -252,13 +282,14 @@ def probe_qemusystem(out):
not out["vpd"]["product"]["available"]:
# Virtual instance without VPD emulation, fallback to
# admin/admin
out["factory-password-hash"] = ADMINHASH
out["factory-password-hash"] = admin_hash
# Let others react to the fact that we are running in QEMU
subprocess.run("initctl -nbq cond set qemu".split())
subprocess.run("initctl -nbq cond set qemu".split(), check=False)
return 0
def probe_dtsystem(out):
"""Probe DTS based system, expects a VPD in ONIE PROM format."""
dtsys = DTSystem()
vpds = dtsys.infix_vpds()
dtsys.infix_usb_devices(out)
@@ -296,11 +327,15 @@ def main():
return err
if not out["factory-password-hash"]:
sys.stdout.write("\n\n\033[31mCRITICAL BOOTSTRAP ERROR\nNO FACTORY PASSWORD FOUND\033[0m\n\n")
sys.stdout.write("\n\n\033[31mCRITICAL BOOTSTRAP ERROR\n" +
"NO FACTORY PASSWORD FOUND\033[0m\n\n")
err = 1
json.dump(out, open("/run/system.json", "w"))
os.chmod("/run/system.json", 0o444)
os.umask(0o337)
# pylint: disable=invalid-name
with open(SYSTEM_JSON, "w", encoding="ascii") as f:
json.dump(out, f)
shutil.chown(SYSTEM_JSON, user="root", group="wheel")
return err
if __name__ == "__main__":
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
# Find and install any product specific files in /etc before bootstrap
ident=$(basename "$0")
PREFIXD=/usr/share/product
PRODUCT=$(jq -r '."product-name" | ascii_downcase' /run/system.json)
note()
{
logger -I $$ -k -p user.notice -t "$ident" "$1"
}
DIR="$PREFIXD/$PRODUCT"
if [ -z "$PRODUCT" ] || [ ! -d "$DIR" ]; then
note "No vendor/product specific directory found, using built-in defaults."
exit 0
fi
note "Using vendor/product specific defaults."
for dir in "$DIR"/*; do
[ -d "$dir" ] && cp -a "$dir" /
done
@@ -0,0 +1,28 @@
#!/bin/sh
# When changing default IPv4/6 settings, this does not apply to
# existing interfaces. This syncs the default settings to all known
# interfaces at boot, such that physical interfaces will start from
# the same point as virtual ones.
tmp=$(mktemp)
fil=$(mktemp)
# Ignore unreadable entries, like net.ipv6.conf.default.stable_secret
sysctl net.ipv4.conf.default >"$tmp" 2>/dev/null
sysctl net.ipv6.conf.default >>"$tmp" 2>/dev/null
# Filter out read-only entries like net.ipv4.conf.default.mc_forwarding
# to prevent misleading error messages in syslog
while IFS= read -r line; do
entry=$(echo "$line" | awk '{print $1}')
path="/proc/sys/$(echo "$entry" | tr . /)"
if [ -w "$path" ]; then
echo "$line" >> "$fil"
fi
done < "$tmp"
for iface in $(ip -j link show | jq -r .[].ifname); do
sed -e "s/.default./.${iface}./g" "$fil" | sysctl -q -p -
done
rm "$tmp" "$fil"
+52
View File
@@ -0,0 +1,52 @@
#!/bin/sh
# Opportunistically look for interfaces with multiple transmit queues
# and hardware support for the mqprio queuing discipline. For every
# matching interface, set up mappings from kernel-internal packet
# priorities, via traffic classes, to transmit queues such that as
# many high priorities as possible are scheduled on separate queues.
set -e
map()
{
case "$1" in
2)
echo "map 0 0 0 0 0 0 1 1";;
3)
echo "map 0 0 0 0 1 1 2 2";;
4)
echo "map 0 0 1 1 2 2 3 3";;
5)
echo "map 0 0 1 1 2 2 3 4";;
6)
echo "map 0 0 1 1 2 3 4 5";;
7)
echo "map 0 0 1 2 3 4 5 6";;
8)
echo "map 0 1 2 3 4 5 6 7";;
esac
}
queues()
{
out="queues "
for tc in $(seq 0 $(($1 - 1))); do
out="$out 1@$tc"
done
echo "$out"
}
set $(ip -j -d link show | jq -r '.[] | .ifname, .num_tx_queues')
while [ "$1" ]; do
iface="$1"
txqs="$2"
shift 2
[ $txqs -lt 2 ] && continue
[ $txqs -gt 8 ] && txqs=8
tc qdisc add dev $iface root mqprio hw 1 \
num_tc $txqs $(map $txqs) $(queues $txqs) || true
done
+102
View File
@@ -0,0 +1,102 @@
#!/bin/sh
# Run .cfg migration jq scripts to backup and transform older .cfg files
ident=$(basename "$0")
MIGRATIONS_DIR="/usr/share/confd/migrate"
CONFIG_FILE="/cfg/startup-config.cfg"
BACKUP_DIR="/cfg/backup"
note()
{
logger -I $$ -k -p user.notice -t "$ident" "$1"
}
err()
{
logger -I $$ -k -p user.err -t "$ident" "$1"
}
file_version()
{
jq -r '
if .["infix-meta:meta"] | has("version") then
.["infix-meta:meta"]["version"]
else
"0.0"
end
' "$1"
}
atoi()
{
echo "$1" | awk -F. '{print $1 * 1000 + $2}'
}
if [ ! -f "$CONFIG_FILE" ]; then
# Nothing to migrate
note "No $(basename "$CONFIG_FILE" .cfg) yet, likely factory reset."
exit 0
fi
cfg_version=$(file_version "$CONFIG_FILE")
current_version=$(atoi "$cfg_version")
# Find the latest version by examining the highest numbered directory
sys_version=$(find "$MIGRATIONS_DIR" -mindepth 1 -maxdepth 1 -type d | sort -V | tail -n1 | xargs -n1 basename)
latest_version=$(atoi "$sys_version")
# Check for downgrade
if [ "$current_version" -gt "$latest_version" ]; then
err "Configuration file $CONFIG_FILE version ($cfg_version) is newer than the latest supported version ($sys_version). Exiting."
exit 1
fi
# If the current version is already the latest, exit the script
if [ "$current_version" -eq "$latest_version" ]; then
note "Configuration is already at the latest version ($sys_version). No migration needed."
exit 0
fi
note "Configuration file $CONFIG_FILE is of version $cfg_version, migrating ..."
# Create the backup directory if it doesn't exist
mkdir -p "$BACKUP_DIR"
# Create a backup of the current configuration file
nm=$(basename "$CONFIG_FILE" .cfg)
BACKUP_FILE="$BACKUP_DIR/${nm}-${cfg_version}.cfg"
if cp "$CONFIG_FILE" "$BACKUP_FILE"; then
note "Backup created: $BACKUP_FILE"
else
err "Failed creating backup: $BACKUP_FILE"
exit 1
fi
# Apply the scripts for each version directory in sequence
for version_dir in $(find "$MIGRATIONS_DIR" -mindepth 1 -maxdepth 1 -type d | sort -V); do
dir=$(basename "$version_dir")
version=$(atoi "$dir")
# Step by step upgrade file to latest version
if [ "$current_version" -lt "$version" ]; then
note "Applying migrations for version $dir ..."
# Apply all scripts in the version directory in order
for script in $(find "$version_dir" -type f -name '*.sh' | sort -V); do
note "Calling $script for $CONFIG_FILE ..."
sh "$script" "$CONFIG_FILE"
done
# File now at $version ...
current_version="$version"
fi
done
# Update the JSON file to the latest version
if jq --arg version "$sys_version" '.["infix-meta:meta"]["infix-meta:version"] = $version' "$CONFIG_FILE" \
> "${CONFIG_FILE}.tmp" && mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"; then
note "Configuration updated to version $sys_version."
else
err "Failed updating configuration to version $sys_version!"
exit 1
fi
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
exec initctl -bq cond set ixinit-done
+107
View File
@@ -0,0 +1,107 @@
#!/bin/sh
# Mounts and unmounts external media
ACTION=$1
DEVBASE=$2
DEVICE="/dev/${DEVBASE}"
log()
{
logger -sk -I $$ -p user.notice -t "media" "$1"
}
usage()
{
echo "Usage: $0 {add|start|del|remove|stop} DEV (e.g. sdb1)"
exit 1
}
if [ $# -ne 2 ]; then
usage
fi
# See if this drive is already mounted, and if so where
MOUNT_POINT=$(mount | grep "${DEVICE}" | awk '{ print $3 }')
do_mount()
{
if [ -n "${MOUNT_POINT}" ]; then
log "skipping ${DEVICE}, already mounted at ${MOUNT_POINT}"
exit 1
fi
# Get info for this drive: $ID_FS_LABEL, $ID_FS_UUID, and $ID_FS_TYPE
eval $(udevadm info --query=property --name="${DEVICE}")
# Figure out a mount point to use
LABEL=${ID_FS_LABEL}
if [ -z "${LABEL}" ]; then
LABEL=${DEVBASE}
elif grep -q " /media/${LABEL} " /etc/mtab; then
# Already in use, make a unique one
LABEL="${LABEL}-${DEVBASE}"
fi
MOUNT_POINT="/media/${LABEL}"
umask 007
mkdir -p "${MOUNT_POINT}"
OPTS="rw,relatime,noexec,nodev,uid=0,gid=10"
case ${ID_FS_TYPE} in
vfat)
OPTS="${OPTS},umask=007,shortname=mixed,utf8=1,flush"
;;
exfat)
OPTS="${OPTS},sync"
;;
*)
log "unsupported filesystem ${ID_FS_TYPE}, skipping."
rmdir "${MOUNT_POINT}"
exit 1
;;
esac
log "mount -o ${OPTS} ${DEVICE} ${MOUNT_POINT}"
if ! mount -t "${ID_FS_TYPE}" -o ${OPTS} "${DEVICE}" "${MOUNT_POINT}"; then
log "failed mounting ${DEVICE}"
rmdir "${MOUNT_POINT}"
exit 1
fi
log "mounted ${DEVICE} at ${MOUNT_POINT} for root:wheel with 770 permissions"
}
do_unmount()
{
if [ -z "${MOUNT_POINT}" ]; then
log "cannot unmount ${DEVICE}, is not mounted."
else
umount -l "${DEVICE}"
log "unmounted ${DEVICE}"
fi
# Delete all empty dirs in /media that aren't being used as mount
# points. This is kind of overkill, but if the drive was unmounted
# prior to removal we no longer know its mount point, and we don't
# want to leave it orphaned...
for f in /media/* ; do
if [ -n "$(find "$f" -maxdepth 0 -type d -empty)" ]; then
if ! grep -q " $f " /etc/mtab; then
log "removing mount point $f"
rmdir "$f"
fi
fi
done
}
case "${ACTION}" in
add|start)
do_mount
;;
del|remove|stop)
do_unmount
;;
*)
usage
;;
esac
+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
# Generate NETCONF SSH host key pair
set -e
BIT=2048
KEY=$1
PUB=$2
mkdir -p "$(dirname "$KEY")" "$(dirname "$PUB")"
openssl genpkey -quiet -algorithm RSA -pkeyopt rsa_keygen_bits:$BIT -outform PEM > "$KEY"
openssl rsa -RSAPublicKey_out < "$KEY" > "$PUB"
exit 0
@@ -33,18 +33,26 @@ check_factory()
fi
# Add to your br2-external to extend factory-reset check
if [ ! -x /libexec/infix/check-factory ]; then
if [ ! -x /usr/libexec/infix/check-factory ]; then
return 1;
fi
/libexec/infix/check-factory
/usr/libexec/infix/check-factory
}
factory_reset()
{
# XXX: flash LEDs to confirm factory-reset in progress
find /sys/class/leds/ -type l -exec sh -c 'echo 100 > $0/brightness' {} \;
logger $opt -p user.crit -t "$nm" "Resetting to factory defaults."
# Shred all files to prevent restoring contents
find /mnt/cfg -type f -exec shred -zu {} \;
find /mnt/var -type f -exec shred -zu {} \;
# Remove any lingering directories and symlinks as well
rm -rf /mnt/cfg/* /mnt/var/*
logger $opt -p user.crit -t "$nm" "Factory reset complete."
sync
}

Some files were not shown because too many files have changed in this diff Show More