Compare commits

...
225 Commits
Author SHA1 Message Date
Tobias WaldekranzandGitHub fbe18a4ae0 Merge pull request #844 from kernelkit/releng
Final ChangeLog updates for v24.11.1
2024-11-29 08:05:29 +01:00
Joachim Wiberg 020f0d0980 doc: final ChangeLog updates for v24.11.1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-28 20:56:05 +01:00
Joachim WibergandGitHub 3fd4f2c72f Merge pull request #843 from kernelkit/drop-execd
Redesign and simplify container creation/removal
2024-11-28 17:48:00 +01:00
Joachim Wiberg fbabf0e857 doc: update ChangeLog for v24.11.1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-28 16:36:56 +01:00
Joachim Wiberg a23dc89592 confd: disabling a container should not delete volumes
When disabling a container in the configuration we should not remove it,
because then any volumes used by it may be lost.  Instead, we now simply
disable the service to prevent it from starting, or stopping it, if it
was running.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-28 16:36:56 +01:00
Tobias WaldekranzandJoachim Wiberg 36d9056e8f board/common: Use finit's log: to capture output from containers
Since `conmon` only logs the output from the monitored container's
`stdout`/`stderr`, we might as well get rid of `k8s-logger`, and let
the output pass through to finit, which will then pipe the messages to
syslog.

Fix #836
2024-11-28 16:36:56 +01:00
Joachim Wiberg ca0e54b50b configs: drop execd from defconfigs, not needed anymore
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-28 16:36:56 +01:00
Joachim Wiberg bb1a656a05 confd: drop fragile asynchronous container create/delete using execd
This is a complete redesign of how the system creates/deletes containers
from the running-config.  Containers are now removed synchronously from
confd before any interfaces they may be using are removed, and created
in parallel, using a Finit task, well after confd has finished setting
up interfaces.

The logic previously provided by execd to retry container create on any
route/address changes, or periodically every 60 seconds, is now handled
by a new 'setup' command in the container wrapper script.

Additionally, container create is now split in wget/curl/podman pull of
the image and 'podman create'.  This to both consolidate image fetching
and improve user feedback since most of the retry logic (above) revolves
around the image download.

Fixes #835

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-28 16:36:56 +01:00
Joachim Wiberg 7483a6f454 confd: make sure to stop zeroconf agent on interface removal
When deleting interfaces we skip a lot of steps in netdag_gen_iface(),
this patch ensures we at least call netdag_gen_ipv4_autoconf() to drop
any running zeroconf agent in the same generation.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-28 15:11:26 +01:00
Joachim Wiberg 6072ec45b3 patches: add support for adjusting avahi-daemon log level
The mDNS daemon, Avahi, is very verbose in its syslog output.  So much
that it often overshadows other subsystems, and on switches and routers
with more than the "normal" amount of ports and interfaces, it quickly
becomes unbearable.

The patches consist of:

 - Add -l LEVEL support to avahi-daemon
 - Add missing casll to setlogmask() in libdaemon:daemon_set_verbosity()

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-28 15:11:26 +01:00
Joachim Wiberg 1ac07b5a7b board/common: drop less -S from pager
The -S switch to less seemed at the time a good idea -- chop off too
long lines and allow horizontal scrolling -- however, the -F option, to
skip pager for content that fit the first screen is overridden by the -S
switch.  This makes commands like "show containers", and similar that
normally have waaaaay too few lines for a pager to always page.

So let's drop -S to regain the original behavior.  This will cause lines
to be wrapped, but with the new raw mode in the CLI this seems to work
without any weird screen artifacts.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-28 15:11:21 +01:00
Joachim Wiberg ad9c432ff9 cli: jump to end of 'show log' commands automatically
Instead of having to scroll to the end (Shift G, or page down til end),
let's instead start at the end now that we have control over paging in
the CLI ourselves.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-28 15:10:48 +01:00
Joachim Wiberg af0e24adf8 package/finit: backport fix to prevent restaring template siblings
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-28 15:10:48 +01:00
Tobias WaldekranzandGitHub e39ef89150 Merge pull request #832 from kernelkit/rocker
Initial support for Qemu Rocker switch
2024-11-28 15:07:44 +01:00
Tobias WaldekranzandGitHub 877e3f3d81 Merge pull request #837 from kernelkit/vlan-iface-termination
Prevent traffic assigned to locally terminated VLANs from being forwarded
2024-11-28 15:07:22 +01:00
Tobias Waldekranz ddfdcb40bb test: vlan_iface_termination: Fix test spec issues
- Use standard topology
- Include test case specification in parent README
2024-11-28 14:23:53 +01:00
Tobias Waldekranz f4557ff8ab doc: update ChangeLog
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
2024-11-28 12:53:19 +01:00
Joachim WibergandTobias Waldekranz b6f9b6d967 test: safe setup of Infamy swN bridges
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-28 12:53:19 +01:00
Tobias Waldekranz 6c2ab33028 test: ospf_container: Enable VLAN filtering on br0
As it turns out, the setup with a 802.1D bridge in combination with
VLAN uppers stacked on the bridge ports is not possible to support
on mv88e6xxx ports.

Enable VLAN filtering to ensure proper isolation of the locally
terminated VLANs.
2024-11-28 12:52:09 +01:00
Tobias Waldekranz 63e1ff1fe9 test: vlan_iface_termination: Add test
This will fail on a system running a vanilla kernel, where the dut's
ports are backed by mv88e6xxx, because:

1. The ports are attached to the same bridge, and are thus in the same
   PVT group.

2. Creation of the VLAN uppers causes the DSA layer to add both ports
   to the same VTU entry.

As a result, hardware behaves as if both ports had been configured as
tagged members of VLAN 10, instead of just terminating incoming
traffic locally.

Add this test to catch hardware which behaves in this way.
2024-11-28 12:52:09 +01:00
Tobias Waldekranz 0c88c464f1 statd: Support reporting PVID on bridges
Now that PVID can be configured on bridges, make sure that we reflect
that in the operational database.
2024-11-28 12:52:09 +01:00
Tobias Waldekranz 70e8895478 confd: Support PVID configuration on bridges 2024-11-28 12:52:09 +01:00
Mattias WalströmandGitHub 371db579ea Merge pull request #839 from kernelkit/ospf-tests
Add a new test for default-route-advertise
2024-11-28 12:20:00 +01:00
Mattias Walström 591397d3c7 test: ospf: add new test for testing 'default-route-advertise' 2024-11-28 11:13:56 +01:00
Mattias Walström 88ab2a6f43 test: ospf-basic: Test redistribute static as well 2024-11-28 11:13:56 +01:00
Mattias WalströmandGitHub f6bd2094f0 Merge pull request #842 from kernelkit/update-vlan-separation-test
test: bridge_vlan_separation: Make test more robust
2024-11-28 11:13:03 +01:00
Mattias Walström b36e55e642 test: bridge_vlan_separation: Make test more robust
Only check for the broadcast sent.

And add more test specification steps
2024-11-28 10:31:54 +01:00
Ahmed KaricandGitHub eabf79c7c4 Merge pull request #824 from kernelkit/add-routing-pref-tests
Add Routing Preference Tests
2024-11-27 14:42:23 +01:00
Joachim Wiberg 963364d4e9 confd: allow setting IP address directly on dot1Q bridges
This patch drops a needless restriction of IP addresses on VLAN filtering
bridges from 2024-03-06.  The obvious use-case is when the bridge is an
untagged member of a VLAN and only ony management VLAN is required.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-27 11:25:21 +01:00
Tobias Waldekranz bc9c6a4871 patches/linux: net: dsa: mv88e6xxx: Trap locally terminated VLANs 2024-11-26 22:14:16 +01:00
Ahmed Karic d9eae887a0 test: Verify routing preference 255 is inactive
Fixes #784
2024-11-26 15:29:32 +01:00
Ahmed Karic e9efd224f7 test: Verify route preference (OSPF vs Static) 2024-11-25 18:05:51 +01:00
Ahmed Karic e9fc62b365 test: Verify route preference (DHCP vs Static) 2024-11-25 18:05:51 +01:00
Ahmed Karic 03a2cf7b3b test/infamy: Initialize DHCP server interface parameter 2024-11-25 18:05:51 +01:00
Ahmed Karic 289534e0d5 test/infamy: Fix adding ip address inside IsolatedMacVlans 2024-11-25 18:05:51 +01:00
Ahmed Karic d81b20ca0b test/infamy: Enhance route verification
- Ensure _exist_route function performs complete checks without early
    returns.
  - Add support for verifying 'active' state in route checks.
2024-11-25 18:05:51 +01:00
Mattias WalströmandGitHub 68c86c8a89 Merge pull request #820 from kernelkit/ospf-container
Ospf container
2024-11-25 15:08:01 +01:00
Mattias Walström de50179b3b test-spec: Remove autogenerated file
Add it to gitignore to not be added again.
2024-11-25 14:44:32 +01:00
Mattias Walström 66ae02363e infamy: Stability fix for getting OSPF status
Always return {} if fail to get OSPF status, it may not have started
yet.
2024-11-25 14:25:26 +01:00
Joachim WibergandMattias Walström 866b9de779 test: factor out file server from upgrade test
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-25 14:25:26 +01:00
Joachim WibergandMattias Walström 77df9a327d test: add drawio original and update images in use-case test
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-25 14:25:26 +01:00
Mattias Walström 1cfbf9bc11 test: case: ospf_container: Update test
Add "VLAN switches" between each Router, to only pass the tagged traffic
between the routers.

Add test specification and add to test suite
2024-11-25 14:25:26 +01:00
Mattias Walström 81f80bd307 ospf_containers: Convert to use put_config_dicts 2024-11-25 14:04:07 +01:00
Joachim WibergandMattias Walström f381977e7b test/case: minor, grammar and formatting
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-25 14:04:07 +01:00
Joachim WibergandMattias Walström 6d6a788749 test/case: update use-case internal network description
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-25 14:04:07 +01:00
Mattias Walström 7a642f9f8c test: use_case: Update test with HTTP container and ABR
Add ABR configuration and a HTTP Container
2024-11-25 14:04:07 +01:00
Joachim WibergandMattias Walström c0ee09047b test/case: add description for ospf container use-case
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-25 14:04:07 +01:00
Joachim WibergandMattias Walström 14dea0ca97 README: minor, grammar.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-25 14:04:07 +01:00
Mattias Walström bbc9a55c1e Add new test: ospf_container
Aims to test a complex setup with multiple containers, OSPF and NAT
2024-11-25 14:04:07 +01:00
Mattias Walström 82fd4bdb68 infamy: Expose the new IsolatedMacVlans for tests 2024-11-25 14:03:03 +01:00
Mattias Walström c7db71d095 test-spec: Add support for images in description 2024-11-25 14:03:03 +01:00
Mattias Walström 5264a1c32b infamy: Update template topologies to use the correct font 2024-11-25 14:03:03 +01:00
Tobias WaldekranzandMattias Walström fabb28b5df yanger: Tolerate missing DR/BDR IDs in OSPF neighbor info
With the FRR upgrade to 9.1.2, OSPF sometimes reports neighbors
without reporting the routerDesignatedId and routerDesignatedBackupId
attributes. Ensure that these attributes are available before trying
to copy them to the output.
2024-11-25 14:03:03 +01:00
Tobias WaldekranzandMattias Walström de47caec38 buildroot: Bump to latest 2024.02.x-kkit for FRR 9.1.2
During development of the upcoming ospf_container test, an issue was
discovered where zebra's view of the system drifted from the kernel's
ditto. Specifically: when transitioning from test-config to one with
many virtual interfaces (VLANs VETH pairs etc.), zebra would not
process events for all interfaces, which meant OSPF would not pick
them up.

Our experience matches very well with a bug reported upstream in:

https://github.com/FRRouting/frr/issues/13630

> If we delete kernel interface and create it and set its ip in a
> short time, in rare cases, interface ip will be lost in zebra which
> can be confirmed by vtysh show interface brirf command. This will
> lead to abnormal behavior of other protocol daemons, for example,
> bgpd does not announce the route corresponding to interface ip even
> it was specified by network command.

The issue was marked as fixed by PR 13396, which was merged in the 9.0
cycle:

https://github.com/FRRouting/frr/pull/13396

Therefore, upgrade FRR to the latest patch release from that major.
2024-11-25 14:03:03 +01:00
Tobias WaldekranzandMattias Walström d99b6fd557 confd: Abort if callback tracking ever fails
During debugging of a reconfiguration issue, one hypothesis was that
the tracking of callbacks used to determine when a transaction has
completed (as sysrepo has no hooks for this) was out of sync, causing
us to call `initctl reload` prematurely. This was not the case, but if
it ever occurs in the future, make sure that it is a fatal error that
won't go unnoticed.
2024-11-25 14:03:03 +01:00
Tobias WaldekranzandMattias Walström a3af3f9be4 x86_64: Enable kprobes and ftrace in kernel
This avoids full recompiles every time we want to use things like ply.
2024-11-25 14:03:03 +01:00
Ahmed KaricandGitHub 260d9615ec Merge pull request #828 from kernelkit/update-br-vlan-sep
Verify that bridge vlan separation works properly for broadcast packets
2024-11-25 09:35:40 +01:00
Ahmed Karic 798194b64a test: update bridge vlan separation test
- Verify that broadcast packets are also properly moved accross the
  bridge, i.e. the broadcast packets sent from vlan interface VLAN10
  do not reach VLAN20

Fixes #773
2024-11-25 08:46:20 +01:00
Joachim Wiberg 0160fd539e package/skeleton-init-finit: ensure zebra+ospfd log to syslog
Fix lack of syslog messages from Zebra and add support to easily enable
debug logs for common Zebra subsystems.

Same change made to ospfd for symmetry.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-24 20:50:12 +01:00
Joachim Wiberg df2689ca34 board/common: minor fixes to udhcpc.script
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-24 20:50:12 +01:00
Joachim Wiberg f9d21e5839 board/common: trick pager into using line drawing charachters
This fixes a regression in v24.11.0, introduced in 46dd0c7, where line
drawing characters are not properly displayed in the CLI anymore.

admin@infix:/> show interfaces
INTERFACE       PROTOCOL   STATE       DATA
lo              ethernet   UP          00:00:00:00:00:00
                ipv4                   127.0.0.1/8 (static)
                ipv6                   ::1/128 (static)
br0             bridge
<E2><94><82>               ethernet   UP          02:00:00:00:00:00
<E2><94><82>               ipv4                   169.254.1.3/16 (random)
<E2><94><82>               ipv6                   fe80::ff:fe00:0/64 (link-layer)
<E2><94><9C> swp1          bridge     FORWARDING
<E2><94><9C> swp2          bridge     FORWARDING
<E2><94><9C> swp3          bridge     FORWARDING
<E2><94><9C> swp4          bridge     FORWARDING
<E2><94><9C> swp5          bridge     FORWARDING
<E2><94><9C> swp6          bridge     FORWARDING
<E2><94><9C> swp7          bridge     FORWARDING
<E2><94><9C> swp8          bridge     FORWARDING
<E2><94><9C> swp9          bridge     FORWARDING
<E2><94><94> swp10         bridge     FORWARDING

This is because the raw tty from klish disables IUTF8 and the fact that
it does not source any environment, e.g., /etc/profile.  (We do not have
any locale settings in the enviornment either, but that's a discussion
for another day.)

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-24 20:50:12 +01:00
Joachim Wiberg c8046bfbda board/common: add '-k' to keep new qemu.run script after session
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-24 20:50:12 +01:00
Joachim Wiberg 74a12b3e31 board/common: initial rocker switch support
Fix #540

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-24 20:49:34 +01:00
Joachim Wiberg efaad3c5b8 board/common: misc shellcheck fixes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-23 20:52:36 +01:00
Tobias WaldekranzandGitHub 3d189d8ec6 Merge pull request #831 from kernelkit/boot-wait-slow-devs
Wait for slow devices before continuing boot
2024-11-22 15:36:41 +01:00
Tobias Waldekranz 06721a17b3 board/common: Address review feedback on hw-wait
- Fix various shellcheck warnings
- Use idiomatic formatting of multiline finit stanzas
2024-11-22 15:00:40 +01:00
Tobias Waldekranz d7c7c33e72 doc: Document #685 fix in ChangeLog
[skip ci]
2024-11-22 14:19:04 +01:00
Tobias Waldekranz 47bb54254c Revert "Make detection of DSA interface more robust"
This reverts commit 0ee973b2b2.

Turns out that this workaround simply reduced the size of the window
where this issue can occur.

The previous change now ensures that the DSA tree is always fully
setup by the time nameif runs.
2024-11-22 11:10:02 +01:00
Tobias Waldekranz 30028f36a9 board/common: Wait for slow devices before continuing boot
Before this change, we relied on `udevadm settle` to act as a barrier
which we could only cross after all devices had been probed. As it
turns out, when drivers defer probing due to missing dependencies,
`udevadm settle` may exit (as no events are generated for a period of
time) before all devices are set up. This was the root cause behind
issue #685, for which #752 was the initial attempt at a fix.

As we know that systems using mv88e6xxx will always have a device link
referencing the conduit interface, add a script to finit's system
runparts directory, which will block while any device link consumers
are still probing.

As a consequence of this, we can no longer rely on the sysklogd.conf
shipped with finit. Therefore, install an Infix specific one, which
will make sure that the aforementioned script has run before launching
the syslog daemon, which most other things depend on.

Fixes #685
2024-11-22 11:08:20 +01:00
Tobias WaldekranzandGitHub 131d9e99b3 Merge pull request #826 from kernelkit/container-fixes
Container fixes
2024-11-20 11:36:13 +01:00
Joachim Wiberg 1ed8ad1233 doc: update ChangeLog for v24.11
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 09:19:53 +01:00
Joachim Wiberg 8d32a525f3 doc: add ghfm note highlights
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 09:19:53 +01:00
Joachim Wiberg 3bbe9a9a9d doc: update container doucmentation
- No more default writable layer
 - Don't mention read-only (deprecated, and always on now)
 - Use ghfm note highlights

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 09:19:53 +01:00
Joachim Wiberg ee0adce2a3 package/curios-nftables: bump to v24.11.0
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:54:11 +01:00
Joachim Wiberg 09077c6122 package/curios-httpd: bump to v24.11.0
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:54:11 +01:00
Joachim Wiberg 4c78613c4c package/curios-*: add latest symlinks for easy upgrades
This patch adds latest symlinks to the curiOS containers to make system
upgrades easier.  I.e., a user can now reference the bundled image with:

    set image oci-archive:/lib/oci/curios-httpd-latest.tar.gz

So that when they upgrade to the latest Infix, which might include an
update of curiOS httpd, they will get a seamless upgrade also of the
container(s) running.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:54:11 +01:00
Joachim Wiberg 7ec37a7efb board/common: new shell tool 'cfg [edit] arg', replaces alias
This commit replaces the 'cfg' alias for 'sysrepocfg -f json' with a
small shell script.  Currently only an 'edit' command, similar to the
CLI 'text-editor' command for modifying base64 encoded YANG nodes.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:51:09 +01:00
Joachim Wiberg 904040098a board/common: refactor error logging and clean up on error
- Refactor logging to simplify code and get proper log level
 - Clean up lingering directories from any extracted tarball on error

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:50:45 +01:00
Joachim Wiberg 8838efaf9d board/common: enable/disable Finit service for container
This patch allows running the configure script manually to create and
delete containers.  The normal flow via confd has additional handling
to ensure containers are started/stopped on inictl reload.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:50:29 +01:00
Joachim Wiberg 2d37e4be2c board/common: extract OCI archives in /var/tmp
Instead of using $HOME, which may be a ramdisk, use /var/tmp which
podman also uses by default.  Also, make sure to clean up after
ourselves.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:50:26 +01:00
Joachim Wiberg e480e26065 board/common: workaround missing --retry=NUM flag to podman
Disable the default "podman pull" retry value.  We use execd to retry
"podman create" on failure.  Wihtout this change, a single container
can block start of other containers by 3 * 20 seconds.  Now we only
block max 20 seconds before we try starting the next container.

Modern versions of podman (>= 5.0) have this --retry option, but it
does not have CNI, so this is a temporary workaround.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:50:03 +01:00
Joachim Wiberg 2aea461e7e execd: add retry timer for pending jobs
When an Infix device is connected to a LAN where the gateway has yet to
connect to the Internet, the container script will fail pulling images
from any remote server.

    Nov 16 12:48:13 infix container[3490]: Error: initializing source docker://ghcr.io/kernelkit/curios:edge: pinging container registry ghcr.io: Get "https://ghcr.io/v2/": dial tcp: lookup ghcr.io on 127.0.0.1:53: read udp 127.0.0.1:55422->127.0.0.1:53: i/o timeout
    Nov 16 12:48:13 infix container[3641]: Error: failed creating container fw, please check the configuration.
    Nov 16 12:48:13 infix execd[3490]: /run/containers/queue/S01-fw.sh failed, exit code: 1

Since execd until now only retries on netlink/inotify events, or manual
SIGUSR1, jobs would get stuck even though Internet connectivity had been
established.  This patch fixes that with the addition of a retry timer
which runs while there are pending jobs in the queue.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:50:03 +01:00
Joachim Wiberg 7b389f6d0a confd: quiet container script log messages
Should be inverted to a --verbose or --debug flag instead.  After this
change we still see the full 'podman create ...' command, with all the
optionas and arguments.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:50:03 +01:00
Joachim Wiberg 43635c2727 confd: fix pyang linter errors
Issue #815 detail issues found running the Clixon Controllar and
Cisco Yangsuite.  The errors and warnings listed are very similar
to pyang, which the undersigned has, the following changes fixes
the pyang errors:

 - relocate 'feature containers' to submodule
 - drop already deviated ospf:database deviations
 - drop unused imports

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:49:56 +01:00
Joachim Wiberg c79e198615 confd: add support for fetching container images over ftp/http/https
- Anonymous FTP, or URL encoded ftp://user:hostname@addr/oci.tar.gz
 - HTTP/HTTPS fetched with curl, optional credentials support
 - Verify download against an optional sha256 checksum

Ensure the unpacked directory name does not contain a ':', it is a
restricted character and cannot be part of the file name.  If this
syntax is used we retain it as the name and retag it after load.

Fix #801

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:49:27 +01:00
Joachim Wiberg 021767c903 confd: refactor and refine container creation
- Reduce the amount of queues: 3 -> 1
 - Simplify post hook
 - Refine execd

The resulting simplification of infix_containers_post_hook(), and
touching execd, also ensure container environment variable changes
are propagated.

Fixes #822

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:48:27 +01:00
Joachim Wiberg 449fd46ea7 package/execd: clean up any lingering containers at boot
To be able to handle container restarts, incl. restart policy, at
runtime, most of the container data lives in /var/lib/containers,
which on most systems is backed by a persistent store.

As of issue #823 we no longer keep a writable layer for containers,
nor should we cache container state across reboots, all containers
are recreated at boot.  This task cleans up any lingering state.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:48:27 +01:00
Joachim Wiberg 4a9d977682 board/common: revert parts of 8353963
Running 'shred' on files stored on eMMC is pointless since the writes
are spread out over other sectors rather than overwriting the content
of the files as it was supposed to on old rotating media.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:48:27 +01:00
Joachim Wiberg 5ace3afa5f board/common: clean up stale files in /var/tmp/frr on boot
On unclean shutdowns Frr leaves a lot of per-thread message buffers in
/var/tmp/frr/<daemon>[-<instance>].<pid>/*

See https://docs.frrouting.org/en/latest/setup.html

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:48:27 +01:00
Joachim Wiberg 1347080b4a confd: major behavior change, run container --read-only always
Container support in Infix was released with v24.02, so this change may
unfortunately break a few use-cases out there.  Regrettable as this is,
the default behavior, including how containers are started after boot,
break other use-cases that were considered more important.

As of this commit:

 - all containers in Infix run in read-only mode, use volumes and
   mounts for persistence across reboot/stop/start/upgrade
 - all containers are now "recreated" at boot or related config changes,
   this ensures an OCI image embedded in the Infix image, /lib/oci/, is
   always used as the base for a running container

Fixes #823

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:48:27 +01:00
Joachim Wiberg db447712f7 board/common: ensure containers are handled as sysv scripts
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:48:27 +01:00
Joachim Wiberg 2922b909af confd: add validation of min/max interface name length
A sane interface name is at least two characters long, and in Linux the
interface name (using ip link) is at most 15 characthers long.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-20 08:48:20 +01:00
Joachim WibergandGitHub 28c5f5e56f Merge pull request #827 from kernelkit/cli-fixes
CLI pager fixes
2024-11-18 14:34:10 +01:00
Joachim Wiberg 46dd0c7467 src/klish-plugin-infix: use shell pager instead of klish pager
With interactive mode (out="tty") klish puts the tty in raw mode which
fixes all weird issues reported around paged output in the CLI.

Fixes #659

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-17 16:18:02 +01:00
Joachim Wiberg aa538820de board/common: replace pager symlink with a tiny shell script
These are basically the same flags as was passed to klish, but now we
use -R instead of -r to make sure only ANSI coloŕ escapes can affect
the behavior of less.

This change will make it posslbe to shop off too long lines and scroll
vertically on really long lines instead for them breaking output.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-17 16:15:30 +01:00
Joachim Wiberg 7670f23805 src/klish-plugin-infix: adapt to new klish plugin path
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-17 14:38:36 +01:00
Joachim Wiberg c55b534005 package/klish-plugin-sysrepo: bump for new library and plugin paths
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-17 14:37:47 +01:00
Joachim Wiberg cbcd39cdd6 package/klish: bump for raw mode fixes, alternate quotes, etc.
This update include more backports from Klish 3.1.0, including, but not
limited to:

 - Syslog fixes
 - Return code fixes
 - Changed library and plugin paths (!)
 - TTY raw mode fixes
 - Use raw mode for interactive commands
 - Allow single quotes (') as alternative to regular quotes for commands

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-17 14:31:18 +01:00
Joachim WibergandGitHub 032a51b9fc Merge pull request #821 from rical/rauc-add-install-output
rauc: improve upgrade output
2024-11-12 16:38:21 +01:00
Richard Alpe f4bf72de85 rauc: improve installation output
The first patch 0003.. is sent upstream but not reviewed yet.

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-11-12 15:21:27 +01:00
Joachim WibergandGitHub deee48d36a Merge pull request #817 from kernelkit/rel
Minor release engineering fixes
2024-11-08 19:37:58 +01:00
Joachim Wiberg 23e24635fe .github: create new discussion only on GA releases
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 18:51:09 +01:00
Joachim Wiberg eb38d4538f .github: remember to sync tags
The gh repo sync, used by our internal cronjob, does not sync tags, for
details see <https://github.com/cli/cli/issues/5023>.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 18:38:50 +01:00
Joachim WibergandGitHub 2910d8b9bf Merge pull request #811 from kernelkit/bootstrap-refactor
Early bootstrap refactor

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 15:20:39 +01:00
Joachim Wiberg 6bdfdbe164 doc: update ChangeLog for v24.10.2 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 14:30:04 +01:00
Joachim Wiberg ceb78d66a2 board/common: convert tc error message to useful information
When we opportunistically set up mqprio on all interfaces, we pass over
interfaces without offloading support.  Catch that error message and log
an informational message about which interfaces are skipped.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 14:30:04 +01:00
Joachim Wiberg 9ac77be9eb confd: fix scary error message on systems without USB ports
Check if the "usb-ports" key exists in /run/system.json before calling jq,
otherise we get the following error message:

Nov  8 05:11:45 ix bootstrap[3349]: jq: error (at <stdin>:0): Cannot iterate over null (null)

Also, minor whitespace cleanup and bashisms fixes.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 14:30:04 +01:00
Joachim Wiberg d692a3d745 board/common: enable syslog for rauc
In 0f410eb a patch was added to RAUC to allow native logging to syslog,
it was however never enabled.  This patch enables logging to syslog.

Fix #809

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 14:30:04 +01:00
Joachim Wiberg 597da90b05 board/commoon: use dbus machine-id as /etc/machine-id
Bootstrapping a system with D-Bus using Finit will create the machine-id
file /var/lib/dbus/machine-id, this can be used as the unique machine-id
for services like RAUC, so let's set that as /etc/machine-id to reduce
the log spam we get otherwise:

Nov  7 06:18:08 test-05-25-f8 rauc[5512]: Failed to get machine-id: Failed to open file <E2>M-^@M-^\/etc/machine-id<E2>M-^@M-^]: No such file or directory

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 14:30:04 +01:00
Joachim Wiberg 5d524006a3 board/aarch64: styx: led setup using a plain script at boot
After the initial probe, set up all port leds:

 - Disable all LEDs
 - Enable netdev trigger for all green LEDs (tp + sfp)
 - Enable link statux and rx/tx activity
 - Skip all aux LEDs

Also in script, a neat little flash function that can be used both for a
production test, to verify all LEDs work, and at runtime to locate the
device in a rack of devicess.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 14:30:04 +01:00
Joachim Wiberg 4c1de659cb board/aarch64: styx: rename second green led and drop second sfp led
On Rev. B, the second LED on the copper ports is green instead of yellow.
This patch renames them from yellow -> aux => <device>:aux:tp

Also on Rev. B, the second LED for SFP ports do not work at all.  This
patch drops them from the device tree to avoid confusion.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 14:30:04 +01:00
Joachim Wiberg 3b01f2d806 Revert "board/aarch64: styx: Remove unconnected LED"
This reverts commit 7d1a708274.  Turns out
the second LED is actually connected.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 14:30:04 +01:00
Joachim Wiberg 4e2458e18a board/common: introduce conditions for bootstrap services
Some services launched at bootstrap must be possible to override per
product.  One such service is iitod, which manages the LEDs in Infix.

This change makes allows a product specific init script to clear the
led condtion, preventing Finit from lauching iitod.  Also, rename the
ixinit-done condition to match the nomenclature used already.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 14:30:04 +01:00
Joachim Wiberg dc741bb567 board/common: use compatible string to install and run overrides
This patch use the new compatible array in /run/system.json, installing
in order, least to most significant product overrides.

We also introduce a new way to run product specific scripts at init, to
override default behavior in Infix, e.g., LED control.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 14:30:04 +01:00
Joachim Wiberg d5d487070f board/common: probe: add compatible array to /run/system.json
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 14:30:04 +01:00
Joachim Wiberg 7052c54165 board/common: probe: minor, pep8 fixes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 14:30:04 +01:00
Joachim Wiberg e25eb1966e patches/linux: minor fix to 6393X led handling
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 09:13:33 +01:00
Joachim Wiberg fe1c47e107 .github: allow release job to create new discussions
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 09:13:33 +01:00
Jon-Olov VatnandGitHub 57b66ec6d3 Merge pull request #810 from kernelkit/doc-ieee-group-forward
Documentation of forwarding IEEE reserved group addresses
2024-11-08 09:04:28 +01:00
Jon-Olov Vatn 9103d31950 Minor formulation change in ieee group forwarding documentation
Fix #788

[skip ci]
2024-11-08 09:03:34 +01:00
Jon-Olov Vatn 32ec9887b9 Adding documentation on forwarding ieee reserved group addresses
Fix #788

[skip ci]
2024-11-08 09:02:49 +01:00
Joachim WibergandGitHub e0458ca079 Merge pull request #814 from kernelkit/doc-ospf-redistribute
Add rudimentary documentation on global OSPF settings

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 08:58:24 +01:00
Jon-Olov Vatn e9aefc517f Add rudimentary documenation on global OSPF settings
Fix #812

Doc covering
- redistribute static/connected
- distribute-default-route [always]
- explicit-router-id

[skip ci]
2024-11-08 08:21:02 +01:00
Mattias WalströmandGitHub 20295b08b5 Merge pull request #808 from kernelkit/set-hostname
Set hostname in infamy
2024-11-07 11:14:11 +01:00
Joachim WibergandGitHub 7a9f1c1d7a Merge pull request #786 from kernelkit/update-discovery-md
Update discovery.md on mDNS Information

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-07 10:43:12 +01:00
Mattias Walström 7e08555013 tests: Convert to put_config_dicts
Convert from put_config_dict to put_config_dicts
2024-11-07 10:13:05 +01:00
Mattias Walström 82ff83c50d infamy: Set hostname from logical topology
If no hostname is specified, set it to the dut-name in
logical topology
2024-11-07 09:47:36 +01:00
Jon-Olov Vatn d277f5a860 Updated Changelog wrt to changes in Discovery documentation
[skip ci]
2024-11-07 09:07:10 +01:00
Jon-Olov Vatn f537e2fc13 Update description of netbrowse service
Use proposal from review.

[skip ci]
2024-11-07 09:00:14 +01:00
Jon-Olov Vatn 73070f40c4 Minor updates to discovery doc
Changing title on the section on netbrowse service

[skip ci]
2024-11-07 09:00:14 +01:00
Jon-Olov Vatn a0fb42e46d Minor updates to discovery documentation
- Adding info on how to disable LLDP
- Avoiding clickable URL to https://network.local

[skip ci]
2024-11-07 09:00:14 +01:00
Jon-Olov Vatn a820beebfa Updates to discovery documentation
Use infix-c0-ff-ee (or similar) rather than infix-00-00-00
Adapting picture and text for netbrowse function to use more than on unit

[skip ci]
2024-11-07 09:00:14 +01:00
Ahmed KaricandJon-Olov Vatn 204672779b doc: Update discovery.md
Add information about:
  - mDNS alias
  - https://network.local

[skip ci]

Fixes #738
2024-11-07 09:00:14 +01:00
Mattias WalströmandGitHub 6a9f9fd3cc Merge pull request #806 from kernelkit/put-config-dicts
Put config dicts
2024-11-06 20:54:55 +01:00
Mattias Walström a78fd3da0a test: ospf_bfd: Wait for correct route before continue
This to make the test to be more stable.
2024-11-06 20:23:53 +01:00
Mattias Walström 8721255554 test: ospf_multiarea: Set static router-id
This is to workaround #807. To test automatic router id selection
a new test is required, which sets interfaces and activate ospf in
separete NETCONF/RESTCONF query.
2024-11-06 14:59:00 +01:00
Mattias Walström 5079691201 test: Convert ospf_multiarea to use put_config_dicts 2024-11-06 12:06:19 +01:00
Mattias Walström a23634dd7e test: Implement put_config_dicts
Add all configuration in one command.
Also update the test igmp_vlan to use
put_config_dicts instead of put_config_dict
2024-11-06 12:06:19 +01:00
Tobias WaldekranzandGitHub 3840ebc9fe Merge pull request #799 from kernelkit/ospf-bfd
test: Multi-Port Network Namespaces
2024-11-05 15:46:30 +01:00
Tobias Waldekranz 56abfde8ec test: netns: Add missing class documentation to describe TPMRs
[skip-ci]
2024-11-05 15:45:00 +01:00
Joachim WibergandGitHub c81b03e1ca Merge pull request #796 from kernelkit/rtc
Support for save/restore system clock from file
2024-11-05 13:05:59 +01:00
Tobias Waldekranz 96d200fe70 test: vlan_ping: Improve test step description and structure
Initially done as a workaround for the MACVLAN create/remove race. But
even though the old version of this test now works, this refactor
provides better test step descriptions, making it easier to follow for
anyone looking to manually verify the functionality.
2024-11-04 14:42:31 +01:00
Tobias Waldekranz 7f2f3768db test: ospf_bfd: Verify fast fail-over using BFD 2024-11-04 14:42:31 +01:00
Tobias Waldekranz dc92db4e9f test: netns: Add Two-Port MAC Relay (TPMR)
This is a specialized namespace, containing two ports,
which (hopefully) acts as completely transparent "bump-on-the-wire"
bridge.

Useful in scenarios where you want to test what happens when the flow
of packets between two nodes is disrupted. E.g., for testing fail-over
behavior in dynamic routing protocols, L2 redundancy, VRRP etc.
2024-11-04 14:42:31 +01:00
Tobias Waldekranz be828d46c9 test: netns: Poll for MACVLAN removal completion
Now that we're using the `passthru` mode of MACVLANs, it seems we can
rely on the parent interface's promiscuity going down to 0 as an
indication that the kernel has completed the removal of the interface,
and will accept the creation of a new one.
2024-11-04 14:42:31 +01:00
Tobias Waldekranz a4a4a49eae test: netns: Guard against "double free" when failing to setup netns
When used as a context manager, __exit__ will be called even though
__enter__ might throw an exception half way through. So there is no
guarantee that the instance is on the cleanup list when we get to
stop().
2024-11-04 14:42:31 +01:00
Tobias Waldekranz 2a6e4402f8 test: netns: Clean up lingering namespaces on test exit
This gets rid of annoying "Address already in use" errors when running
tests repeatedly from a test-sh.
2024-11-04 14:42:31 +01:00
Tobias Waldekranz 3031bba047 test: netns: Use passthru mode for MACVLANs
This mode let's us receive all packets from the parent device, which
is automatically set in promiscuous mode, and let's the MACVLAN
transmit packets with any SA, which we need to implement a TPMR (or a
bridge or anything else we might dream up)
2024-11-04 14:42:31 +01:00
Tobias Waldekranz f9e430e41d test: netns: Generalize IsolatedMacVlan to support multiple interfaces
This is needed to create namespaces with MACVLANs from different
parent interfaces. The first consumer will be a Two-Port Mac
Relay (TPMR), so that we can control the flow of packets between two
nodes.
2024-11-04 14:42:31 +01:00
Tobias Waldekranz 17403afeb4 test: pcap: Avoid creating dumpcap zombies
Story time:

In the days of yore, we generated PCAPs using tcpdump, which will
flush any buffered packets to its output file on reception of
SIGUSR2. Therefore we sent a USR2 before terminating the capture.

At some point, we switched over to use tshark to capture packets for
us, but the SIGUSR2 sayed in place.

It turns out, tshark will just die on USR2, abandoning the dumpcap
child it has created, which means the enclosing network namespace
can't be properly torn down.

Therefore:

Remove skip sending USR2 and just send TERM directly.
2024-11-04 14:42:31 +01:00
Joachim WibergandGitHub bca13137a3 Merge pull request #800 from kernelkit/jovatn-test-arch-doc-fix
Update test-arch.md
2024-11-04 14:25:48 +01:00
Jon-Olov VatnandGitHub 6ba13776df Update test-arch.md
Fixing typo

[skip ci]
2024-11-04 14:19:29 +01:00
Joachim Wiberg 1323d2f266 doc: update ChangeLog
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-04 11:33:51 +01:00
Joachim Wiberg 79d7e8bbab configs: allow aarch64 targets to save system clock to a file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-04 11:10:53 +01:00
Joachim Wiberg 5a38e8768b package/finit: backport upstream v4.9-pre patches
Backport support for saving and restoring system time from a file on
systems with broken RTC that reset to the future.

With this support a system can be sure time only ever moves forward.

Fix #794

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-04 11:10:53 +01:00
Joachim Wiberg c23b9c2dc4 package/finit: fix missing default hostname
The string variable handling in configuring Finit did not follow the
Buildroot best practises.  This patch adds stripping quotes from all
string variables before adding them as configure arguments.

This fixes issue with, e.g., this sneaky bastard:

    configure --with-rtc-date=""2024-10-12 12:34:56""

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-03 22:14:00 +01:00
Joachim Wiberg 5261e4f66f board/common: add support for tweaking RTC behavior
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-03 22:14:00 +01:00
Joachim Wiberg a6b7b3d2c0 board/common: fix issue with grub menu being misaligned
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-03 22:14:00 +01:00
Joachim Wiberg b4d6c787d5 board/common: allow more logging to stdout before starting qemu
Creating/Recreating the qcow2 image now logs to stdout, as does the check
using qemu-img, which looks funny in raw mode.  So let's delay the start
of raw mode until just before starting qemu.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-03 22:14:00 +01:00
Joachim Wiberg 58b2ade1e6 board/common: don't regenerate disk image when starting qemu
This fixes an annoying problem with `make run` when set to boot with a
qcow2 disk image.  By default the disk image was recreated every time
the qemu.sh script was called.

Also, add image check to enforce regen if broken.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-03 22:14:00 +01:00
Joachim Wiberg 228c93e430 board/common: hide /var option when booting disk image
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-03 22:14:00 +01:00
Joachim Wiberg 2938efc8a4 board/common: proper string check in /var/lib bind mount
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-03 22:14:00 +01:00
Joachim Wiberg ae82f7fdcf board/aarch64: disable rtc on styx, all revs
The RTC in the CN913x series does not have any "valid" bit, and this
board (all revs) does not have any backup power connected, so it will
return garbage values after every vold boot.

It was therefore decided to disable the RTC completely and set system
time manually, or using an NTP client.  This way any time skips would
only ever be forward, never backwards.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-03 22:14:00 +01:00
Jon-Olov VatnandGitHub fbddedb51b Merge pull request #792 from kernelkit/jovatn/doc-fixes
Minor doc fixes
2024-11-01 09:21:39 +01:00
Jon-Olov VatnandGitHub 43e2201dd1 Merge branch 'main' into jovatn/doc-fixes 2024-11-01 08:58:12 +01:00
Jon-Olov Vatn b8b0cd3377 Addressing feedback on doc fixes
[skip ci]
2024-11-01 08:54:47 +01:00
Jon-Olov Vatn 6b63b2f9b4 Minor doc fixes
[skip ci]
2024-11-01 08:27:13 +01:00
Joachim WibergandGitHub 142eda81d5 Merge pull request #783 from rical/cli-add-show-iface-cont-sup 2024-10-31 20:22:04 +01:00
Joachim WibergandGitHub fb3c026288 Merge pull request #791 from kernelkit/reboot-on-error 2024-10-31 20:21:33 +01:00
Mattias Walström b0f4192f24 kernel: Reboot device if kernel panics
The worst way of handling a kernel crash is to do nothing at all.
2024-10-31 15:55:47 +01:00
Richard Alpe b9492c7bee cli: add container support to show interfaces
Make show interfaces container aware. This is done by looking though
all podman containers for interfaces and looking up there info from
network namespaces on the main system / hypervisor.

Interfaces controlled by containers are clearly marked in the "show
interfaces" output, with a single gray row. Telling the user that they
belong to one or more named containers. The user can then run "show
interface name NAME" on interfaces owned by containers, which provided
some additional info, such as mac address and stat counters.

The patch also add support for printing veth peers which are owned by
containers.

Lastly, the patch also adds test cases for this functionality.

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-10-29 17:23:30 +01:00
Richard Alpe 31061fcc10 yanger: simplify setting of admin-status
There should be no functional change.
2024-10-29 17:22:59 +01:00
Joachim WibergandGitHub 3e8ead6f92 Merge pull request #778 from kernelkit/r2s-libssh-openssl 2024-10-29 09:14:21 +01:00
Jon-Olov VatnandGitHub b00b6cd6ea Merge pull request #766 from kernelkit/update-bridging-doc
Update bridging doc
2024-10-29 08:33:03 +01:00
Joachim Wiberg ba60b8b494 configs: re-enable OpenSSL backend for libssh/libssh2 also on R2S
Fixes issue with netopeer2-server failing to load its host certificate.

Follow-up to 8b75022 for the NanoPi R2S.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-29 05:47:57 +01:00
Mattias WalströmandGitHub 1e5d4612c9 Merge pull request #767 from addiva-elektronik/update-make-test-spec
Minor Update in Generating Test Spec
2024-10-28 15:16:36 +01:00
Ahmed Karic b359ac794d test: update make-test-spec to escape '/'
It has been identified that the sed command fails to process INFIX_NAME
when it contains an unescaped '/' character.
2024-10-28 13:18:46 +01:00
Ahmed Karic 3b00a376b1 test: regenerate .svg for dhcp_basic test
In the recent work, the generation and commit of topology.svg for the
dhcp_basic test was unintentionally overlooked.
2024-10-28 13:18:21 +01:00
Joachim WibergandGitHub 00cdff1d2d Merge pull request #761 from kernelkit/misc-interface-dhcp
Misc interface dhcp

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-28 12:38:25 +01:00
Joachim Wiberg 3e5e89b328 package/finit: backport fix to clear background color from GRUB menu
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-28 11:04:49 +01:00
Joachim Wiberg 56d1964559 doc: sync dev-guide and contributing guidelines
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-28 11:04:49 +01:00
Joachim Wiberg 0112113028 doc: add description of description setting and update ChangeLog
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-28 11:04:49 +01:00
Joachim Wiberg 967bfc1e67 test: new test, verify ifAlias
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-28 11:04:49 +01:00
Joachim Wiberg 0284e2ca58 confd: allow interface description as ifAlias
This patch adds support for setting the free form description string as
the interface alias.  This can be read from /sys/class/net/*/ifalias, or
using the 'ip link show' command.  The ifalias is reported by SNMP and
LLDP by default, and now also in the operational datastore.

Linux supports 250 characters in ifalias, but the IF-MIB is restricted
to 64 characters, so we add a local deviation to limit the type.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-28 11:04:49 +01:00
Joachim Wiberg 710616f8c4 doc,test: clarify relationship between DHCP option 3 and 121
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-28 11:04:49 +01:00
Joachim Wiberg dbf0fd2514 board/common: fix rauc compatible regression
The new variable INFIX_COMPATIBLE, used for the RAUC compatible string,
is not properly evaluated on defconfigs where it is composed of another
variable, e.g.

    INFIX_COMPATIBLE="${INFIX_IMAGE_ID}"

Unfortunately, this is the default value for INFIX_COMPATIBLE, and so it
breaks all tier one defconfigs on the mainline branch since a1771ff.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-28 11:04:49 +01:00
Jon-Olov Vatn aefb90f8f3 Doc: Updating pictures in bridging examples
[skip ci]
2024-10-25 15:31:59 +02:00
Jon-Olov Vatn 49660b7771 Fixing #748 by updating doc on MAC bridging
- Introduce the term MAC bridge in the networking documentation
- List the limitation to one MAC bridge on Marvell Linkstree
- Adding lego pictures for the MAC bridge and VLAN bridge examples

[skip ci]
2024-10-25 15:21:00 +02:00
Ahmed KaricandGitHub 55a20bb4c7 Merge pull request #764 from addiva-elektronik/update-infix-test
Simplify Running Infix Tests from External Projects
2024-10-25 10:29:13 +02:00
Ahmed Karic 3b2bdbf93c test: simplify running infix tests from external
This will facilitate running infix tests from external projects:
  - eliminate the need for an external topology.dot.in file
  - eliminate the requirement to manually provide external image name

Fixes #763
2024-10-25 09:57:08 +02:00
Ahmed KaricandGitHub 04c843e095 Merge pull request #760 from kernelkit/update-dhcp-tests
test: update dhcp test topologies
2024-10-24 13:57:27 +02:00
Tobias WaldekranzandGitHub 1aa5169641 Merge pull request #757 from kernelkit/rauc-compatible2
Use INFIX_COMPATIBLE also for aux partition's rauc.status
2024-10-24 12:26:45 +02:00
Ahmed Karic 594d074f7a test: update dhcp test topologies
Fixes #746
2024-10-24 09:59:56 +02:00
jovatnandGitHub b81407e7d9 Merge pull request #759 from kernelkit/jovatn/doc-vlan-iface-qos
Update QoS documentation (VLAN interface ingress/egress priority)
2024-10-24 09:33:34 +02:00
Mattias WalströmandGitHub 8fc0ab9b2f Merge pull request #758 from kernelkit/update-test-spec
Update test spec
2024-10-23 14:50:47 +02:00
Mattias Walström 3b3656c8f5 test: spec: change image format from PNG to SVG
SVG is a plain text file, better to see why it changed
than binary PNG. Also fix #744 by adding infix/OEM hash
to test specification

Signed-off-by: Mattias Walström <lazzer@gmail.com>
2024-10-23 14:21:26 +02:00
Jon-Olov Vatn 0eb1fe0ab0 Add QoS doc change to Changelog
[skip ci]
2024-10-23 13:55:28 +02:00
Jon-Olov Vatn 9be43ed0bb Updating colors in QoS complex example picture
[skip ci]
2024-10-23 13:47:30 +02:00
Jon-Olov Vatn 604f22e315 Updating QoS documentation
- More information on Software Forwarding, and its settings.
- Pictures added

[skip ci]
2024-10-23 13:47:30 +02:00
Mattias Walström 76f0c8e3e6 test:spec: Add version of Infix/OEM build
Show the version of the infix build, for traceability

This fix #744

Signed-off-by: Mattias Walström <lazzer@gmail.com>
2024-10-23 13:45:30 +02:00
Joachim WibergandGitHub d36296da42 Merge pull request #754 from kernelkit/firewall-test
Container firewall test
2024-10-23 13:42:53 +02:00
Joachim WibergandGitHub 9f33658127 Merge pull request #756 from kernelkit/r2s-factory
Update r2s factory-config
2024-10-23 12:46:55 +02:00
Joachim WibergandGitHub 767a1f194b .github: create discussion for new releases
[skip ci]
2024-10-23 12:45:24 +02:00
Joachim Wiberg c7760a68cb test: update infix-containers group README
This is a proposal to how a test section/group overview could look.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-23 12:27:42 +02:00
Joachim Wiberg 933613e6a3 test: new basic firewall container test
Fix #598

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-23 12:27:42 +02:00
Joachim Wiberg 14fde1bf90 test: new util method to_binary()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-23 10:08:10 +02:00
Joachim Wiberg 64c20d96ad test: minor, cleanup
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-23 10:08:10 +02:00
Joachim Wiberg a1771ff5c6 board/common: use INFIX_COMPATIBLE also in rauc.status
Follow-up to cedb654, issue #755.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-23 10:03:22 +02:00
Joachim Wiberg a7e7b75a97 board/aarch64: update r2s factory-config
- add default-deny-all rule from 2341e07
 - enable iburst for the ntp client (quicker initial sync)
 - bump meta version (to skip .cfg migration at boot)

Fix #750 [skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-23 08:04:31 +02:00
Joachim WibergandGitHub 822cb93265 Merge pull request #755 from kernelkit/rauc-compatible
Add support for overriding the compatible string

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-22 19:36:31 +02:00
Joachim Wiberg cedb654643 Add support for overriding the compatible string
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-22 18:32:55 +02:00
Ahmed KaricandGitHub 52eafa70a8 Merge pull request #749 from kernelkit/disable-ntpd
Disable BusyBox Related NTP Services
2024-10-22 17:03:47 +02:00
Ahmed Karic 6ba8e3bf55 busybox: disable ntpd from defconfig 2024-10-22 13:28:39 +02:00
Joachim WibergandGitHub f119138107 Update SUPPORT.md
[skip ci]
2024-10-22 12:08:43 +02:00
Ahmed KaricandGitHub 5c822efa6f Merge pull request #742 from kernelkit/add-docs-ntp
Update system.md by adding NTP details
2024-10-22 09:50:03 +02:00
Mattias WalströmandGitHub 19d5f1db1c Merge pull request #752 from kernelkit/dsa-interface
Make detection of DSA interface more robust
2024-10-22 09:37:37 +02:00
Ahmed Karic 438e39d2fe doc: update system.md with ntp information
Fixes #733
2024-10-22 08:58:19 +02:00
Mattias Walström 0ee973b2b2 Make detection of DSA interface more robust
Sometimes the interface creation are done, but
the sysfs is not, this gap we sometimes finds
in the nameif script. Wait out the sysfs creation
if running a DSA switch.

Fix #685

Signed-off-by: Mattias Walström <lazzer@gmail.com>
2024-10-22 08:50:54 +02:00
Joachim WibergandGitHub c0e68579c1 Merge pull request #737 from kernelkit/checklist
Checklist for code review and releases

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-21 10:10:25 +02:00
Joachim Wiberg 5b61ccd960 .github: update pull request template
For some documentation changes, e.g., the recent change in the QoS
documentation, see de76b97, it is highly relevant to also mention
this change in the release notes.

In fact, any change that would make it worthwhile for a user to
update their knowledge on a topic should probably be documented
in the release notes.

[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-21 10:09:39 +02:00
Joachim Wiberg 1dd761560d .github: add checklist for pull requests and releases
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-21 10:07:15 +02:00
Joachim Wiberg 076d174579 Update ChangeLog for v24.10.1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-18 15:32:29 +02:00
Tobias WaldekranzandGitHub 1470c473f6 Merge pull request #736 from kernelkit/fix-missing-copy-command
Add missing copy and erase commands to CLI
2024-10-18 15:08:48 +02:00
Joachim Wiberg 9ae7115bbf doc: update ChangeLog for upcoming v24.10.1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-18 14:16:51 +02:00
Joachim Wiberg f9a0c71b1f package/klish: make sure to select bin tools (copy, erase)
Fix #735

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-18 14:13:45 +02:00
413 changed files with 13217 additions and 2066 deletions
+36
View File
@@ -0,0 +1,36 @@
Checklists for Pull Requests and Releases
=========================================
Maintainer checklists for reviewing pull requests and doing releases.
Pull Requests
-------------
- If applicable, is there a readable ChangeLog entry?
- If any LICENSE file has been updated, has the `.hash` file been updated?
- If any change to a Finit `.svc` file, does any run/task linger?
I.e., is there a runlevel and/or condition defined to prevent them
from running outside of their intended runlevel?
- If any change to grub or qemu/qeneth setup, has it been tested in GNS3?
- If any change to u-boot/buildroot, has it been tested with `<booloader>_defconfig`
- If any change to logging, have the resulting logs been audited?
- Check for duplicate entries, misspellings
- Check for sneaky severity changes, e.g., error vs note, error vs warning
- If new subsystem, or major changes to a subsystem, have the docs been updated?
- If change to mDNS, has it been tested with netbrowse?
- If change to `_defconfig`, verify `local.mk` and sync with other archs
- Test manually as well, e.g., CLI changes do not have ha regression tests
- Build from distclean, or use artifacts built by build servers, for manual tests
Releases
--------
- Make at least one -betaN release to verify the GitHub workflow well in time release day
- Stuff happens, remember kernelkit/infix#735
- Make at least one -rcN to flush out any issues in customer repos
- Easy to forget adaptations/hacks in customer repos -- may need Infix change/support
- Ensure the markdown link for the release diff is updated
- Ensure subrepos are tagged (can be automated, see kernelkit/infix#393)
- Sync tags for all repo. sync activities
+3 -2
View File
@@ -1,5 +1,5 @@
Contributing to Infix
=====================
Contributing Guidelines
=======================
Thank :heart: you for taking the time to read this!
@@ -12,6 +12,7 @@ If you are unsure how to start implementing an idea or fix:
- :bug: open an issue, there are human friendly templates for _bugs_
and _feature requests_ at <https://github.com/kernelkit/infix/issues>
- :speech_balloon: use the [Q&A Forum][discuss]
- :technologist: The [Developer's Guide][devguide] is also a useful start
> _Talking about code and problems first is often the best way to get
> started before submitting a pull request. We have found it always
+3 -3
View File
@@ -4,9 +4,9 @@ project on GitHub, and Discord, see <https://github.com/kernelkit>:
&nbsp;&nbsp; :speech_balloon: <https://github.com/orgs/kernelkit/discussions>
&nbsp;&nbsp; :bug: <https://github.com/kernelkit/infix/issues>
Support contracts, development of new features, customer branding of
Infix, and even customer specific features for dedicated products is
provided by Addiva Elektronik.
Support contracts, development of new features, fast-tracking of reviews
and contributions, customer branding of Infix, and even customer specific
features for dedicated products is provided by Addiva Elektronik.
&nbsp;&nbsp; :globe_with_meridians: <https://www.addiva.se/electronics/>
&nbsp;&nbsp; :e-mail: <mailto:ael@addiva.se>
+1
View File
@@ -24,4 +24,5 @@ Tick *relevant* boxes, this PR is-a or has-a:
- [ ] Refactoring (please detail in commit messages)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] ChangeLog updated (for major changes)
- [ ] Other (please describe):
+4
View File
@@ -101,6 +101,7 @@ jobs:
runs-on: [ self-hosted, release ]
permissions:
contents: write
discussions: write
steps:
- uses: actions/checkout@v4
with:
@@ -115,12 +116,14 @@ jobs:
ver=${GITHUB_REF#refs/tags/}
fi
echo "ver=${ver}" >> $GITHUB_OUTPUT
echo "cat=" >> $GITHUB_OUTPUT
if echo $ver | grep -qE 'v[0-9.]+(-alpha|-beta|-rc)[0-9]*'; then
echo "pre=true" >> $GITHUB_OUTPUT
echo "latest=false" >> $GITHUB_OUTPUT
elif echo $ver | grep -qE '^v[0-9.]+\.[0-9.]+(\.[0-9]+)?$'; then
echo "pre=false" >> $GITHUB_OUTPUT
echo "latest=true" >> $GITHUB_OUTPUT
echo "cat=Releases" >> $GITHUB_OUTPUT
else
echo "pre=false" >> $GITHUB_OUTPUT
echo "latest=false" >> $GITHUB_OUTPUT
@@ -150,6 +153,7 @@ jobs:
name: Infix ${{ github.ref_name }}
prerelease: ${{ steps.rel.outputs.pre }}
makeLatest: ${{ steps.rel.outputs.latest }}
discussionCategory: ${{ steps.rel.outputs.cat }}
bodyFile: release.md
artifacts: "*.tar.gz*"
+1
View File
@@ -8,3 +8,4 @@
/test/.venv
/test/.log
/local.mk
/test/spec/Readme.adoc
+11
View File
@@ -52,6 +52,17 @@ config INFIX_IMAGE_ID
Mandatory. When INFIX_RELEASE is set, this string is appended to
the IMAGE_ID with a '-' separator.
config INFIX_COMPATIBLE
string "Operating system compatible string"
default "${INFIX_IMAGE_ID}"
help
A lower-case string (no spaces or other characters outside of 09,
az, ".", "_" and "-"), used for image identification at upgrade.
E.g., the RAUC [system] compatible string.
Mandatory. Defaults to $INFIX_IMAGE_ID, which in turn is composed
of $INFIX_ID-$BR2_ARCH.
config INFIX_TAGLINE
string "Operating system tagline"
default "Infix -- a Network Operating System"
+7 -7
View File
@@ -27,13 +27,13 @@ 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.
In itself Infix is perfectly suited for dedicated networking tasks and
native support for Docker containers provides a versatile platform that
can easily be adapted to any customer need. Be it legacy applications,
network protocols, process monitoring, or edge data analysis, it can run
close to end equipment. Either directly connected on dedicated Ethernet
ports or indirectly using virtual network cables to exist on the same
LAN as other connected equipment.
In itself, Infix is perfectly suited for dedicated networking tasks, and
with native support for Docker containers, the operating system provides
a versatile platform that can easily be adapted to any customer need.
Be it legacy applications, network protocols, process monitoring, or
edge data analysis, it can run close to end equipment. Either directly
connected on dedicated Ethernet ports or indirectly using virtual
network cables to exist on the same LAN as other connected equipment.
The simple design of Infix provides complete control over both system
and data, minimal cognitive burden, and makes it incredibly easy to get
+36 -4
View File
@@ -33,6 +33,14 @@
};
};
/*
* RTC has no valid bit, and this board does not connect any
* backup power (e.g. supercap) to it, so it returns garbage
* after every cold reset.
*/
&cp0_rtc {
status = "disabled";
};
/* UART0 (Console) */
@@ -257,14 +265,38 @@
};
};
#define SWP_LED(_func) \
#define SWP_LED \
leds { \
#address-cells = <1>; \
#size-cells = <0>; \
\
led@0 { \
reg = <0>; \
function = _func; \
function = "tp"; \
color = <LED_COLOR_ID_GREEN>; \
default-state = "keep"; \
}; \
led@1 { \
reg = <1>; \
function = "aux"; \
color = <LED_COLOR_ID_GREEN>; \
default-state = "off"; \
}; \
}
/* SFP LEDs
* Rev A. LEDs do not work at all
* Rev B. only outer-most (green) LEDs work
*/
#define SFP_LED \
leds { \
#address-cells = <1>; \
#size-cells = <0>; \
\
led@0 { \
reg = <0>; \
function = "sfp"; \
color = <LED_COLOR_ID_GREEN>; \
default-state = "keep"; \
}; \
@@ -279,7 +311,7 @@
phy-mode = "10gbase-r"; \
managed = "in-band-status"; \
sfp = <_sfp>; \
SWP_LED("sfp"); \
SFP_LED; \
}
#define XSWCPU(_n, _eth) \
@@ -313,7 +345,7 @@
nvmem-cell-names = "mac-address"; \
phy-mode = "gmii"; \
phy-handle = <_phy>; \
SWP_LED("tp"); \
SWP_LED; \
}
#define GPHY(_n) \
+2
View File
@@ -539,6 +539,8 @@ CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_FS=y
CONFIG_PANIC_ON_OOPS=y
CONFIG_PANIC_TIMEOUT=20
CONFIG_DETECT_HUNG_TASK=y
# CONFIG_SCHED_DEBUG is not set
# CONFIG_RCU_TRACE is not set
@@ -58,6 +58,7 @@
}
},
"ietf-netconf-acm:nacm": {
"enable-nacm": true,
"groups": {
"group": [
{
@@ -83,6 +84,21 @@
"comment": "Allow 'admin' group complete access to all operations and data."
}
]
},
{
"name": "default-deny-all",
"group": [
"*"
],
"rule": [
{
"name": "deny-password-read",
"module-name": "ietf-system",
"path": "/ietf-system:system/authentication/user/password",
"access-operations": "*",
"action": "deny"
}
]
}
]
},
@@ -123,7 +139,8 @@
"name": "ntp.org",
"udp": {
"address": "pool.ntp.org"
}
},
"iburst": true
}
]
},
@@ -169,7 +186,7 @@
]
},
"infix-meta:meta": {
"infix-meta:version": "1.0"
"infix-meta:version": "1.2"
},
"infix-services:mdns": {
"enabled": true
+111
View File
@@ -0,0 +1,111 @@
#!/bin/sh
# Raw switch LED Control for systems that do not run iitod
LEDS=$(find /sys/class/leds -iname '*mdio-mii*')
LINK=$(find /sys/class/leds -iname '*mdio-mii*p')
# Disable ALL switch port LEDs
clear()
{
for led in $LEDS; do
echo 0 > "${led}/brightness"
done
}
setup()
{
for led in $LINK; do
echo netdev > "${led}/trigger"
done
for led in $LINK; do
cd "$led"
# No sleep here, it's enough with the delay from previous loop
echo 1 > link
sleep 0.1
echo 1 > rx
sleep 0.1
echo 1 > tx
cd - >/dev/null
done
}
leds()
{
for led in $LINK; do
printf "%3s: %s\n" "$(cat "$led/device_name" 2>/dev/null)" "$led"
done
}
list()
{
leds | sort | while read -r port path; do
printf "%4s %s\n" "$port" "$(basename "$path")"
aux=${path%%:tp}:aux
if [ -e "$aux" ]; then
printf "%3s: %s\n" "" "$(basename "$aux")"
fi
done
}
flash()
{
sec=$1
for led in $LEDS; do
echo timer > "${led}/trigger"
done
for led in $LEDS; do
echo 84 > "${led}/delay_on"
echo 84 > "${led}/delay_off"
done
sleep "$sec"
clear
}
usage()
{
echo "usage: $0 [command]"
echo
echo "flash [SEC] Flash all LEDs to locate device in rack, default: 5 sec"
echo "list List all LEDs"
echo "setup Set up and start normal operation"
echo "start Call at system init, clears all LEDs and sets up normal op"
echo "stop Clear all LEDs, may be called at system shutdown"
echo
echo "Please ensure no other tool or daemon is already managing the LEDs."
}
cmd=$1; shift
case $cmd in
flash)
flash ${1:-5}
setup
;;
help)
usage
exit 0
;;
list | ls)
list
;;
setup)
setup
;;
start)
initctl -nbq cond clear led
clear
setup
;;
stop)
clear
;;
*)
usage
exit 1
;;
esac
@@ -0,0 +1 @@
/usr/libexec/styx/led.sh
+6 -6
View File
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Busybox version: 1.36.0
# Thu Feb 8 08:22:32 2024
# Busybox version: 1.36.1
# Tue Oct 22 13:12:02 2024
#
CONFIG_HAVE_DOT_CONFIG=y
@@ -957,10 +957,10 @@ CONFIG_FEATURE_NETSTAT_PRG=y
CONFIG_NSLOOKUP=y
CONFIG_FEATURE_NSLOOKUP_BIG=y
CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS=y
CONFIG_NTPD=y
CONFIG_FEATURE_NTPD_SERVER=y
CONFIG_FEATURE_NTPD_CONF=y
CONFIG_FEATURE_NTP_AUTH=y
# CONFIG_NTPD is not set
# CONFIG_FEATURE_NTPD_SERVER is not set
# CONFIG_FEATURE_NTPD_CONF is not set
# CONFIG_FEATURE_NTP_AUTH is not set
CONFIG_PING=y
CONFIG_PING6=y
CONFIG_FEATURE_FANCY_PING=y
+11 -2
View File
@@ -16,13 +16,22 @@ die()
# DISK_IMAGE_SIZE="512"
# etc.
#
# Nested variables, like INFIX_COMPATIBLE="${INFIX_IMAGE_ID}"
# are handled by sourcing the file in a subshell.
#
# shellcheck disable=SC1090
load_cfg()
{
tmp=$(mktemp -p /tmp)
(
. "$BR2_CONFIG" 2>/dev/null
# Set *all* matching variables
set | grep -E "^${1}[^=]*=" | while IFS= read -r line; do
echo "$line"
done
) > "$tmp"
grep -E "${1}.*=" "$BR2_CONFIG" >"$tmp"
. "$tmp"
rm "$tmp"
}
+1 -1
View File
@@ -62,7 +62,7 @@ else
fi
if [ -f "$TARGET_DIR/etc/rauc/system.conf" ]; then
sed -i "s/compatible=.*/compatible=$NAME/" "$TARGET_DIR/etc/rauc/system.conf"
sed -i "s/compatible=.*/compatible=$INFIX_COMPATIBLE/" "$TARGET_DIR/etc/rauc/system.conf"
fi
# This is a symlink to /usr/lib/os-release, so we remove this to keep
+5 -2
View File
@@ -7,11 +7,14 @@ common=$(dirname "$(readlink -f "$0")")
# shellcheck disable=SC1091
. "$TARGET_DIR/etc/os-release"
load_cfg INFIX_ID
# The INFIX_* variables may be composed from BR2_* variables,
# so we source them last.
load_cfg BR2_ARCH
load_cfg BR2_DEFCONFIG
load_cfg BR2_EXTERNAL_INFIX_PATH
load_cfg BR2_TARGET_ROOTFS
load_cfg INFIX_ID
load_cfg INFIX_COMPATIBLE
# The default IMAGE_ID is infix-$BR2_ARCH but can be overridden
# for imaage names, and compat strings, like infix-r2s
@@ -39,7 +42,7 @@ if [ "$SIGN_ENABLED" = "y" ]; then
$common/sign.sh $BR2_ARCH $SIGN_KEY
ixmsg "Creating RAUC Update Bundle"
$common/mkrauc.sh "$NAME$(ver)" $NAME $SIGN_KEY
$common/mkrauc.sh "$NAME$(ver)" $INFIX_COMPATIBLE $SIGN_KEY
fi
load_cfg DISK_IMAGE
+58 -1
View File
@@ -106,6 +106,8 @@ config QEMU_DTB_EXTEND
depends on QEMU_LOADER_UBOOT
default y if QEMU_aarch64
if QEMU_ROOTFS_INITRD
config QEMU_RW
string "Writable /cfg layer"
depends on QEMU_ROOTFS_INITRD
@@ -123,6 +125,8 @@ config QEMU_RW_VAR
default "var.ext4"
endif
endif
config QEMU_VPD
bool "Emulate a Vital Product Data (VPD) Memory"
@@ -137,10 +141,55 @@ config QEMU_APPEND
config QEMU_EXTRA
string "Extra QEMU options"
comment "RTC"
choice
prompt "Mode"
default QEMU_RTC_UTC
config QEMU_RTC_UTC
bool "UTC"
config QEMU_RTC_LOCAL
bool "Local time"
config QEMU_RTC_RANDOM
bool "Random"
endchoice
choice
prompt "Clock"
default QEMU_CLOCK_HOST
config QEMU_CLOCK_HOST
bool "Host clock"
config QEMU_CLOCK_RT
bool "Independent (monotonic)"
config QEMU_CLOCK_VM
bool "Virtual"
endchoice
config QEMU_RTC
string
default "utc" if QEMU_RTC_UTC
default "localtime" if QEMU_RTC_LOCAL
default "random" if QEMU_RTC_RANDOM
config QEMU_CLOCK
string
default "host" if QEMU_CLOCK_HOST
default "rt" if QEMU_CLOCK_RT
default "vm" if QEMU_CLOCK_VM
comment "Networking"
choice
prompt "Mode"
prompt "Network Mode"
default QEMU_NET_USER
config QEMU_NET_NONE
@@ -155,6 +204,9 @@ config QEMU_NET_USER
config QEMU_NET_TAP
bool "TAP"
config QEMU_NET_ROCKER
bool "Rocker"
endchoice
config QEMU_NET_MODEL
@@ -180,3 +232,8 @@ config QEMU_NET_TAP_N
int "Number of TAPs"
depends on QEMU_NET_TAP
default 1
config QEMU_NET_PORTS
int "Number of Rocker switch ports"
depends on QEMU_NET_ROCKER
default 10
+95 -28
View File
@@ -17,9 +17,10 @@
#
# ./qemu.sh -h
#
# shellcheck disable=SC3037
# Local variables
imgdir=$(readlink -f $(dirname "$0"))
imgdir=$(readlink -f "$(dirname "$0")")
prognm=$(basename "$0")
usage()
@@ -30,6 +31,7 @@ usage()
echo "Options:"
echo " -c Run menuconfig to change Qemu settings"
echo " -h This help text"
echo " -k Keep generated qemu.run script (name shown at end)"
echo
echo "Arguments:"
echo " ARGS1 Args before the '--' separator are for kernel space"
@@ -54,19 +56,20 @@ die()
load_qemucfg()
{
local tmp=$(mktemp -p /tmp)
tmp=$(mktemp -p /tmp)
grep ^CONFIG_QEMU_ $1 >$tmp
. $tmp
rm $tmp
grep ^CONFIG_QEMU_ "$1" >"$tmp"
# shellcheck disable=SC1090
. "$tmp"
rm "$tmp"
[ "$CONFIG_QEMU_MACHINE" ] || die "Missing QEMU_MACHINE"
[ "$CONFIG_QEMU_ROOTFS" ] || die "Missing QEMU_ROOTFS"
[ "$CONFIG_QEMU_KERNEL" -a "$CONFIG_QEMU_BIOS" ] \
[ -n "$CONFIG_QEMU_KERNEL" ] && [ -n "$CONFIG_QEMU_BIOS" ] \
&& die "QEMU_KERNEL conflicts with QEMU_BIOS"
[ ! "$CONFIG_QEMU_KERNEL" -a ! "$CONFIG_QEMU_BIOS" ] \
[ -z "$CONFIG_QEMU_KERNEL" ] && [ -z "$CONFIG_QEMU_BIOS" ] \
&& die "QEMU_KERNEL or QEMU_BIOS must be set"
}
@@ -93,7 +96,7 @@ append_args()
if [ "$CONFIG_QEMU_ROOTFS_INITRD" = "y" ]; then
# Size of initrd, rounded up to nearest kb
local size=$((($(stat -c %s $CONFIG_QEMU_ROOTFS) + 1023) >> 10))
size=$((($(stat -c %s "$CONFIG_QEMU_ROOTFS") + 1023) >> 10))
echo -n "root=/dev/ram0 ramdisk_size=${size} "
elif [ "$CONFIG_QEMU_ROOTFS_VSCSI" = "y" ]; then
echo -n "root=PARTLABEL=primary "
@@ -198,13 +201,24 @@ host_args()
net_dev_args()
{
local name="e$1"
local mac=$(printf "02:00:00:00:00:%02x" $1)
name="e$1"
mac=$(printf "02:00:00:00:00:%02x" "$1")
echo -n "-device $CONFIG_QEMU_NET_MODEL,netdev=$name,mac=$mac "
echo "$name $mac" >>"$mactab"
}
rocker_port_args()
{
sw=$1
port=$2
name="sw${sw}p${port}"
mac=$(printf "02:00:00:00:%02x:%02x" "$sw" "$port")
echo -n "-netdev tap,id=$name,ifname=$name,script=no,downscript=no "
echo "$name $mac" >> "$mactab"
}
net_args()
{
# Infix will pick up this file via fwcfg and install it to /etc
@@ -216,14 +230,25 @@ net_args()
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 1 $(($CONFIG_QEMU_NET_TAP_N))); 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
net_dev_args "$i"
done
elif [ "$CONFIG_QEMU_NET_ROCKER" = "y" ]; then
sw=sw0 # Only single switch support atm.
echo -n "-device '{\"driver\":\"rocker\", \"name\":\"${sw}\", "
echo -n "\"fp_start_macaddr\":\"02:00:00:00:00:01\", "
echo -n "\"ports\":["
for i in $(seq 1 "$CONFIG_QEMU_NET_PORTS"); do
[ "$i" -gt 1 ] && echo -n ", "
echo -n "\"${sw}p${i}\""
done
echo -n "]}' "
for i in $(seq 1 "$CONFIG_QEMU_NET_PORTS"); do
rocker_port_args 0 "$i"
done
elif [ "$CONFIG_QEMU_NET_USER" = "y" ]; then
local useropts=
[ "$CONFIG_QEMU_NET_USER_OPTS" ] && useropts=",$CONFIG_QEMU_NET_USER_OPTS"
echo -n "-netdev user,id=e1${useropts} "
net_dev_args 1
else
@@ -261,7 +286,25 @@ EOF
wdt_args()
{
echo -n "-device i6300esb -rtc clock=host"
echo -n "-device i6300esb "
}
random_date()
{
rand=$(($(date +%_s) * $$ + $(date +%N | sed 's/^0*//')))
when=$((rand % 7258118400)) # 1970 - 2200
date -d "@$when" +"%Y-%m-%dT%H:%M:%S"
}
rtc_args()
{
rtc="${CONFIG_QEMU_RTC:-utc}"
clock="${CONFIG_QEMU_CLOCK:-host}"
if [ "$rtc" = "random" ]; then
rtc=$(random_date)
fi
echo -n "-rtc base=$rtc,clock=$clock"
}
gdb_args()
@@ -273,11 +316,18 @@ gdb_args()
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
if ! qemu-img check "${CONFIG_QEMU_ROOTFS}.qcow2"; then
rm -f "${CONFIG_QEMU_ROOTFS}.qcow2"
fi
if [ ! -f "${CONFIG_QEMU_ROOTFS}.qcow2" ]; then
echo "Creating qcow2 disk image for Qemu ..."
qemu-img create -f qcow2 -o backing_file="$CONFIG_QEMU_ROOTFS" \
-F raw "${CONFIG_QEMU_ROOTFS}.qcow2" > /dev/null
fi
fi
local qemu
read qemu <<EOF
$CONFIG_QEMU_MACHINE -m $CONFIG_QEMU_MACHINE_RAM \
read -r qemu <<EOF
$CONFIG_QEMU_MACHINE -nodefaults -m $CONFIG_QEMU_MACHINE_RAM \
$(loader_args) \
$(rootfs_args) \
$(serial_args) \
@@ -286,15 +336,32 @@ run_qemu()
$(host_args) \
$(net_args) \
$(wdt_args) \
$(rtc_args) \
$(vpd_args) \
$(gdb_args) \
$CONFIG_QEMU_EXTRA
EOF
# Save resulting command to a script, because I cannot for the life
# of me figure out how to embed the JSON snippet for Rocker and run
# it here without issues, spent way too much time on it -- Joachim
run=$(mktemp -t run.qemu.XXX)
echo "#!/bin/sh" > "$run"
if [ "$CONFIG_QEMU_KERNEL" ]; then
$qemu -append "$(append_args)" "$@"
echo "$qemu -append \"$(append_args)\" $*" >> "$run"
else
$qemu "$@"
echo "$qemu $*" >> "$run"
fi
chmod +x "$run"
echo "Starting Qemu :: Ctrl-a x -- exit | Ctrl-a c -- toggle console/monitor"
line=$(stty -g)
stty raw
$run
stty "$line"
if [ -n "$keep" ]; then
echo "Keeping generated qemu.run script: $run"
else
rm "$run"
fi
}
@@ -331,7 +398,7 @@ generate_dot()
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
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;"
@@ -371,7 +438,8 @@ menuconfig()
exec kconfig-mconf Config.in
}
cd $(dirname $(readlink -f "$0"))
scriptdir=$(dirname "$(readlink -f "$0")")
cd "$scriptdir" || (echo "Failed cd to $scriptdir"; exit 1)
while [ "$1" != "" ]; do
case $1 in
@@ -381,6 +449,9 @@ while [ "$1" != "" ]; do
-h)
usage
;;
-k)
keep=true
;;
*)
break
esac
@@ -401,8 +472,4 @@ fi
generate_dot
echo "Starting Qemu :: Ctrl-a x -- exit | Ctrl-a c -- toggle console/monitor"
line=$(stty -g)
stty raw
run_qemu $(dtb_args)
stty "$line"
+2
View File
@@ -0,0 +1,2 @@
# --log-level debug
OSPFD_ARGS="-A 127.0.0.1 -u frr -g frr -f /etc/frr/ospfd.conf --log syslog"
+1
View File
@@ -0,0 +1 @@
RAUC_ARGS="-s"
+2
View File
@@ -0,0 +1,2 @@
# --log-level debug
ZEBRA_ARGS="-A 127.0.0.1 -u frr -g frr --log syslog "
@@ -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> log kill:10 \
task name:container-%i :setup \
[2345] container -n %i setup -- Setup container %i
sysv <!usr/container:%i> :%i pid:!/run/container:%i.pid log:prio:local1,tag:%i kill:10 \
[2345] container -n %i -- container %i
@@ -0,0 +1,4 @@
# Use <pid/syslogd> as barrier for other system tasks and service that
# rely on modules, firmware, and device nodes to be ready.
service if:udevd nowarn env:-/etc/default/sysklogd <run/udevadm:post/success> \
[S0123456789] syslogd -F $SYSLOGD_ARGS -- System log daemon
+1
View File
@@ -0,0 +1 @@
/var/lib/dbus/machine-id
@@ -1,2 +1 @@
alias cli='clish'
alias cfg='sysrepocfg -f json'
+58
View File
@@ -0,0 +1,58 @@
#!/bin/sh
# User-friendly wrapper for sysrepocfg
# TODO: add import/export, copy, ...
# Edit YANG binary types using sysrepo, base64, and duct tape.
edit()
{
xpath=$1
if [ -z "$xpath" ]; then
echo "Usage: cfg edit \"/full/xpath/to/binary/leaf\""
exit 1
fi
if tmp=$(sysrepocfg -G "$xpath"); then
file=$(mktemp)
echo "$tmp" | base64 -d > "$file"
if /usr/bin/editor "$file"; then
tmp=$(base64 -w0 < "$file")
sysrepocfg -S "$xpath" -u "$tmp"
fi
rm -f "$file"
else
echo "Failed to retrieve value for $xpath"
exit 1
fi
}
usage()
{
echo "Usage:"
echo " cfg CMD [ARG]"
echo
echo "Command:"
echo " edit XPATH Edit YANG binary type"
echo " help This help text"
echo
echo "As a backwards compatible fallback, this script forwards"
echo "all other commands as options to sysrepocfg."
echo
exit 0
}
cmd=$1; shift
case $cmd in
edit)
edit "$1"
;;
help)
usage
;;
*)
set -- "$cmd" "$@"
exec sysrepocfg -f json "$@"
;;
esac
-1
View File
@@ -1 +0,0 @@
less
+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
# -d ;; suppress error message "the terminal is dumb"
# -F :: exit if the entire file can be displayed on the first screen
# -I :: Ignore case, even for patterns
# -K :: exit immediately when an interrupt character (usually ^C) is typed
# -R :: Almost raw control charachters, only ANSI color escape sequences and
# OSC 8 hyperlink sequences are output. Allows veritcal scrolling
# -X :: No termcap initialization and deinitialization set to the terminal.
# This is what leaves the contents of the output on screen.
export LESS="-P %f (press h for help or q to quit)"
export LANG=en_US.UTF-8
less -RIKd -FX "$@"
@@ -0,0 +1,9 @@
# Extend finit's default udevadm settle synchronization for situations
# where device are very slow to probe (see #685)
run nowarn if:udevd cgroup.init <service/udevd/ready> log \
[S] /usr/libexec/infix/hw-wait -- Probing hardware
# Now that everything should be probed, do a final pass over the
# uevent queue before starting syslogd and everything else
run nowarn if:udevd cgroup.init :post <service/udevd/ready> log \
[S] udevadm settle -t 30 --
@@ -0,0 +1,6 @@
d /run/containers/args 0700 - -
d /run/containers/files 0700 - -
d /var/lib/containers 0700 - -
d /var/lib/containers/oci 0700 - -
d /run/cni 0755 - -
L+ /var/lib/cni - - - - /run/cni
@@ -1 +1,2 @@
d /var/run/frr 0755 frr frr -
R /var/tmp/frr - - - -
+41
View File
@@ -0,0 +1,41 @@
#!/bin/sh
# (Ab)use the kernel's device link subsystem to detect consumer side
# devices that may be very slow to probe (looking at you, mv88e6xxx!).
ident=$(basename "$0")
report()
{
if [ -r "/tmp/$ident" ]; then
logger -k -p "user.$1" -t "$ident" "Waited for slow devices:"
sort "/tmp/$ident" | uniq -c | logger -k -p "user.$1" -t "$ident"
fi
rm -f "/tmp/$ident"
}
for _ in $(seq 50); do
again=
for dl in /sys/class/devlink/*; do
[ -r "$dl/status" ] || continue
status=$(cat "$dl/status")
if [ "$status" = "consumer probing" ]; then
basename "$(readlink "$dl/consumer")" >>"/tmp/$ident"
again=yes
fi
done
if [ -z "$again" ]; then
report notice
exit 0
fi
sleep .2
done
logger -k -p user.error -t "$ident" "Timeout waiting for devices to come online"
report error
exit 1
@@ -8,10 +8,11 @@ import struct
import subprocess
import sys
onieprom = importlib.machinery.SourceFileLoader("onieprom","/bin/onieprom").load_module()
SYSTEM_JSON = "/run/system.json"
onieprom = importlib.machinery.SourceFileLoader("onieprom", "/bin/onieprom").load_module()
SYSTEM_JSON = "/run/system.json"
KKIT_IANA_PEM = 61046
class DTSystem:
BASE = "/sys/firmware/devicetree/base"
INFIX = BASE + "/chosen/infix"
@@ -28,7 +29,9 @@ class DTSystem:
if not os.path.exists(phandle):
continue
ph, = struct.unpack(">L", open(phandle, "rb").read())
with open(phandle, "rb") as f:
data = f.read()
ph, = struct.unpack(">L", data)
dt[ph] = root
sys = {}
@@ -40,14 +43,18 @@ class DTSystem:
if not os.path.exists(phandle):
continue
ph, = struct.unpack(">L", open(phandle, "rb").read())
with open(phandle, "rb") as f:
data = f.read()
ph, = struct.unpack(">L", data)
if ph not in sys:
sys[ph] = []
sys[ph].append(root)
phs = set(list(dt.keys()) + list(sys.keys()))
self.devs = { ph: [Device(ph, dt.get(ph), s if s is not None else "") for s in (sys.get(ph) or []) if ph is not None] for ph in phs }
self.devs = {ph: [Device(ph, dt.get(ph), s if s is not None else "")
for s in (sys.get(ph) or []) if ph is not None]
for ph in phs}
self.base = Device(0, None, DTSystem.BASE)
self.infix = Device(0, None, DTSystem.INFIX)
@@ -56,7 +63,8 @@ class DTSystem:
if not os.path.exists(path):
return ()
data = open(path, "rb").read()
with open(path, "rb") as f:
data = f.read()
elems = len(data) // struct.calcsize(">L")
return struct.unpack(">" + elems * "L", data)
@@ -69,7 +77,8 @@ class DTSystem:
return {}
try:
data = onieprom.from_tlv(open(dev.attrpath("nvmem"), "rb", 0))
with open(dev.attrpath("nvmem"), "rb", 0) as f:
data = onieprom.from_tlv(f)
except:
data = {}
@@ -84,14 +93,18 @@ class DTSystem:
}
def infix_usb_devices(self, out):
names=self.infix.str_array("usb-port-names", ())
phs=self.__get_phandle_array("usb-ports")
data=dict(zip(names,phs))
names = self.infix.str_array("usb-port-names", ())
phs = self.__get_phandle_array("usb-ports")
data = dict(zip(names, phs))
if data != {}:
out["usb-ports"] = []
for name,ph in data.items():
[out["usb-ports"].extend([{"name": name, "path": dev.attrpath("authorized")}, {"name": name, "path": dev.attrpath("authorized_default")}]) for dev in self.devices_from_ph(ph)]
for name, ph in data.items():
[out["usb-ports"].extend([{
"name": name,
"path": dev.attrpath("authorized")}, {
"name": name,
"path": dev.attrpath("authorized_default")
}]) for dev in self.devices_from_ph(ph)]
def infix_devices(self, kind):
phs = self.__get_phandle_array(kind)
@@ -101,6 +114,7 @@ class DTSystem:
flat_devices = [device for sublist in self.infix_devices("vpds") for device in sublist]
return [self.into_vpd(device) for device in flat_devices]
class QEMUSystem:
BASE = "/sys/firmware/qemu_fw_cfg"
REV = BASE + "/rev"
@@ -110,7 +124,8 @@ class QEMUSystem:
data = {}
if os.path.exists(QEMUSystem.VPD):
try:
data = onieprom.from_tlv(open(QEMUSystem.VPD, "rb", 0))
with open(QEMUSystem.VPD, "rb", 0) as f:
data = onieprom.from_tlv(f)
except:
pass
@@ -127,31 +142,27 @@ class QEMUSystem:
def usb_ports(self):
ports = [
{
"name": "USB",
"path": "/sys/bus/usb/devices/usb1/authorized"
},
{
"name": "USB",
"path": "/sys/bus/usb/devices/usb1/authorized_default"
},
{
"name": "USB2",
"path": "/sys/bus/usb/devices/usb2/authorized"
},
{
"name": "USB2",
"path": "/sys/bus/usb/devices/usb2/authorized_default"
}]
"name": "USB",
"path": "/sys/bus/usb/devices/usb1/authorized"
}, {
"name": "USB",
"path": "/sys/bus/usb/devices/usb1/authorized_default"
}, {
"name": "USB2",
"path": "/sys/bus/usb/devices/usb2/authorized"
}, {
"name": "USB2",
"path": "/sys/bus/usb/devices/usb2/authorized_default"
}]
return ports
class Device:
def __init__(self, ph, dtpath, syspath):
self.ph, self.dtpath, self.syspath = ph, dtpath, syspath
def available(self):
return self.syspath != None
return self.syspath is not None
def __getitem__(self, attr):
return self.attr(attr).decode("utf-8").strip("\0")
@@ -159,7 +170,6 @@ class Device:
def __setitem__(self, attr, value):
return self.attr(attr, val=value.encode("utf-8"))
def attrpath(self, attr):
return os.path.join(self.syspath, attr)
@@ -168,13 +178,16 @@ class Device:
def attr(self, attr, default=None, val=None):
if not self.hasattr(attr):
return default if val == None else False
return default if val is None else False
if val:
open(self.attrpath(attr), "wb").write(value)
with open(self.attrpath(attr), "wb") as f:
f.write(val)
return True
return open(self.attrpath(attr), "rb").read()
with open(self.attrpath(attr), "rb") as f:
data = f.read()
return data
def str(self, attr, default=None):
val = self.attr(attr)
@@ -194,7 +207,9 @@ class Device:
if not self.hasdtattr(attr):
return default
return open(self.dtattrpath(attr), "rb").read()
with open(self.dtattrpath(attr), "rb") as f:
data = f.read()
return data
def dtstr(self, attr, default=None):
val = self.dtattr(attr)
@@ -212,6 +227,7 @@ def vpd_get_json_ve(vpd, pem):
return out
def vpd_get_pwhash(vpd):
if not vpd.get("trusted"):
return None
@@ -219,8 +235,9 @@ def vpd_get_pwhash(vpd):
kkit = vpd_get_json_ve(vpd, KKIT_IANA_PEM)
return kkit.get("pwhash")
def vpd_inject(out, vpds):
out["vpd"] = { vpd["board"]: vpd for vpd in vpds }
out["vpd"] = {vpd["board"]: vpd for vpd in vpds}
product = out["vpd"].get("product", {}).get("data", {})
hoistattrs = ("vendor", "product-name", "part-number", "serial-number", "mac-address")
@@ -234,6 +251,7 @@ 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'
@@ -244,7 +262,8 @@ def qemu_base_mac():
continue
try:
# pylint: disable=invalid-name
with open(os.path.join(base_path, iface, 'address'), 'r', encoding='ascii') as f:
fn = os.path.join(base_path, iface, 'address')
with open(fn, 'r', encoding='ascii') as f:
mac = f.read().strip()
interfaces.append((mac, iface))
except FileNotFoundError:
@@ -261,6 +280,7 @@ def qemu_base_mac():
return None
def probe_qemusystem(out):
"""Probe Qemu based test systems and 'make run'"""
admin_hash = "$5$mI/zpOAqZYKLC2WU$i7iPzZiIjOjrBF3NyftS9CCq8dfYwHwrmUK097Jca9A"
@@ -288,6 +308,7 @@ def probe_qemusystem(out):
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()
@@ -297,6 +318,8 @@ def probe_dtsystem(out):
if model:
out["product-name"] = model
out["compatible"] = dtsys.base.str_array("compatible")
staticpw = dtsys.infix.str("factory-password-hash")
if not out["factory-password-hash"]:
out["factory-password-hash"] = staticpw
@@ -304,6 +327,7 @@ def probe_dtsystem(out):
vpd_inject(out, vpds)
return 0
def main():
out = {
"vendor": None,
@@ -338,5 +362,6 @@ def main():
shutil.chown(SYSTEM_JSON, user="root", group="wheel")
return err
if __name__ == "__main__":
sys.exit(main())
@@ -1,22 +1,48 @@
#!/bin/sh
# Find and install any product specific files in /etc before bootstrap
# Find, install, and run product specific files and script in /etc
# before resuming bootstrap.
#
# Use /etc/product/init.d/S01-myscript for scripts, may be a symlink, it
# will be called with `start` as its only argument.
#
# The compatible array is listed in the same order as the device tree,
# most significant to least. Hence the reverse.[], to ensure overrides
# are applied in order of significance.
ident=$(basename "$0")
PRODUCT_INIT=/etc/product/init.d
PREFIXD=/usr/share/product
PRODUCT=$(jq -r '."product-name" | ascii_downcase' /run/system.json)
COMPATIBLES=$(jq -r '.compatible | reverse.[] | 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
found=false
for PRODUCT in $COMPATIBLES; do
DIR="$PREFIXD/$PRODUCT"
if [ -d "$DIR" ]; then
note "Using vendor/product-specific defaults for $PRODUCT."
for dir in "$DIR"/*; do
[ -d "$dir" ] && cp -a "$dir" /
done
found=true
fi
done
if [ "$found" = false ]; then
note "No vendor/product-specific directory found, using built-in defaults."
fi
note "Using vendor/product specific defaults."
for dir in "$DIR"/*; do
[ -d "$dir" ] && cp -a "$dir" /
done
# Conditions for bootstrap services, this enables product specific
# init scripts to prevent select services from starting.
initctl -nbq cond set led
note "Calling runparts $PRODUCT_INIT/S[0-9]+.* start"
/usr/libexec/finit/runparts -bsp "$PRODUCT_INIT"
# Product specific init done.
initctl -nbq cond set product
exit 0
@@ -46,7 +46,11 @@ while [ "$1" ]; do
[ $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
output=$(tc qdisc add dev $iface root mqprio hw 1 \
num_tc $txqs $(map $txqs) $(queues $txqs) 2>&1) || true
if echo "$output" | grep -q "does not support hardware offload"; then
echo "Skipping $iface, hardware offload not supported."
elif [ -n "$output" ]; then
echo "$output"
fi
done
@@ -1,2 +1,2 @@
#!/bin/sh
exec initctl -bq cond set ixinit-done
exec initctl -bq cond set ixinit
+1 -6
View File
@@ -45,11 +45,6 @@ factory_reset()
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."
@@ -146,7 +141,7 @@ mount_overlay home "$cfgsrc" /home
mount_overlay root "$cfgsrc" /root
mount_bind "$varsrc" /var
[ "$vlibsrc" ] && mount_bind "$vlibsrc" /var/lib
[ -n "$vlibsrc" ] && mount_bind "$vlibsrc" /var/lib
for tag in $(ls /sys/bus/virtio/devices/*/mount_tag 2>/dev/null); do
if [ "$(cat $tag | tr -d '\0')" = hostfs ]; then
+224 -59
View File
@@ -1,5 +1,18 @@
#!/bin/sh
# This script can be used to start, stop, create, and delete containers.
# It is what confd use, with the Finit container@.conf template, to set
# up, run, and delete containers.
#
# NOTE: when creating/deleting containers, remember 'initctl reload' to
# activate the changes! In confd this is already handled.
#
DOWNLOADS=/var/lib/containers/oci
BUILTIN=/lib/oci
TMPDIR=/var/tmp
checksum=""
extracted=
timeout=30
dir=""
all=""
env=""
port=""
@@ -10,6 +23,87 @@ log()
logger -I $PPID -t container -p local1.notice -- "$*"
}
err()
{
rc=$1; shift
logger -I $PPID -t container -p local1.err -- "Error: $*"
if [ -n "$extracted" ]; then
if [ -d "$TMPDIR/$dir" ]; then
log "Cleaning up extracted $dir"
rm -rf "$dir"
fi
fi
[ "$rc" -eq 0 ] || exit "$rc"
}
check()
{
file=$1
if [ -z "$checksum" ]; then
log "no checksum to verify $file against, continuing."
return 0
fi
if echo "${checksum} ${file}" | "$cmdsum" -c -s; then
log "$file checksum verified OK."
return 0
fi
got=$("$cmdsum" "${file}" | awk '{print $1}')
log "$file checksum mismatch, got $got, expected $checksum, removing file."
rm -f "$file"
return 1
}
# Fetch an OCI image over ftp/http/https. Use wget for FTP, which curl
# empirically does not work well with. Log progress+ & error to syslog.
fetch()
{
url=$1
file=$(basename "$url")
dst="$DOWNLOADS/$file"
cd "$DOWNLOADS" || return
if [ -e "$file" ]; then
log "$file already available."
if check "$file"; then
echo "$dst"
return 0
fi
fi
log "Fetching $url"
if echo "$url" | grep -qE "^ftp://"; then
cmd="wget -q $url"
elif echo "$url" | grep -qE "^https?://"; then
cmd="curl $creds -sSL --fail -o \"$file\" $url"
else
log "Unsupported URL scheme: $url"
return 1
fi
if out=$(eval "$cmd" 2>&1); then
log "$file downloaded successfully."
if check "$file"; then
echo "$dst"
return 0
fi
fi
# log error message from backend
while IFS= read -r line; do
log "$line"
done <<EOF
$out
EOF
return 1
}
# Unpacks a given oci-archive.tar[.gz] in the current directory. Sanity
# checks, at least one index.json in the top-level dir of the archive.
# If there are more index files, this function does not handle them.
@@ -26,45 +120,74 @@ unpack_archive()
oci-archive:*) # Packed OCI image, .tar or .tar.gz format
file=${image#oci-archive:}
;;
ftp://* | http://* | https://*)
if ! file=$(fetch "$image"); then
return 1
fi
;;
*) # docker://*, docker-archive:*, or URL
echo "$image"
if podman image exists "$image"; then
echo "$image"
return 0
fi
# XXX: use --retry=0 with Podman 5.0 or later.
if ! id=$(podman pull --quiet "$image"); then
log "Failed pulling $image"
return 1
fi
# Echo image name to caller
podman images --filter id="$id" --format "{{.Repository}}:{{.Tag}}"
return 0
;;
esac
if [ ! -e "$file" ]; then
if [ -e "/var/lib/containers/oci/$file" ]; then
file="/var/lib/containers/oci/$file"
elif [ -e "/lib/oci/$file" ]; then
file="/lib/oci/$file"
if [ -e "$DOWNLOADS/$file" ]; then
file="$DOWNLOADS/$file"
elif [ -e "$BUILTIN/$file" ]; then
file="$BUILTIN/$file"
else
log "Error: cannot find OCI archive $file in search path."
exit 1
err 1 "cannot find OCI archive $file in search path."
fi
fi
if [ -d "$file" ]; then
index=$(find "$file" -name index.json)
if [ -z "$index" ]; then
log "Error: cannot find index.json in OCI image $file"
exit 1
err 1 "cannot find index.json in OCI image $file"
fi
else
cd "$TMPDIR" || err 0 "failed cd $TMPDIR, wiill use $(pwd) for OCI archive extraction."
index=$(tar tf "$file" |grep index.json)
if [ -z "$index" ]; then
log "Error: invalid OCI archive, cannot find index.json in $file"
exit 1
err 1 "invalid OCI archive, cannot find index.json in $file"
fi
[ -n "$quiet" ] || log "Extracting OCI archive $file ..."
tar xf "$file" || (log "Error: failed unpacking $file in $(pwd)"; exit 1)
remove=true
tar xf "$file" || err 1 "failed unpacking $file in $(pwd)"
extracted=true
fi
dir=$(dirname "$index")
if echo "$dir" | grep -q ":"; then
if [ -z "$name" ]; then
name="$dir"
fi
sanitized_dir=$(echo "$dir" | cut -d':' -f1)
mv "$dir" "$sanitized_dir" || err 1 "failed renaming $dir to $sanitized_dir"
dir="$sanitized_dir"
fi
[ -n "$quiet" ] || log "Loading OCI image $dir ..."
podman load -qi "$dir" >/dev/null
# Clean up after ourselves
if [ -n "$extracted" ]; then
log "Cleaning up extracted $dir"
rm -rf "$dir"
fi
# Rename image from podman default $dir:latest
if [ -n "$name" ]; then
podman tag "$dir" "$name" >/dev/null
@@ -73,10 +196,6 @@ unpack_archive()
name=$dir
fi
if [ "$remove" = "true" ]; then
rm -rf "$file"
fi
echo "$name"
}
@@ -102,15 +221,18 @@ create()
# Unpack and load docker-archive/oci/oci-archive, returning image
# name, or return docker:// URL for download.
image=$(unpack_archive "$image")
if [ -z "$logging" ]; then
logging="--log-driver k8s-file --log-opt path=/run/containers/$name.fifo"
if ! image=$(unpack_archive "$image"); then
exit 1
fi
args="$args --replace --quiet --cgroup-parent=containers $caps"
if [ -z "$logging" ]; then
logging="--log-driver none"
fi
# When we get here we've already fetched, or pulled, the image
args="$args --read-only --replace --quiet --cgroup-parent=containers $caps"
args="$args --restart=$restart --systemd=false --tz=local $privileged"
args="$args $ro $vol $mount $hostname $entrypoint $env $port $logging"
args="$args $vol $mount $hostname $entrypoint $env $port $logging"
pidfn=/run/container:${name}.pid
[ -n "$quiet" ] || log "---------------------------------------"
@@ -134,16 +256,17 @@ create()
fi
# shellcheck disable=SC2048
log "Calling podman create --name $name --conmon-pidfile=$pidfn $args $image $*"
log "podman create --name $name --conmon-pidfile=$pidfn $args $image $*"
if podman create --name "$name" --conmon-pidfile="$pidfn" $args "$image" $*; then
[ -n "$quiet" ] || log "Successfully created container $name from $image"
rm -f "/run/containers/env/${name}.env"
[ -n "$quiet" ] || log "Successfully created container $name from $image"
[ -n "$manual" ] || start "$name"
# Should already be enabled by confd (this is for manual use)
initctl -bnq enable "container@${name}.conf"
exit 0
fi
log "Error: failed creating container $name, please check the configuration."
exit 1
err 1 "failed creating container $name, please check the configuration."
}
delete()
@@ -157,18 +280,27 @@ delete()
exit 1
fi
# Should already be stopped, but if not ...
container stop "$name"
while running "$name"; do
_=$((timeout -= 1))
if [ $timeout -le 0 ]; then
err 1 "timed out waiting for container $1 to stop before deleting it."
fi
sleep 1
done
podman rm -vif "$name" >/dev/null 2>&1
[ -n "$quiet" ] || log "Container $name has been removed."
}
waitfor()
{
timeout=$2
while [ ! -f "$1" ]; do
_=$((timeout -= 1))
if [ $timeout -le 0 ]; then
log "Timeout waiting for $1, aborting!"
exit 1
err 1 "timed out waiting for $1, aborting!"
fi
sleep 1;
done
@@ -236,6 +368,12 @@ netrestart()
done
}
cleanup()
{
log "Received signal, exiting."
exit 1
}
usage()
{
cat <<EOF
@@ -248,6 +386,7 @@ options:
--dns-search LIST Set host lookup search list when creating container
--cap-add CAP Add capability to unprivileged container
--cap-drop CAP Drop capability, for privileged containter
--checksum TYPE:SUM Use md5/sha256/sha512 to verify ftp/http/https archives
-c, --creds USR[:PWD] Credentials to pass to curl -u for remote ops
-d, --detach Detach a container started with 'run IMG [CMD]'
-e, --env FILE Environment variables when creating container
@@ -267,14 +406,15 @@ options:
Syntax: [[ip:][hostPort]:]containerPort[/protocol]
-q, --quiet Quiet operation, called from confd
-r, --restart POLICY One of "no", "always", or "on-failure:NUM"
--read-only Do not create a writable layer
-s, --simple Show output in simplified format
-t, --timeout SEC Set timeout for delete/restart commands, default: 20
-v, --volume NAME:PATH Create named volume mounted inside container on PATH
commands:
create NAME IMAGE NET Create container NAME using IMAGE with networks NET
delete [network] NAME Remove container NAME or network NAME from all containers
exec NAME CMD Run a command inside a container
flush Clean up lingering containers and associated anonymous volumes
find [ifname PID] Find PID of container where '--net IFNAME' currently lives
or, find the name of our IFNAME inside the container @PID
help Show this help text
@@ -285,6 +425,7 @@ commands:
restart [network] NAME Restart a (crashed) container or container(s) using network
run NAME [CMD] Run a container interactively, with an optional command
save IMAGE FILE Save a container image to an OCI tarball FILE[.tar.gz]
setup NAME Create and set up container as a Finit task
shell Start a shell inside a container
show [image | volume] Show containers, images, or volumes
stat Show continuous stats about containers (Ctrl-C aborts)
@@ -307,6 +448,25 @@ while [ "$1" != "" ]; do
shift
caps="$caps --cap-drop=$1"
;;
--checksum)
shift
type="${1%%:*}"
checksum="${1#*:}"
case "$type" in
md5)
cmdsum=md5sum
;;
sha256)
cmdsum=sha256sum
;;
sha512)
cmdsum=sha512sum
;;
*)
err 1 "Unsupported checksum type: $type"
;;
esac
;;
-c | --creds)
shift
creds="-u $1"
@@ -351,7 +511,6 @@ while [ "$1" != "" ]; do
--log-path)
shift
logging="$logging --log-opt path=$1"
log_path="$1"
;;
-m | --mount)
shift
@@ -386,12 +545,13 @@ while [ "$1" != "" ]; do
shift
restart=$1
;;
--read-only)
ro="--read-only=true"
;;
-s | --simple)
simple=true
;;
-t | --timeout)
shift
timeout=$1
;;
-v | --volume)
shift
vol="$vol -v $1"
@@ -408,6 +568,8 @@ if [ -n "$cmd" ]; then
shift
fi
trap cleanup INT TERM
case $cmd in
# Does not work atm., cannot attach to TTY because
# we monitor 'podman start -ai foo' with Finit.
@@ -430,6 +592,10 @@ case $cmd in
exec)
podman exec -it "$@"
;;
flush)
echo "Cleaning up any lingering containers";
podman rm -av
;;
find)
cmd=$1
pid=$2
@@ -455,25 +621,12 @@ case $cmd in
usage
;;
load)
url=$1
name=$2
# shellcheck disable=SC2086
if echo "$url" | grep -q "://"; then
file=$(basename "$url")
curl -k $creds -Lo "$file" "$url"
else
file="$url"
fi
# shellcheck disable=SC2086
name=$(unpack_archive "$file" $name)
name=$(unpack_archive "$1" $2)
[ -n "$name" ] || exit 1
# Show resulting image(s) matching $name
if [ -n "$name" ]; then
podman images -n "$name"
else
exit 1
fi
podman images -n "$name"
;;
locate) # Find where the host's ifname lives
if [ -z "$network" ]; then
@@ -500,7 +653,7 @@ case $cmd in
podman images $all --format "{{.Repository}}:{{.Tag}}"
;;
oci)
find /lib/oci /var/lib/containers/oci -type f 2>/dev/null
find $BUILTIN $DOWNLOADS -type f 2>/dev/null
;;
*)
podman ps $all --format "{{.Names}}"
@@ -542,6 +695,20 @@ case $cmd in
gzip "$file"
fi
;;
setup)
[ -n "$name" ] || err 1 "setup: missing container name."
script=/run/containers/${name}.sh
[ -x "$script" ] || err 1 "setup: $script does not exist or is not executable."
while ! "$script"; do
# Wait for address/route changes, or retry every 60 secods
# shellcheck disable=2162,3045
ip monitor address route | while read -t 60 _; do break; done
# On IP address/route changes, wait a few seconds more to ensure
# the system has ample time to react and set things up for us.
sleep 2
done
;;
shell)
podman exec -it "$1" sh -l
;;
@@ -596,12 +763,10 @@ case $cmd in
else
name=$1
stop "$name"
timeout=20
while running "$name"; do
_=$((timeout -= 1))
if [ $timeout -le 0 ]; then
log "Timeout waiting for container $1 to stop before restarting it."
exit 1
err 1 "timed out waiting for container $1 to stop before restarting it."
fi
sleep 1
done
@@ -627,7 +792,7 @@ case $cmd in
;;
upgrade)
# Start script used to initially create container
script=/var/lib/containers/active/S01-${1}.sh
script=/run/containers/${1}.sh
# Find container image
img=$(podman inspect "$1" | jq -r .[].ImageName)
@@ -658,7 +823,7 @@ case $cmd in
[ -n "$cmd" ] && shift
case $cmd in
prune)
podman volume $force prune
podman volume prune $force
;;
*)
false
@@ -50,7 +50,7 @@ set_dhcp_routes()
# format: dest1/mask gw1 ... destn/mask gwn
set -- $staticroutes
while [ -n "$1" -a -n "$2" ]; do
log "adding route $1 via $2 dev $interface proto dhcp"
log "adding route $1 via $2 metric $metric tag 100"
echo "ip route $1 $2 $metric tag 100" >> "$NEXT"
shift 2
done
@@ -115,7 +115,7 @@ case "$ACTION" in
/usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface
fi
if /bin/ip addr add dev $interface $ip/$subnet $BROADCAST proto 5; then
if /bin/ip addr add dev $interface $ip/$subnet $BROADCAST proto dhcp; then
echo "$ip" > "$IP_CACHE"
fi
if [ -n "$ipv6" ] ; then
+7 -1
View File
@@ -33,6 +33,7 @@ CONFIG_KALLSYMS_ALL=y
CONFIG_PROFILING=y
CONFIG_SMP=y
CONFIG_EFI=y
CONFIG_KPROBES=y
# CONFIG_GCC_PLUGINS is not set
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
@@ -161,12 +162,14 @@ CONFIG_MPLS=y
CONFIG_NET_MPLS_GSO=y
CONFIG_MPLS_ROUTING=m
CONFIG_MPLS_IPTUNNEL=m
CONFIG_NET_SWITCHDEV=y
CONFIG_NET_PKTGEN=y
# CONFIG_WIRELESS is not set
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_LWTUNNEL=y
CONFIG_PCI=y
CONFIG_PCI_MSI=y
CONFIG_UEVENT_HELPER=y
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
CONFIG_DEVTMPFS=y
@@ -208,6 +211,7 @@ CONFIG_NET_VRF=y
CONFIG_E1000=y
CONFIG_NE2K_PCI=y
CONFIG_8139CP=y
CONFIG_ROCKER=y
# CONFIG_WLAN is not set
CONFIG_INPUT_EVDEV=y
CONFIG_SERIAL_8250=y
@@ -260,7 +264,9 @@ CONFIG_CRYPTO_GCM=y
CONFIG_DEBUG_KERNEL=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_FS=y
CONFIG_PANIC_ON_OOPS=y
CONFIG_PANIC_TIMEOUT=20
CONFIG_DETECT_HUNG_TASK=y
CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y
# CONFIG_FTRACE is not set
CONFIG_FUNCTION_TRACER=y
CONFIG_UNWINDER_FRAME_POINTER=y
+2 -2
View File
@@ -134,7 +134,6 @@ BR2_PACKAGE_CONFD=y
BR2_PACKAGE_CONFD_TEST_MODE=y
BR2_PACKAGE_CURIOS_HTTPD=y
BR2_PACKAGE_CURIOS_NFTABLES=y
BR2_PACKAGE_EXECD=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
BR2_PACKAGE_FACTORY=y
@@ -142,10 +141,11 @@ BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y
BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS=y
BR2_PACKAGE_FINIT_PLUGIN_MODULES_LOAD=y
BR2_PACKAGE_FINIT_PLUGIN_RTC=y
BR2_PACKAGE_FINIT_RTC_DATE="2024-11-04 10:54:00"
BR2_PACKAGE_FINIT_RTC_FILE="/var/lib/misc/rtc"
BR2_PACKAGE_FINIT_PLUGIN_TTY=y
BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y
BR2_PACKAGE_IITO=y
BR2_PACKAGE_K8S_LOGGER=y
BR2_PACKAGE_KEYACK=y
BR2_PACKAGE_KLISH_PLUGIN_INFIX=y
BR2_PACKAGE_LANDING=y
+2
View File
@@ -122,6 +122,8 @@ BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y
BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS=y
BR2_PACKAGE_FINIT_PLUGIN_MODULES_LOAD=y
BR2_PACKAGE_FINIT_PLUGIN_RTC=y
BR2_PACKAGE_FINIT_RTC_DATE="2024-11-04 10:54:00"
BR2_PACKAGE_FINIT_RTC_FILE="/var/lib/misc/rtc"
BR2_PACKAGE_FINIT_PLUGIN_TTY=y
BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y
BR2_PACKAGE_IITO=y
+5 -4
View File
@@ -14,8 +14,8 @@ BR2_TARGET_GENERIC_ISSUE="Infix by KernelKit"
BR2_INIT_FINIT=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_ROOTFS_DEVICE_TABLE="system/device_table.txt ${BR2_EXTERNAL_INFIX_PATH}/board/common/xattrs"
# BR2_TARGET_ENABLE_ROOT_LOGIN is not set
BR2_ROOTFS_MERGED_USR=y
# BR2_TARGET_ENABLE_ROOT_LOGIN is not set
BR2_SYSTEM_BIN_SH_BASH=y
BR2_TARGET_GENERIC_GETTY_PORT="@console"
BR2_TARGET_GENERIC_GETTY_TERM="xterm"
@@ -71,7 +71,9 @@ BR2_PACKAGE_UBOOT_TOOLS_FIT_CHECK_SIGN=y
BR2_PACKAGE_UBOOT_TOOLS_MKENVIMAGE=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_GUNICORN=y
BR2_PACKAGE_LIBSSH_OPENSSL=y
BR2_PACKAGE_LIBSSH2=y
BR2_PACKAGE_LIBSSH2_OPENSSL=y
BR2_PACKAGE_LIBXCRYPT=y
BR2_PACKAGE_LIBOPENSSL_BIN=y
BR2_PACKAGE_LIBINPUT=y
@@ -173,8 +175,6 @@ INFIX_HOME="https://github.com/kernelkit/infix/"
INFIX_DOC="https://github.com/kernelkit/infix/tree/main/doc"
INFIX_SUPPORT="mailto:kernelkit@googlegroups.com"
BR2_PACKAGE_CONFD=y
# BR2_PACKAGE_CONFD_TEST_MODE is not set
BR2_PACKAGE_EXECD=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
BR2_PACKAGE_FACTORY=y
@@ -182,10 +182,11 @@ BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y
BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS=y
BR2_PACKAGE_FINIT_PLUGIN_MODULES_LOAD=y
BR2_PACKAGE_FINIT_PLUGIN_RTC=y
BR2_PACKAGE_FINIT_RTC_DATE="2024-11-04 10:54:00"
BR2_PACKAGE_FINIT_RTC_FILE="/var/lib/misc/rtc"
BR2_PACKAGE_FINIT_PLUGIN_TTY=y
BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y
BR2_PACKAGE_IITO=y
BR2_PACKAGE_K8S_LOGGER=y
BR2_PACKAGE_KEYACK=y
BR2_PACKAGE_KLISH_PLUGIN_INFIX=y
BR2_PACKAGE_LANDING=y
+2 -2
View File
@@ -165,7 +165,6 @@ INFIX_DOC="https://github.com/kernelkit/infix/tree/main/doc"
INFIX_SUPPORT="mailto:kernelkit@googlegroups.com"
BR2_PACKAGE_CONFD=y
# BR2_PACKAGE_CONFD_TEST_MODE is not set
BR2_PACKAGE_EXECD=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
BR2_PACKAGE_FACTORY=y
@@ -173,10 +172,11 @@ BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y
BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS=y
BR2_PACKAGE_FINIT_PLUGIN_MODULES_LOAD=y
BR2_PACKAGE_FINIT_PLUGIN_RTC=y
BR2_PACKAGE_FINIT_RTC_DATE="2024-11-04 10:54:00"
BR2_PACKAGE_FINIT_RTC_FILE="/var/lib/misc/rtc"
BR2_PACKAGE_FINIT_PLUGIN_TTY=y
BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y
BR2_PACKAGE_IITO=y
BR2_PACKAGE_K8S_LOGGER=y
BR2_PACKAGE_KEYACK=y
BR2_PACKAGE_KLISH_PLUGIN_INFIX=y
BR2_PACKAGE_LANDING=y
+2 -2
View File
@@ -138,7 +138,6 @@ BR2_PACKAGE_CONFD=y
BR2_PACKAGE_CONFD_TEST_MODE=y
BR2_PACKAGE_CURIOS_HTTPD=y
BR2_PACKAGE_CURIOS_NFTABLES=y
BR2_PACKAGE_EXECD=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
BR2_PACKAGE_FACTORY=y
@@ -146,10 +145,11 @@ BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y
BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS=y
BR2_PACKAGE_FINIT_PLUGIN_MODULES_LOAD=y
BR2_PACKAGE_FINIT_PLUGIN_RTC=y
BR2_PACKAGE_FINIT_RTC_DATE="2024-11-04 10:54:00"
BR2_PACKAGE_FINIT_RTC_FILE="/var/lib/misc/rtc"
BR2_PACKAGE_FINIT_PLUGIN_TTY=y
BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y
BR2_PACKAGE_IITO=y
BR2_PACKAGE_K8S_LOGGER=y
BR2_PACKAGE_KEYACK=y
BR2_PACKAGE_KLISH_PLUGIN_INFIX=y
BR2_PACKAGE_LANDING=y
+2
View File
@@ -126,6 +126,8 @@ BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y
BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS=y
BR2_PACKAGE_FINIT_PLUGIN_MODULES_LOAD=y
BR2_PACKAGE_FINIT_PLUGIN_RTC=y
BR2_PACKAGE_FINIT_RTC_DATE="2024-11-04 10:54:00"
BR2_PACKAGE_FINIT_RTC_FILE="/var/lib/misc/rtc"
BR2_PACKAGE_FINIT_PLUGIN_TTY=y
BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y
BR2_PACKAGE_IITO=y
+179 -1
View File
@@ -3,6 +3,164 @@ Change Log
All notable changes to the project are documented in this file.
[v24.11.1][] - 2024-11-29
-------------------------
### Changes
- Upgrade Frr to 9.1.2, fixes an OSPF issue where *Zebra* lost netlink
messages and drifted out of sync with the kernel's view of addresses
and interfaces available in the system
- Allow setting IP address directly on VLAN filtering bridges. This
only works when the bridge is an untagged member of a (single) VLAN.
- cli: usability -- showing log files now automatically jump to the end
of the file, where the latest events are
- cli: usability -- showing container status, or other status that
overflows the terminal horizontally, now wrap the lines and exit the
pager immediately if the contents fit on the first screen
- The default log level of the mDNS responder, `avahi-daemon`, has been
adjusted to make it less verbose. Now only `LOG_NOTICE` and higher
severity is logged -- making it very quiet
### Fixes
- Fix #685: DSA conduit interface not always detected. Previous
attempt at a fix (v24.10.2) mitigated the issue, but did not
completely solve it.
- Fix #835: redesign how the system creates/deletes containers from the
`running-config`. Prior to this change, all removal and creation was
handled by a separate queue that ran asynchronously from the `confd`
process. This could lead to situations where new configurations are
applied before the queue had been fully processed. After this change
containers are deleted synchronously and new containers are created
in the same flow as during normal runtime operation (start/upgrade)
- Fix start of containers with `manual=True` option should now work
again, regression in v24.11.0
- Fix loss of writable volumes when temporarily disabling a container
in the configuration, now the container remains dormant with all its
volumes still available
- Fix presentation bug in CLI `show interfaces` where all line-drawing
characters showed up as hexadecimal values. Regression in v24.11.0
- Fix missing log messages from Frr Zebra daemon
- Stop the zeroconf (IPv4LL) agent, `avahi-autoipd`, when removing an
interface, e.g., `br0`
- Creating more than one container trigger restarts of previously set
up containers. Which in some cases may cause these earlier ones to
end up in an inconsistent state
- Prevent traffic assigned to locally terminated VLANs from being
forwarded, when the underlying ports are simultaneously attached to
a VLAN filtering bridge.
[v24.11.0][] - 2024-11-20
-------------------------
> [!CAUTION]
> This release contains breaking changes for container users! As of
> v24.11.0, all persistent[^1] containers always run in `read-only` mode
> and the setting itself is deprecated (kept only for compatibility
> reasons). The main reason for this change is to better serve users
> with embedded container images in their builds of Infix. I.e., they
> can now upgrade the OCI image in their build and rely on the container
> being automatically upgraded when Infix is upgraded, issue #823. For
> other users, the benefit is that *all* container configuration changes
> take when activated, issue #822, without having to perform any tricks.
### Changes
- Add validation of interface name lengths, (1..15), Linux limit
- Add support for ftp/http/https URI:s in container image, with a new
`checksum` setting for MD5/SHA256/SHA512 verification, issue #801
- Add a retry timer to the background container create service. This
will ensure failing `docker pull` operations from remote images are
retrying after 60 seconds, or quicker
- CLI base component, `klish`, has been updated with better support for
raw terminal mode and alternate quotes (' in addition to ")
- Log silenced from container activation messages, only the very bare
necessities are now logged, e.g., `podman create` command + status
- Factory reset no longer calls `shred` to "securely erase" any files
from writable data partitions. This will speed up the next boot
considerably
### Fixes
- Fix #659: paged output in CLI accessed via console port sometimes
causes lost lines, e.g. missing interfaces. With updated `klish`
and the terminal in raw mode, the pager (less) can now control both
the horizontal and vertical
- Fix #822: adding, or changing, an environment variable to a running
container does not take without the `container upgrade NAME` trick
- Fix #823: with an OCI image embedded in the Infix image, an existing
container in the configuration is not upgraded to the new OCI image
with the Infix upgrade.
- Frr leaves log files in `/var/tmp/frr` on unclean shutdowns. This
has now been fixed with a "tmpfiles" cleanup of that path at boot
[^1]: I.e., set up in the configuration, as opposed to temporary ones
started with `container run` from the CLI admin-exec context.
[v24.10.2][] - 2024-11-08
-------------------------
### Changes
- Support for showing interfaces owned by running containers in the CLI
command `show interfaces`. This also adds support for showing the
peer interface of VETH pairs. Issue #626
- Reboot system on kernel "oops", on "oops" the kernel now panics and
reboots after 20 seconds. Issue #740
- Update static factory-config for NanoPi R2S: enable NACM, securing all
passwords, and enabling `iburst` for the NTP client. Issue #750
- Updated QoS documentation with pictures and more information on VLAN
interface ingress/egress priority handling, issue #759
- Disable RTC device in Styx device tree, issue #794
- Support for saving and restoring system clock from a disk file. This
allows restoring the system clock to a sane date in case the RTC is
disabled or does not have a valid time, issue #794
- Update device discovery chapter with information on `infix.local` mDNS
alias, `netbrowse` support to discover *all* local units, and command
examples for disabling LLDP and mDNS services, issue #786
- Updated OSPF documentation to include information on *global OSPF
settings* (`redistribution`, `explicit-router-id`, etc.), issue #812
- Added information on *forwarding of IEEE reserved group addresses*
to bridge section of networking documentation, issue #788
- Add support for bootstrap conditions and early init product overrides
- Styx: enable second Ethernet port LED in device tree, again, rename
it: yellow -> aux, and make sure it is turned off at boot
- Styx: disable second port LED for the 4xSFP slots, does not work
- Styx: override iitod (LED daemon) with a product specific LED script
### Fixes
- Fix #685: DSA conduit interface not always detected, randomly causing
major issues configuring systems with multiple switch cores
- Fix #778: reactivate OpenSSL backend for libssh/libssh2 for NanoPI R2S.
This fixes a regression in v24.10.0 causing loss of NETCONF support
- Fix #809: enable syslog logging for RAUC
- Fix harmless bootstrap log error message on systems without USB ports:
`jq: error (at <stdin>:0): Cannot iterate over null (null)`
- Change confusing `tc` log error message: `Error: does not support
hardware offload` to `Skipping $iface, hardware offload not supported.`
[v24.10.1][] - 2024-10-18
-------------------------
### Changes
- Add support for interface description, sometimes referred to as
"ifAlias". Saved as an Linux interface alias (not `altname`), e.g.,
`/sys/class/interfaces/veth0a/ifalias`, includes operational support
### Fixes
- Fix #735: `copy` and `erase` commands missing from CLI, regression
in Infix v24.10.0 defconfigs, now added as dep. in klish package
[v24.10.0][] - 2024-10-18
-------------------------
@@ -13,7 +171,9 @@ Also, heads-up to all downstream users of Infix. YANG models have been
renamed to ease maintenance, more info below.
### Changes
- Software control of port LEDs on the Styx platform has been disabled.
Default driver behavior, green link and green traffic blink, is kept
as-is, which should mitigate issues reported in #670
- Correcting documentation on QoS. For packets containing both a VLAN
@@ -49,6 +209,7 @@ renamed to ease maintenance, more info below.
see <https://kernelkit.org/posts/firewall-container/>
### Fixes
- Fix #499: add an NACM rule to factory-config, which by default deny
everyone to read user password hash(es)
- Fix #663: internal Ethernet interfaces shown in CLI tab completion
@@ -97,6 +258,7 @@ also been added to facilitate site specific adaptations. Please see the
documentation for details.
### Known Issues
- The CLI command `show interfaces` may for some terminal resolutions
not display all interfaces (on systems with >20 interfaces). This
problem is limited to the console port and only occurs for smaller
@@ -105,6 +267,7 @@ documentation for details.
using the CLI from an SSH session, is not affected. Issue #659
### Changes
- Upgrade Buildroot to 2024.02.6 (LTS)
- Upgrade Linux kernel to 6.6.52 (LTS)
- Upgrade libyang to 3.4.2
@@ -124,6 +287,7 @@ documentation for details.
by `mctl` reporting no multicast filtering enabled on bridge
### Fixes
- Fix #357: EUI-64 based IPv6 autoconf address on bridges seem to be
randomized. Problem caused by kernel setting a random MAC before any
bridge port is added. Fixed by using the device's base MAC address on
@@ -186,6 +350,7 @@ Finally, the following consumer boards are now fully supported:
- StarFive VisionFive2 (RISC-V)
### Changes
- Upgrade Buildroot to 2024.02.5 (LTS)
- Upgrade Linux kernel to 6.6.46 (LTS)
- Issue #158: enhance security of factory reset. All file content
@@ -237,6 +402,7 @@ Finally, the following consumer boards are now fully supported:
log messages. See `/var/log/debug` for *all* log messages
### Fixes
- Fix #274: add missing link/traffic LEDs on NanoPi R2S LAN port
- Fix #489: ensure all patches are versioned, including Linux kernel
- Fix #531: creating a new VLAN interface named `vlanN` should not set
@@ -266,6 +432,7 @@ Finally, the following consumer boards are now fully supported:
> upgrade, but before reboot, a factory reset is required!
### Changes
- Upgrade Buildroot to 2024.02.3 (LTS)
- Upgrade Linux kernel to 6.6.34 (LTS)
- Upgrade bundled curiOS httpd container to v24.05.0
@@ -332,6 +499,7 @@ Finally, the following consumer boards are now fully supported:
[yescrypt]: https://en.wikipedia.org/wiki/Yescrypt
### Fixes
- Fix #424: regression, root user can log in without password
- Fix build regressions in `cn9130_crb_boot_defconfig` caused by upgrade
to Buildroot v2024.02 and recent multi-key support in RAUC and U-Boot
@@ -363,11 +531,13 @@ Finally, the following consumer boards are now fully supported:
-------------------------
### Changes
- Add small delay in U-Boot to allow stopping boot on reference boards
- Document how to provision the bootloader and Infix on a blank board
- Use initial hostname from `/etc/os-release` as configuration fallback
### Fixes
- Fix build regressions in `cn9130_crb_boot_defconfig` caused by upgrade
to Buildroot v2024.02 and recent multi-key support in RAUC and U-Boot
- Fix provisioning script after changes to make GRUB loading more robust
@@ -382,6 +552,7 @@ Finally, the following consumer boards are now fully supported:
-------------------------
### Changes
- Default web landing page refactored into a Buildroot package to make
it possible to overload from customer repos.
- Enable DCB support in aarch64 kernel (for EtherType prio override)
@@ -392,6 +563,7 @@ Finally, the following consumer boards are now fully supported:
- Issue #374: add timestamps to dagger .log files
### Fixes
- Add missing LICENSE hash for factory reset tool
- Fix #424: regression, root user can log in without password
@@ -413,6 +585,7 @@ idea is to generate supported features from the models and include in
future releases.
### Changes
- Bump the base Buildroot version to v2024.02 LTS
- Bump the base Linux kernel version to 6.6 LTS
- Drop Classic variant to reduce overhead, simplify build & release
@@ -493,6 +666,7 @@ future releases.
named 'default'
### Fixes
- confd: Fix memory leak when operating on candidate configuration
- probe: Fix crash on systems without USB
- Reduced syslog errors for accesses no non-existing xpaths
@@ -1235,7 +1409,11 @@ Supported YANG models in addition to those used by sysrepo and netopeer:
- N/A
[buildroot]: https://buildroot.org/
[UNRELEASED]: https://github.com/kernelkit/infix/compare/v24.10.0...HEAD
[UNRELEASED]: https://github.com/kernelkit/infix/compare/v24.11.0...HEAD
[v24.11.1]: https://github.com/kernelkit/infix/compare/v24.11.0...v24.11.1
[v24.11.0]: https://github.com/kernelkit/infix/compare/v24.10.0...v24.11.0
[v24.10.2]: https://github.com/kernelkit/infix/compare/v24.10.1...v24.10.2
[v24.10.1]: https://github.com/kernelkit/infix/compare/v24.10.0...v24.10.1
[v24.10.0]: https://github.com/kernelkit/infix/compare/v24.09.0...v24.10.0
[v24.09.0]: https://github.com/kernelkit/infix/compare/v24.08.0...v24.09.0
[v24.08.0]: https://github.com/kernelkit/infix/compare/v24.06.0...v24.08.0
+3 -1
View File
@@ -143,7 +143,7 @@ which offers lots of benefits out-of-the-box:
media like USB sticks or SD-cards) and from remote servers using FTP
or HTTP(S).
To initiate a system upgrade, run:
To initiate a system upgrade from the shell[^1], run:
rauc install <file|url>
@@ -349,3 +349,5 @@ can funtion reasonably well without a persistent `/var`, loosing
If `var` is not available, Infix will still persist `/var/lib` using
`cfg` as the backing storage.
[^1]: See [CLI Upgrade](cli/upgrade.md) for information on upgrading
via CLI.
+225 -76
View File
@@ -20,6 +20,9 @@ Containers in Infix
* [Application Container: ntpd](#application-container-ntpd)
* [Advanced](#advanced)
* [Running Host Commands From Container](#running-host-commands-from-container)
* [Container Requirements](#container-requirements)
* [Advanced Users](#advanced-users)
Introduction
------------
@@ -36,10 +39,11 @@ All network specific settings are done using the IETF interfaces YANG
model, with augments for containers to ensure smooth integration with
container networking in podman.
> **Note:** even though the `podman` command can be used directly from a
> shell prompt, we strongly recommend using the CLI commands instead.
> They employ the services of a wrapper `container` script which handles
> the integration of containers in the system.
> [!IMPORTANT]
> Even though the `podman` command can be used directly from a shell
> prompt, we strongly recommend using the CLI commands instead. They
> employ the services of a wrapper `container` script which handles the
> integration of containers in the system.
Caution
@@ -83,26 +87,26 @@ The former is useful mostly for testing, or running single commands in
an image. It is a wrapper for `podman run -it --rm ...`, while the
latter is a wrapper and adaptation of `podman create ...`.
The second create a container with a semi-persistent writable layer that
survives container restarts and host system restarts. However, if you
change the container configuration or upgrade the image (see below), the
container will be recreated and the writable layer is lost. This is why
it is recommended to set up a named volume for directories, or use file
[Content Mounts](#content-mounts), in your container if you want truly
persistent content.
The second creates a read-only container that is automatically started
at every boot. When non-volatile storage is needed, data stored in a
volume is persisted until explicitly removed from the configuration,
i.e., across host and container reboots and upgrades.
In fact, in many cases the best way is to create a `read-only` container
and use file mounts and volumes only for the critical parts. Podman
ensures (using tmpfs) `read-only` containers still have writable
directories for certain critical file system paths: `/dev`, `/dev/shm`,
`/run`, `/tmp`, and `/var/tmp`. Meaning, what you most often need is
writable volumes for `/var/lib` and `/etc`, or only file mounts for a
few files in `/etc`. The actual needs depend on the container image and
application to run.
Another option is [Content Mounts](#content-mounts), where the content
of a file mounted into the container is kept along with the container
configuration in the device's `startup-config`.
> **Note:** when running containers from public registries, double-check
> that they support the CPU architecture of your host system. Remember,
> unlike virtualization, containers reuse the host's CPU and kernel.
Podman ensures (using tmpfs) all containers have writable directories
for certain critical file system paths: `/dev`, `/dev/shm`, `/run`,
`/tmp`, and `/var/tmp`. Meaning, what you most often need is writable
volumes for `/var/lib` and `/etc`, or only file mounts for a few files
in `/etc`. The [actual requirements](#container-requirements) depend on
your container image and application to run.
> [!IMPORTANT]
> When running containers from public registries, double-check that they
> support the CPU architecture of your host system. Remember, unlike
> virtualization, containers reuse the host's CPU and kernel.
<img align="right" src="img/docker-hello-world.svg" alt="Hello World" width=360>
@@ -168,13 +172,20 @@ The CLI help shows:
oci-archive:/lib/oci/archive -- Use archive:latest from OCI archive
May be in .tar or .tar.gz format
Additionally, the following URIs are also supported for setups
that do not use a HUB or similar. Recommend using 'checksum'!
ftp://addr/path/to/archive -- Downloaded using wget
http://addr/path/to/archive -- Downloaded using curl
https://addr/path/to/archive -- Downloaded using curl
Note: if a remote repository cannot be reached, the creation of the
container will be put on a queue that retries pull every time
there is a route change in the host's system.
> **Note::** the built-in help system in the CLI is generated from the
> YANG model, so the same information is also available for remote
> NETCONF users.
> [!TIP]
> The built-in help system in the CLI is generated from the YANG model,
> so the same information is also available for remote NETCONF users.
The two most common variants are `docker://` and `oci-archive:/`.
@@ -217,21 +228,46 @@ mind.
-rw-r--r-- 1 root root 7261785 Mar 27 14:22 curios-oci-amd64.tar.gz
drwx------ 6 frr frr 4096 Mar 27 11:57 frr/
Importing the image into podman can be done either from the CLI
Importing the image into Podman can be done either from the CLI
admin-exec context ...
admin@example:/var/tmp$ cli
admin@example:/> container load /var/tmp/curios-oci-amd64.tar.gz name curios:edge
> The `name curios:edge` is the tag you give the imported
> (raw) archive which you can then reference in your container image
> configuration: `set image curios:edge`.
> [!TIP]
> The `name curios:edge` is the tag you give the imported (raw) archive
> which you can then reference in your container image configuration:
> `set image curios:edge`.
... or by giving the container configuration the full path to the OCI
archive, which helps greatly with container upgrades (see below):
admin@example:/config/container/system/> set image oci-archive:/var/tmp/curios-oci-amd64.tar.gz
**Checksum Example:**
admin@example:/> configure
admin@example:/config/> edit container sys
admin@example:/config/container/sys/> set hostname sys
admin@example:/config/container/sys/> set image ftp://192.168.122.1/curios-oci-amd64-v24.05.0.tar.gz
admin@example:/config/container/sys/> set checksum
md5 sha256 sha512
admin@example:/config/container/sys/> set checksum sha256 4f01077036527498ed910f1a3e80645ae3eff629d10043cf80ebc6850c99c629
admin@example:/config/container/sys/> leave
admin@example:/> copy running-config startup-config
admin@example:/> show container
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b02e945c43c9 localhost/curios-oci-amd64-v24.05.0:latest 5 seconds ago Up 5 seconds sys
admin@example:/> show log
...
Nov 20 07:24:56 infix container[5040]: Fetching ftp://192.168.122.1/curios-oci-amd64-v24.05.0.tar.gz
Nov 20 07:24:56 infix container[5040]: curios-oci-amd64-v24.05.0.tar.gz downloaded successfully.
Nov 20 07:24:56 infix container[5040]: curios-oci-amd64-v24.05.0.tar.gz checksum verified OK.
Nov 20 07:24:57 infix container[5040]: Cleaning up extracted curios-oci-amd64-v24.05.0
Nov 20 07:24:57 infix container[5040]: podman create --name sys --conmon-pidfile=/run/container:sys.pid --read-only --replace --quiet --cgroup-parent=containers --restart=always --systemd=false --tz=local --hostname sys --log-driver k8s-file --log-opt path=/run/containers/sys.fifo --network=none curios-oci-amd64-v24.05.0
Nov 20 07:24:57 infix container[3556]: b02e945c43c9bce2c4be88e31d6f63cfdb1a3c8bdd02179376eb059a49ae05e4
Upgrading a Container Image
---------------------------
@@ -240,21 +276,24 @@ Upgrading a Container Image
The applications in your container are an active part of the system as a
whole, so make it a routine to keep your container images up-to-date!
> **Note:** the default writable layer is lost when upgrading the image.
> Use named volumes for content that you want to persist across upgrades.
Containers are created at first setup and at every boot. If the image
exists in the file system it is reused -- i.e., an image pulled from a
remote registry is not fetched again.
All container configurations are locked to the image hash at the time of
first download, not just ones that use an `:edge` or `:latest` tag. An
upgrade of containers using versioned images is more obvious -- update
the configuration to use the new `image:tag` -- the latter is a bit
trickier. Either remove the configuration and recreate it (leave/apply
the changes between), or use the admin-exec level command:
To upgrade a versioned image:
- update your `running-config` to use the new `image:tag`
- `leave` to activate the change, if you are in the CLI
- Podman pulls the new image in the background
- Your container is recreated with the new image
- The container is started
For "unversioned" images, e.g., images using a `:latest` or `:edge` tag,
use the following CLI command (`NAME` is the name of your container):
admin@example:/> container upgrade NAME
Where `NAME` is the name of your container. This command stops the
container, does `container pull IMAGE`, and then recreates it with the
new image. Upgraded containers are automatically restarted.
This stops the container, does `container pull IMAGE`, and recreates it
with the new image. Upgraded containers are automatically restarted.
**Example using registry:**
@@ -279,12 +318,30 @@ the upgrade command as
Upgrading container system with local archive: oci-archive:/var/tmp/curios-oci-amd64.tar.gz ...
7ab4a07ee0c6039837419b7afda4da1527a70f0c60c0f0ac21cafee05ba24b52
OCI archives can also be fetched from ftp/http/https URL, in that case
the upgrade can be done the same way as a registry image (above).
> [!TIP]
> Containers running from OCI images embedded in the operating system,
> e.g., `/lib/oci/mycontainer.tar.gz`, always run from the version in
> the operating system. To upgrade, install the new container image at
> build time, after system upgrade the container is also upgraded. The
> system unpacks and loads the OCI images into Podman every boot, which
> ensures the running container always has known starting state.
>
> **Example:** default builds of Infix include a couple of OCI images
> for reference, one is `/lib/oci/curios-nftables-v24.11.0.tar.gz`, but
> there is also a symlink called `curios-nftables-latest.tar.gz` in the
> same directory, which is what the Infix regression tests use in the
> image configuration of the container. This is what enables easy
> upgrades of the container along with the system itself.
Capabilities
-------------
An unprivileged container works for almost all use-cases, but there are
occasions where they are too restricted and users being looking for the
occasions where they are too restricted and users start looking for the
`privileged` flag. Capabilities offers a middle ground.
For example, a system container from which `ping` does not work:
@@ -300,9 +357,9 @@ For example, a system container from which `ping` does not work:
...
Infix supports a subset of all [capabilities][6] that are relevant for
containers. Please note, that this is and advanced topic and will
require time and analysis of your container application to figure out
which capabilities you need.
containers. Please note, that this is an advanced topic that require
time and analysis of your container application to figure out which
capabilities you need.
Networking and Containers
@@ -312,9 +369,16 @@ By default, unlike other systems, persistent[^1] containers have no
networking enabled. All network access has to be set up explicitly.
Currently two types of of container networks are supported:
- `host`: one end of a VETH pair, or a physical Ethernet port
- `host`: an managed host interface, e.g., one end of a VETH pair,
or even a physical interface
- `bridge`: an IP masquerading bridge
In the former the interface is delegated to (moved into) the container,
while in the latter a VETH pair is automatically created by Podman and
one end delegated to the container, while the other end is assigned to
the bridge (see the next section).
> [!TIP]
> For more information on VETH pairs, see the [Networking Guide][0].
@@ -347,10 +411,12 @@ have to set manually:
admin@example:/config/interface/docker0/> set type bridge
admin@example:/config/interface/docker0/> set container-network type bridge
> **Note:** when doing the same operation over NETCONF there is no
> inference, so all the "magic" settings need to be defined. This
> makes the CLI very useful for first setup and then extracting the
> resulting XML from the shell using the `cfg -X` command.
> [!IMPORTANT]
> When configuring the system via an API such as NETCONF or RESTCONF, no
> settings are inferred. Instead it is up to the caller to fully define
> the desired setup. This makes the CLI very useful for first setup and
> then extracting the resulting XML from the shell using the `cfg -X`
> command.
We have to declare the interface as a container network, ensuring the
interface cannot be used by the system for any other purpose. E.g., a
@@ -419,8 +485,12 @@ example.
The network `option` setting is available also for this case, but only
the `interface_name=foo0` option works. Which is still very useful. To
change the MAC address, you need to use the `custom-phys-address` in the
general network settings.
set:
- IP address, use IPv4/IPv6 settings in the interface settings
- MAC address, to use the `custom-phys-address` in the interface settings
For an example of both, see the next section.
[^3]: Something which the container bridge network type does behind the
scenes with one end of an automatically created VETH pair.
@@ -447,6 +517,7 @@ line where we declare the `ntpd` end as a container network interface:
admin@example:/config/interface/ntpd/> set custom-phys-address static 00:c0:ff:ee:00:01
admin@example:/config/interface/ntpd/> set container-network
> [!TIP]
> Notice how you can also set a custom MAC address at the same time.
Adding the interface to the container is the same as before, but since
@@ -456,6 +527,7 @@ can take a bit of a shortcut.
admin@example:/config/container/ntpd/> set network interface ntpd
admin@example:/config/container/ntpd/> leave
> [!TIP]
> Use the `set network interface ntpd option interface_name=foo0` to set
> the name of the interface inside the container to `foo0`.
@@ -478,6 +550,7 @@ We start by adding the second VETH pair:
admin@example:/config/interface/veth1a/> set veth peer veth1
admin@example:/config/interface/veth1a/> set ipv4 address 192.168.1.2 prefix-length 24
> [!NOTE]
> The LAN bridge (br1) in this example has IP address 192.168.1.1.
When a container has multiple host interfaces it can often be useful to
@@ -529,29 +602,40 @@ file system:
admin@example:/config/container/system/mount/leds> end
admin@example:/config/container/system/>
Sometimes *volumes* are a better fit. A volume is an automatically
Any type of file can be *bind mounted* into the container, just watch
out for permissions though. In the example above, `/sys/class/leds` is
not writable from a container unless it runs in *privileged* mode. For
plain configuration files you get more freedom, and your container can
rely on, e.g., *inotify* events to trigger reloading its services when
you change the file on the host.
So it depends on the container, and indeed your overall setup, what to
use. An intriguing option is *Content Mounts*, which when changed also
trigger a container restart.
Other times *volumes* are a better fit. A volume is an automatically
created read-writable entity that follows the life of your container.
admin@example:/config/container/ntpd/> set volume varlib target /var/lib
Volumes survive reboots and upgrading of the base image, unlike the
persistent writable layer you get by default, which does not survive
upgrades. The volume is created by podman when the container first
starts up, unlike a regular bind mount it synchronizes with the contents
of the underlying container image's path on the first start. I.e.,
"bind-mount, if empty: then rsync".
Volumes are persistent across both reboots and upgrades of the base
image. They are created by Podman when the container first starts up,
unlike a regular bind mount it synchronizes with the contents of the
underlying container image's path at first use. I.e., "bind-mount, if
empty: then rsync".
> [!NOTE]
> Infix support named volumes (only), and it is not possible to share a
> volume between containers. All the tricks possible with volumes may
> be added in a later release.
### Content Mounts
Content mount is a special type of where the file contents for the
container is stored alongside the container configuration. This can be
very useful when deploying similar systems at multiple sites. When the
host loads its `startup-config` (or even `factory-config`) a temporary
file is created using the decoded base64 data from the `content` node.
Content mounts are a special type of file mount where the file contents
is stored with the container configuration. This can be very useful
when deploying similar systems at multiple sites. When the host loads
its `startup-config` (or even `factory-config`) a temporary file is
created using the decoded base64 data from the `content` node.
admin@example:/config/container/ntpd/> edit mount ntpd.conf
admin@example:/config/container/ntpd/mount/ntpd.conf> text-editor content
@@ -564,9 +648,10 @@ The editor is a small [Emacs clone called Mg][2], see the built-in help
text, or press Ctrl-x Ctrl-c to exit and save. When the editor exits
the contents are base64 encoded and stored in the candidate datastore.
> **Note:** since these files are always recreated when the host is
> restarted, changes made by the container are not preserved, or saved
> back to the host's startup-config even if the read-only option is off.
> [!NOTE]
> Since these files are always recreated when the host is restarted,
> changes made by the container are not preserved, or saved back to the
> host's startup-config.
Infix has three different text editors available. For more information,
see [CLI Text Editor](cli/text-editor.md).
@@ -588,10 +673,11 @@ we created previously:
admin@example:/config/container/system/> set publish 222:22
admin@example:/config/container/system/> leave
> **Note:** ensure you have a network connection to the registry.
> If the image cannot be pulled, creation of the container will be
> put in a queue and be retried every time there is a change in the
> routing table, e.g., default route is added.
> [!NOTE]
> Ensure you have a network connection to the registry. If the image
> cannot be pulled, creation of the container will be put in a queue and
> be retried every time there is a change in the routing table, e.g.,
> default route is added, and every 60 seconds.
Provided the image is downloaded successfully, a new `system` container
now runs behind the docker0 interface, forwarding container port 22 to
@@ -707,12 +793,13 @@ Another *insecure* approach is to access the host system directly,
bypassing the namespaces that make up the boundary between host and
container.
> **Security:** Please note, this completely demolishes the isolation
> barrier between container and host operating system. It is only
> suitable in situations where the container serves more as a unit of
> distribution rather than as a separate component of the system.
> *Strongly recommended* to use this only in trusted setups! Consider
> also limiting the time frame in which this is active!
> [!CAUTION]
> Please note, this completely demolishes the isolation barrier between
> container and host operating system. It is only suitable in
> situations where the container serves more as a unit of distribution
> rather than as a separate component of the system. *Strongly
> recommended* to use this only in trusted setups! Consider also
> limiting the time frame in which this is active!
First, enable *Privileged* mode, this unlocks the door and allows the
container to manage resources on the host system. An example is the
@@ -747,6 +834,58 @@ control an Infix system this way, see [Scripting Infix](scripting.md).
it may not be enabled by default in BusyBox.
Container Requirements
----------------------
In addition to general [*best practices*][7] for container images, there
are a few more things to consider when targeting embedded systems:
- Ensure the image targets the CPU architecture of the target system,
learn more about [Multi-platform Builds][8]
- Follow [best practices for naming and tagging][10], e.g., `:latest` vs `:1.0`
- Follow [OCI recommendations and layout][9],
learn more about [OCI and Docker Exporters][6]
If the [Docker documentation][11] is not enough, there are plenty of
[guides online][12] with examples on how to create your own container
image. For the more advanced, please see the next section.
### Advanced Users
Most people prefer their system containers small, often based on Alpine
Linux, or similar, with only a few small applications, including their
own, and an SSH server perhaps. For some developers, even this is too
big, so they roll their own from source. This section is for you.
Depending on your needs, here is a checklist:
- you need something that can forward signals, e.g.,
- [tini][]
- [Bash only][13], or
- BusyBox init, a classic most embedded developers know, but read on ...
- a system container only need the bare necessities of a system bringup
- E.g., BusyBox's init, [but not everything][15]
- Some of the networking is set up by Podman and CNI for you, but
you may want to run a DHCP client?
- Do *not* rename interfaces inside the container, use the dedicated
`interface_name` option in the configuration instead
- Remember, Podman provides a `tmpfs` for all critical system paths:
`/dev`, `/dev/shm`, `/run`, `/tmp`, and `/var/tmp`, so you don't
need to clean or set up any of these mount points
Examples using `tini` and BusyBox init are available from the KernelKit
[curiOS project][14]. It is a small Buildroot based container image
builder that generates OCI compatible image tarballs without any tools
from Docker or Podman -- ready-made images exist for testing on both
AMD64 and ARM64 targets, as well as `docker pull` images and and OCI
tarballs with SHA256 checksums for integrity checking.
Finally, if you build your own version of Infix, and embed OCI tarballs
in the system image, then see the tip at the end of [Upgrading a
Container Image](#upgrading-a-container-image) (above).
[0]: networking.md
[1]: https://github.com/kernelkit/infix/blob/main/src/confd/yang/infix-containers.yang
[2]: https://github.com/troglobit/mg
@@ -754,4 +893,14 @@ control an Infix system this way, see [Scripting Infix](scripting.md).
[4]: system.md#ssh-authorized-key
[5]: https://docs.docker.com/build/exporters/oci-docker/
[6]: https://man7.org/linux/man-pages/man7/capabilities.7.html
[7]: https://docs.docker.com/build/building/best-practices/
[8]: https://docs.docker.com/build/building/multi-platform/
[9]: https://github.com/opencontainers/image-spec/blob/main/image-layout.md
[10]: https://docs.docker.com/get-started/docker-concepts/building-images/build-tag-and-publish-an-image/#tagging-images
[11]: https://www.docker.com/blog/multi-arch-images/
[12]: https://lemariva.com/blog/2018/05/tutorial-docker-on-embedded-systems-raspberry-pi-beagleboard
[13]: https://sirikon.me/posts/0009-pid-1-bash-script-docker-container.html
[14]: https://github.com/kernelkit/curiOS/
[15]: https://github.com/kernelkit/curiOS/blob/2e4748f65e356b2c117f586cd9420d7ba66f79d5/board/system/rootfs/etc/inittab
[tini]: https://github.com/krallin/tini
[podman]: https://podman.io
+15 -14
View File
@@ -206,20 +206,18 @@ corresponding image for execution with our normal tooling:
Contributing
------------
Infix is built from many parts, when contributing you need to set up
your own fork, create a local branch for your change, push to your fork,
and then use GitHub to create a *Pull Reqeuest*.
Infix is built from many components, when contributing you need to set
up your own fork, create a local branch for your change, push to your
fork, and then use GitHub to create a *Pull Reqeuest*.
For this to work as painlessly as possible:
For this to work as *painlessly as possible* for everyone involved:
1. Fork Infix to your own user or organization[^1]
2. Fork all the Infix submodules, e.g., `kernelkit/buildroot` to your
own user or organization as well
3. Clone your fork of Infix to your laptop/workstation
If you use a GitHub organization you get the added benefit of having
local peer reviews of changes before making a pull request to the
upstream Infix repository.
1. Fork Infix to your own user or organization[^1]
2. Fork all the Infix submodules, e.g., `kernelkit/buildroot` to your
own user or organization as well
3. Clone your fork of Infix to your laptop/workstation
4. [Deactivate the Actions][6] you don't want in your fork
5. Please read the [Contributing Guidelines][5] as well!
```bash
$ cd ~/Projects
@@ -227,10 +225,10 @@ $ git clone https://github.com/YOUR_USER_NAME/infix.git
$ cd infix/
$ git submodule update --init
```
> **Note:** when updating/synchronizing with upstream Infix changes you
> may have to synchronize your forks as well. GitHub have a `Sync fork`
> button in the GUI for your fork for this purpose.
> button in the GUI for your fork for this purpose. A cronjob on your
> server of choice can do this for you with the [GitHub CLI tool][7].
[^1]: Organizations should make sure to lock the `main` (or `master`)
branch of their clones to ensure members do not accidentally merge
@@ -243,3 +241,6 @@ $ git submodule update --init
[2]: https://github.com/wkz/qeneth
[3]: https://netopeer.liberouter.org/doc/sysrepo/master/html/dev_guide.html
[4]: https://buildroot.org/downloads/manual/manual.html#_developer_guide
[5]: https://github.com/kernelkit/infix/blob/main/.github/CONTRIBUTING.md
[6]: https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/disabling-and-enabling-a-workflow
[7]: https://cli.github.com/
+142 -28
View File
@@ -16,14 +16,14 @@ seen in the response.
In the example below, the PC is connected to Infix via interface *tap0*
(*tap0* is *if1* in Figure 1) and Infix responds with address
*fe80::ff:fe00:0*.
*fe80::ff:fec0:ffed*.
```
linux-pc:# ping -6 -L -c 3 ff02::1%tap0
PING ff02::1%tap0(ff02::1%tap0) 56 data bytes
64 bytes from fe80::ff:fe00:0%tap0: icmp_seq=1 ttl=64 time=0.558 ms
64 bytes from fe80::ff:fe00:0%tap0: icmp_seq=2 ttl=64 time=0.419 ms
64 bytes from fe80::ff:fe00:0%tap0: icmp_seq=3 ttl=64 time=0.389 ms
64 bytes from fe80::ff:fec0:ffed%tap0: icmp_seq=1 ttl=64 time=0.558 ms
64 bytes from fe80::ff:fec0:ffed%tap0: icmp_seq=2 ttl=64 time=0.419 ms
64 bytes from fe80::ff:fec0:ffed%tap0: icmp_seq=3 ttl=64 time=0.389 ms
--- ff02::1%tap0 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2043ms
@@ -34,9 +34,9 @@ linux-pc:#
The PC could connect then connect to Infix, e.g., using SSH.
```
linux-pc:# ssh admin@fe80::ff:fe00:0%tap0
admin@fe80::ff:fe00:0%tap0's password: admin
admin@infix-00-00-00:~$
linux-pc:# ssh admin@fe80::ff:fec0:ffed%tap0
admin@fe80::ff:fec0:ffed%tap0's password: admin
admin@infix-c0-ff-ee:~$
```
## Discovery mechanisms available in Infix
@@ -55,18 +55,18 @@ linux-pc:# tcpdump -i tap0 -Qin -v ether proto 0x88cc
tcpdump: listening on tap0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
15:51:52.061071 LLDP, length 193
Chassis ID TLV (1), length 7
Subtype MAC address (4): 02:00:00:00:00:00 (oui Unknown)
Subtype MAC address (4): 02:00:00:c0:ff:ee (oui Unknown)
Port ID TLV (2), length 7
Subtype MAC address (3): 02:00:00:00:00:00 (oui Unknown)
Subtype MAC address (3): 02:00:00:c0:ff:ee (oui Unknown)
Time to Live TLV (3), length 2: TTL 120s
System Name TLV (5), length 14: infix-00-00-00
System Name TLV (5), length 14: infix-c0-ff-ee
System Description TLV (6), length 91
Infix by KernelKit Linux 5.19.17 #1 SMP PREEMPT_DYNAMIC Wed Jun 7 08:47:23 CEST 2023 x86_64
System Capabilities TLV (7), length 4
System Capabilities [Bridge, WLAN AP, Router, Station Only] (0x009c)
Enabled Capabilities [Station Only] (0x0080)
Management Address TLV (8), length 24
Management Address length 17, AFI IPv6 (2): fe80::ff:fe00:0
Management Address length 17, AFI IPv6 (2): fe80::ff:fec0:ffed
Interface Index Interface Numbering (2): 2
Port Description TLV (4), length 4: eth0
Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
@@ -97,11 +97,11 @@ linux-pc:# sudo tcpdump -i tap0 -Qin -v ether proto 0x88cc
tcpdump: listening on tap0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
15:46:07.908665 LLDP, length 207
Chassis ID TLV (1), length 7
Subtype MAC address (4): 02:00:00:00:00:00 (oui Unknown)
Subtype MAC address (4): 02:00:00:c0:ff:ee (oui Unknown)
Port ID TLV (2), length 7
Subtype MAC address (3): 02:00:00:00:00:00 (oui Unknown)
Subtype MAC address (3): 02:00:00:c0:ff:ee (oui Unknown)
Time to Live TLV (3), length 2: TTL 120s
System Name TLV (5), length 14: infix-00-00-00
System Name TLV (5), length 14: infix-c0-ff-ee
System Description TLV (6), length 91
Infix by KernelKit Linux 5.19.17 #1 SMP PREEMPT_DYNAMIC Wed Jun 7 08:47:23 CEST 2023 x86_64
System Capabilities TLV (7), length 4
@@ -134,6 +134,15 @@ linux-pc:#
(LLDP)](https://github.com/lldp/lldpd) includes *lldpcli*, which
is handy to sniff and display LLDP packets.
The LLDP service can be disabled using the following commands.
```
admin@infix-c0-ff-ee:/> configure
admin@infix-c0-ff-ee:/config/> no lldp
admin@infix-c0-ff-ee:/config/> leave
admin@infix-c0-ff-ee:/>
```
### mDNS
DNS-SD/mDNS can be used to discover Infix units and services. Infix
@@ -144,33 +153,138 @@ be used to search for devices advertising their services via mDNS.
```
linux-pc:# avahi-browse -ar
+ tap0 IPv6 infix-00-00-00 SFTP File Transfer local
+ tap0 IPv4 infix-00-00-00 SFTP File Transfer local
+ tap0 IPv6 infix-00-00-00 SSH Remote Terminal local
+ tap0 IPv4 infix-00-00-00 SSH Remote Terminal local
= tap0 IPv4 infix-00-00-00 SFTP File Transfer local
hostname = [infix-00-00-00.local]
+ tap0 IPv6 infix-c0-ff-ee SFTP File Transfer local
+ tap0 IPv4 infix-c0-ff-ee SFTP File Transfer local
+ tap0 IPv6 infix-c0-ff-ee SSH Remote Terminal local
+ tap0 IPv4 infix-c0-ff-ee SSH Remote Terminal local
= tap0 IPv4 infix-c0-ff-ee SFTP File Transfer local
hostname = [infix-c0-ff-ee.local]
address = [10.0.1.1]
port = [22]
txt = []
= tap0 IPv4 infix-00-00-00 SSH Remote Terminal local
hostname = [infix-00-00-00.local]
= tap0 IPv4 infix-c0-ff-ee SSH Remote Terminal local
hostname = [infix-c0-ff-ee.local]
address = [10.0.1.1]
port = [22]
txt = []
= tap0 IPv6 infix-00-00-00 SFTP File Transfer local
hostname = [infix-00-00-00.local]
address = [fe80::ff:fe00:0]
= tap0 IPv6 infix-c0-ff-ee SFTP File Transfer local
hostname = [infix-c0-ff-ee.local]
address = [fe80::ff:fec0:ffed]
port = [22]
txt = []
= tap0 IPv6 infix-00-00-00 SSH Remote Terminal local
hostname = [infix-00-00-00.local]
address = [fe80::ff:fe00:0]
= tap0 IPv6 infix-c0-ff-ee SSH Remote Terminal local
hostname = [infix-c0-ff-ee.local]
address = [fe80::ff:fec0:ffed]
port = [22]
txt = []
^C
linux-pc:#
```
Additionally, *avahi-resolve-host-name* can be used to verify domain
name mappings for IP addresses. By default, it translates from IPv4
addresses. This function allows users to confirm that addresses are
mapped correctly.
```
linux-pc:# avahi-resolve-host-name infix-c0-ff-ee.local
infix-c0-ff-ee.local 10.0.1.1
linux-pc:#
```
Thanks to mDNS we can use the advertised name instead of the IP
address for operations like `ping` and `ssh` as shown below:
```
linux-pc:# ping infix-c0-ff-ee.local -c 3
PING infix-c0-ff-ee.local (10.0.1.1) 56(84) bytes of data.
64 bytes from 10.0.1.1: icmp_seq=1 ttl=64 time=0.852 ms
64 bytes from 10.0.1.1: icmp_seq=2 ttl=64 time=1.12 ms
64 bytes from 10.0.1.1: icmp_seq=3 ttl=64 time=1.35 ms
--- infix-c0-ff-ee.local ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 0.852/1.105/1.348/0.202 ms
linux-pc:# ssh admin@infix-c0-ff-ee.local
(admin@infix-c0-ff-ee.local) Password:
.-------.
| . . | Infix -- a Network Operating System
|-. v .-| https://kernelkit.org
'-'---'-
Run the command 'cli' for interactive OAM
linux-pc:#
```
To disable mDNS/mDNS-SD, type the commands:
```
admin@infix-c0-ff-ee:/> configure
admin@infix-c0-ff-ee:/config/> no mdns
admin@infix-c0-ff-ee:/config/> leave
```
#### Human-Friendly Hostname Alias
Each Infix unit will advertise itself as *infix.local*, in addition to
its full hostname (e.g., *infix-c0-ff-ee.local* or *foo.local*). This
alias works seamlessly on a network with a single Infix device, and
makes it easy to connect when the exact hostname is not known in
advance. The examples below show how the alias can be used for
actions such as pinging or establishing an SSH connection:
```
linux-pc:# ping infix.local -c 3
PING infix.local (10.0.1.1) 56(84) bytes of data.
64 bytes from 10.0.1.1: icmp_seq=1 ttl=64 time=0.751 ms
64 bytes from 10.0.1.1: icmp_seq=2 ttl=64 time=2.28 ms
64 bytes from 10.0.1.1: icmp_seq=3 ttl=64 time=1.42 ms
--- infix.local ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 0.751/1.482/2.281/0.626 ms
linux-pc:# ssh admin@infix.local
(admin@infix.local) Password:
.-------.
| . . | Infix -- a Network Operating System
|-. v .-| https://kernelkit.org
'-'---'-
Run the command 'cli' for interactive OAM
linux-pc:#
```
When multiple Infix devices are present on the LAN the alias will not
uniquely identify a device; *infix.local* will refer to any of the
Infix devices, likely the one that first appeared.
> When multiple Infix units are present, use the full hostname (e.g.,
> *infix-c0-ff-ee.local* or *foo.local*) rather than the alias
> infix.local to deterministically connect to a unit.
#### Netbrowse service to find all your devices
Another mDNS alias that all Infix devices can advertise is
*network.local*. This is a web service which basically runs avahi-browse
and displays a table of other Infix devices and their services.
![Netbrowse Service - network.local](img/network-local.png)
With multiple Infix devices on the LAN, one will be your portal to
access all others, if it goes down another will take its place.
To disable the netbrowse service, the following commands can be used:
```
admin@infix-c0-ff-ee:/> configure
admin@infix-c0-ff-ee:/config/> edit web
admin@infix-c0-ff-ee:/config/web/> no netbrowse
admin@infix-c0-ff-ee:/config/web/> leave
```
[^2]: [mdns-scan](http://0pointer.de/lennart/projects/mdns-scan/): a
tool for scanning for mDNS/DNS-SD published services on the local
network
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 262 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 464 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 388 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 343 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 269 KiB

+2 -1
View File
@@ -15,7 +15,8 @@ managing entire fleets of installed equipment.
Nevertheless, when it comes to initial deployment and debugging, it
is very useful to know how to navigate and use the CLI.
> Proceed to the [CLI User Guide](cli/tutorial.md).
> Proceed to the [CLI Introduction](cli/introduction.md) or [CLI
> Configuration Tutorial](cli/configure.md).
## Key Concepts
+181 -56
View File
@@ -7,9 +7,10 @@ model forms the base, extended with [ietf-ip.yang][2] and other layer-3
IETF models. The layer-2 bridge and aggregate models are defined by
Infix to exploit the unique features not available in IEEE models.
> **Note:** when issuing `leave` to activate your changes, remember to
> also save your settings, `copy running-config startup-config`. See
> the [CLI Introduction](cli/introduction.md) for a background.
> [!IMPORTANT]
> When issuing `leave` to activate your changes, remember to also save
> your settings, `copy running-config startup-config`. See the [CLI
> Introduction](cli/introduction.md) for a background.
## Interface LEGO®
@@ -43,15 +44,17 @@ diverted to the VLAN interface before entering the bridge, while all
other traffic would be bridged as usual.
| **Type** | **Yang Model** | **Description** |
| -------- | ----------------- | ------------------------------------------------------------- |
|----------|----------------------------|---------------------------------------------------------------|
| bridge | infix-if-bridge | SW implementation of an IEEE 802.1Q bridge |
| ip | ietf-ip, infix-ip | IP address to the subordinate interface |
| vlan | infix-if-vlan | Capture all traffic belonging to a specific 802.1Q VID |
| lag[^1] | infix-if-lag | Bonds multiple interfaces into one, creating a link aggregate |
| lo | ietf-interfaces | Software loopback interface |
| eth | ietf-interfaces, | Physical Ethernet device/port |
| | ieee802-ethernet-interface | |
| eth | ieee802-ethernet-interface | Physical Ethernet device/port. |
| | infix-ethernet-interface | |
| veth | infix-if-veth | Virtual Ethernet pair, typically one end is in a container |
| *common* | ietf-interfaces, | Properties common to all interface types |
| | infix-interfaces | |
## Data Plane
@@ -97,10 +100,15 @@ This is an extension to the ietf-interfaces YANG model, which defines
`phys-address` as read-only[^4]. The following shows the different
configuration options.
> **Note:** there is no validation or safety checks performed by the
> system when using `custom-phys-address`. In particular the `offset`
> variant can be dangerous to use -- pay attention to the meaning of
> bits in the upper-most octet: local bit, multicast/group, etc.
The `description` is saved as Linux `ifalias` on an interface. It is a
free-form string, useful for describing purpose or just adding comments
for remote debugging, e.g., using the operational datastore.
> [!CAUTION]
> There is no validation or safety checks performed by the system when
> using `custom-phys-address`. In particular the `offset` variant can
> be dangerous to use -- pay attention to the meaning of bits in the
> upper-most octet: local bit, multicast/group, etc.
#### Fixed custom MAC
@@ -143,6 +151,8 @@ a switch is a bridge. In Linux, setting up a bridge with ports
connected to physical switch fabric, means you manage the actual switch
fabric!
#### MAC Bridge
In Infix ports are by default not switch ports, unless the customer
specific factory config sets it up this way. To enable switching
between ports you create a bridge and then add ports to that
@@ -159,11 +169,21 @@ admin@example:/config/> leave
Here we add two ports to bridge `br0`: `eth0` and `eth1`.
> **Note:** Infix has many built-in helpers controlled by convention.
> E.g., if you name your bridge `brN`, where `N` is a number, Infix sets
> the interface type automatically and unlocks all bridge features.
> Other "magic" names are `ethN.M` for VLAN M on top of `ethN`, or
> `dockerN` to create an IP masquerading container bridge.
> [!TIP]
> Infix has many built-in helpers controlled by convention. Example,
> naming your bridge `brN`, where `N` is a number, hints Infix to set
> interface type automatically and unlocks all bridge features. Other
> "magic" names are `vethNA`, where `N` is a number and `A` is a letter
> ('a' for access port and 'b' for bridge side is common), and `ethN.M`
> for VLAN M on top of `ethN`, or `dockerN` to create an IP masquerading
> container bridge.
![A MAC bridge with two ports](img/mac-bridge.svg)
It is possible to create multiple MAC bridges, however, it is
currently[^5] _not recommended_ to use more than one MAC bridge on
products with Marvell LinkStreet switching ASICs. A VLAN filtering
bridge should be used instead.
#### VLAN Filtering Bridge
@@ -189,6 +209,8 @@ This sets `eth0` as an untagged member of VLAN 10 and `eth1` as an
untagged member of VLAN 20. Switching between these ports is thus
prohibited.
![A VLAN bridge with two VLANs](img/vlan-bridge.svg)
To terminate a VLAN in the switch itself, either for switch management
or for routing, the bridge must become a (tagged) member of the VLAN.
@@ -197,9 +219,16 @@ admin@example:/config/interface/br0/> set bridge vlans vlan 10 tagged br0
admin@example:/config/interface/br0/> set bridge vlans vlan 20 tagged br0
```
> To route or to manage via a VLAN, a VLAN interface needs to be created
> on top of the bridge, see section [VLAN Interfaces](#vlan-interfaces)
> below for more on this topic.
To route or to manage via a VLAN, a VLAN interface needs to be created
on top of the bridge, see section [VLAN Interfaces](#vlan-interfaces)
below for more on this topic.
> [!NOTE]
> In some use-cases only a single management VLAN on the bridge is used.
> For the example above, if the bridge itself is an untagged member only
> in VLAN 10, IP addresses can be set directly on the bridge without the
> need for dedicated VLAN interfaces on top of the bridge.
#### Multicast Filtering and Snooping
@@ -209,10 +238,11 @@ also supports "snooping", i.e., IGMP and MLD, to automatically reduce
the broadcast effects of multicast. See the next section for a summary
of the [terminology used](#terminology--abbreviations).
> **Note:** currently there is no way to just enable multicast filtering
> without also enabling snooping. This may change in the future, in
> which case a `filtering` enabled setting will be made available along
> with the existing `snooping` setting.
> [!IMPORTANT]
> Currently there is no way to just enable multicast filtering without
> also enabling snooping. This may change in the future, in which case
> a `filtering` enabled setting will be made available along with the
> existing `snooping` setting.
When creating your bridge you must decide if you need a VLAN filtering
bridge or a plain bridge (see previous section). Multicast filtering is
@@ -352,19 +382,52 @@ an IGMP/MLD fast-leave port.
tables shown above, a *None* timeout is declared when the current
device is the active querier
> **Note:** the reason why multicast flooding is enabled by default is
> to ensure safe co-existence with MAC multicast, which is very common
> in industrial networks. It also allows end devices that do not know
> of IGMP/MLD to communicate over multicast as long as the group they
> have chosen is not used by other IGMP/MLD aware devices on the LAN.
> [!TIP]
> The reason why multicast flooding is enabled by default is to ensure
> safe co-existence with MAC multicast, which is common in industrial
> networks. It also allows end devices that do not know of IGMP/MLD to
> communicate over multicast as long as the group they have chosen is
> not used by other IGMP/MLD aware devices on the LAN.
>
> As soon as an IGMP/MLD membership report to "join" a group is received
> the group is added to the MDB and forwarding to other ports stop. The
> only exception to this rule is multicast router ports.
> the group is added to the kernel MDB and forwarding to other ports
> stop. The only exception to this rule is multicast router ports.
>
> If your MAC multicast forwarding is not working properly, it may be
> because an IP multicast group maps to the same MAC address. Please
> see [RFC 1112][RFC1112] for details. Use static multicast router
> ports, or static multicast MAC filters, to mitigate.
[RFC1112]: https://www.rfc-editor.org/rfc/rfc1112.html
[RFC3376]: https://www.rfc-editor.org/rfc/rfc3376.html
[RFC3810]: https://www.rfc-editor.org/rfc/rfc3810.html
#### Forwarding of IEEE Reserved Group Addresses
Addresses in range `01:80:C2:00:00:0X` are used by various bridge
signaling protocols, and are not forwarded by default. Still, it is
sometimes useful to let the bridge forward such packets, and Infix
supports this by specifying protocol names or the last address
*nibble* as decimal value `0..15`.
```
admin@example:/config/> edit interface br0 bridge
admin@example:/config/interface/br0/bridge/> set ieee-group-forward <?>
[0..15] List of IEEE link-local protocols to forward, e.g., STP, LLDP
dot1x 802.1X Port-Based Network Access Control.
lacp 802.3 Slow Protocols, e.g., LACP.
lldp 802.1AB Link Layer Discovery Protocol (LLDP).
stp Spanning Tree (STP/RSPT/MSTP).
admin@example:/config/interface/br0/bridge/> set ieee-group-forward
```
The following example configures bridge *br0* to forward LLDP packets.
```
admin@example:/config/interface/br0/bridge/> set ieee-group-forward lldp
admin@example:/config/interface/br0/bridge/>
```
### VLAN Interfaces
Creating a VLAN can be done in many ways. This section assumes VLAN
@@ -407,7 +470,9 @@ As conventions, a VLAN interface for VID 20 on top of an Ethernet
interface *eth0* is named *eth0.20*, and a VLAN interface for VID 10 on
top of a bridge interface *br0* is named *vlan10*.
> **Note:** If you name your VLAN interface `foo0.N` or `vlanN`, where `N` is a number, Infix will set the interface type automatically for you.
> [!NOTE]
> If you name your VLAN interface `foo0.N` or `vlanN`, where `N` is a
> number, Infix will set the interface type automatically for you.
### Physical Ethernet Interfaces
@@ -415,7 +480,7 @@ top of a bridge interface *br0* is named *vlan10*.
#### Ethernet Settings and Status
Physical Ethernet interfaces provide low-level settings for speed/duplex as
well as packet status and statistics (*ieee802-ethernet-interface.yang*).
well as packet status and [statistics](#ethernet-statistics).
By default, Ethernet interfaces defaults to auto-negotiating
speed/duplex modes, advertising all speed and duplex modes available.
@@ -466,9 +531,10 @@ Auto-negotiation of speed/duplex mode is desired in almost all
use-cases, but it is possible to disable auto-negotiation and specify
a fixed speed and duplex mode.
> If setting a fixed speed and duplex mode, ensure both sides of the
> link have matching configuration. If speed does not match, the link
> will not come up. If duplex mode does not match, the result is
> [!IMPORTANT]
> When setting a fixed speed and duplex mode, ensure both sides of the
> link have matching configuration. If speed does not match, the link
> will not come up. If duplex mode does not match, the result is
> reported collisions and/or bad throughput.
The example below configures port eth3 to fixed speed 100 Mbit/s
@@ -497,7 +563,7 @@ require auto-negotiation to be enabled.
#### Ethernet statistics
Ethernet packet statistics can be listed as shown below.
Ethernet packet statistics[^6] can be listed as shown below.
```
admin@example:/> show interfaces name eth1
@@ -561,9 +627,10 @@ interfaces {
admin@example:/config/>
```
> **Note:** this is another example of the automatic inference of the
> interface type from the name. Any name can be used, but then you have
> to set the interface type to `veth` manually.
> [!TIP]
> This is another example of the automatic inference of the interface
> type from the name. Any name can be used, but then you have to set
> the interface type to `veth` manually.
## Management Plane
@@ -585,6 +652,10 @@ Multiple address assignment methods are available:
| link-local | infix-ip | Auto-assignment of IPv4 address in 169.254.x.x/16 range |
| dhcp | infix-dhcp-client | Assignment of IPv4 address by DHCP server, e.g., *10.0.1.1/24* |
> [!NOTE]
> The DHCP address method is only available for *LAN* interfaces
> (Ethernet, virtual Ethernet (veth), bridge, link aggregates, etc.)
Supported DHCP (request) options, configurability (Cfg) and defaults,
are listed below. Configurable options can be disabled on a per client
interface basis, some options, like `clientid` and option 81, are
@@ -610,8 +681,17 @@ possible to set the value of as well.
**Default:** `router`, `dns`, `domain`, `broadcast`, `ntpsrv`, `search`,
`address`, `staticroutes`, `msstaticroutes`
> **Note:** DHCP address method is only available for *LAN* interfaces
> (Ethernet, virtual Ethernet (veth), bridge, link aggregates, etc.)
When configuring a DHCP client, ensure that the NTP client is enabled
for the `ntpsrv` DHCP option to be processed correctly. If the NTP
client is not enabled, any NTP servers provided by the DHCP server will
be ignored. For details on how to enable the NTP client, see the
[NTP Client Configuration](system.md#ntp-client-configuration) section.
> [!IMPORTANT]
> Per [RFC3442][4], if the DHCP server returns both a Classless Static
> Routes option (121) and Router option (3), the DHCP client *must*
> ignore the latter.
### IPv6 Address Assignment
@@ -830,7 +910,7 @@ have changed type to *random*.
### IPv4 forwarding
To be able to route (static or dynamic) on the interface it is
required to enable forwarding. This setting controlls if packets
required to enable forwarding. This setting controls if packets
received on this interface can be forwarded.
```
admin@example:/config/> edit interface eth0
@@ -846,12 +926,12 @@ This flag behaves totally different than for IPv4. For IPv6 the
ability to route between interfaces is always enabled, instead this
flag controls if the interface will be in host/router mode.
| **Feature** | **Forward enabled** | **Forward disabled** |
|:------------------------------------------|:--------------------|:---------------------|
| IsRouter set in Neighbour Advertisements. | Yes | No |
| Transmit Router Solicitations. | No | Yes |
| Router Advertisements are ignored | No | Yes |
| Accept Redirects | No | Yes |
| **Feature** | **Forward enabled** | **Forward disabled** |
|:-----------------------------------------|:--------------------|:---------------------|
| IsRouter set in Neighbour Advertisements | Yes | No |
| Transmit Router Solicitations | No | Yes |
| Router Advertisements are ignored | No | Yes |
| Accept Redirects | No | Yes |
```
admin@example:/config/> edit interface eth0
@@ -877,9 +957,10 @@ The base model, ietf-routing, is where all the other models hook in. It
is used to set configuration and read operational status (RIB tables) in
the other models.
> **Note:** the standard IETF routing models allows multiple instances,
> but Infix currently *only support one instance* per routing protocol!
> In the examples presented here, the instance name `default` is used.
> [!NOTE]
> The standard IETF routing models allows multiple instances, but Infix
> currently *only support one instance* per routing protocol! In the
> examples presented here, the instance name `default` is used.
### IPv4 Static routes
@@ -905,6 +986,7 @@ router 192.168.1.1, using the highest possible distance:
admin@example:/config/routing/control-plane-protocol/static/name/default/> leave
admin@example:/>
> [!TIP]
> Remember to enable [IPv4 forwarding](#IPv4-forwarding) for the
> interfaces you want to route between.
@@ -928,6 +1010,7 @@ enable OSPF and set one active interface in area 0:
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/> leave
admin@example:/>
> [!TIP]
> Remember to enable [IPv4 forwarding](#IPv4-forwarding) for all the
> interfaces you want to route between.
@@ -982,6 +1065,38 @@ an Ethernet interface can be done as follows.
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/ospf/area/0.0.0.0/interface/e0/> set interface-type point-to-point
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/ospf/area/0.0.0.0/interface/e0/>
#### OSPF global settings
In addition to *area* and *interface* specific settings, OSPF provides
global settings for route redistribution and OSPF router identifier.
```
admin@example:/config/> edit routing control-plane-protocol ospfv2 name default ospf
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/ospf/> set ?
area List of OSPF areas.
default-route-advertise Distribute default route to network
explicit-router-id Defined in RFC 2328. A 32-bit number
redistribute Redistribute protocols into OSPF
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/ospf/> set
```
- Explicit router ID: By default the router will pick an IP address
from one of its OSPF interfaces as OSPF router ID. An explicit ID is
used to get a deterministic behavior, e.g., `set explicit-router-id
1.1.1.1`.
- Redistribution: `set redistribute static` and `set redistribute connected`
can be used to include static or connected routes into the OSPF routing
domain. These routes are redistributed as *external type-2* (E2)
routes.
- Advertising default route: An OSPF router can be made to distribute
a default route into the OSPF domain by command `set
default-route-advertise enabled`. This route is distributed as long
as the router itself has an *active* default route in its routing
table. By adding command `set default-route-advertise always` the
router will distribute a default route even when it lacks a default
route. The default route will be distributed as an *external type-2*
(E2) route.
#### Debug OSPFv2
@@ -1053,7 +1168,7 @@ This CLI example show the IPv6 routing table.
#### Route Preference
The operating system leverages FRRouting ([Frr][4]) as routing engine
The operating system leverages FRRouting ([Frr][0]) as routing engine
for both static and dynamic routing. Even routes injected from a DHCP
client, and IPv4 link-local (IPv4) routes, are injected into Frr to let
it weigh all routes before installing them into the kernel routing table
@@ -1084,10 +1199,11 @@ different next-hop, learned from a DHCP server wins over an OSPF route.
The distance used for static routes and DHCP routes can be changed by
setting a different *routing preference* value.
> **Note:** the kernel metric is an unsigned 32-bit value, which is read
> by Frr as (upper) 8 bits distance and 24 bits metric. But it does not
> write it back to the kernel FIB this way, only selected routes are
> candidates to be installed in the FIB by Frr.
> [!NOTE]
> The kernel metric is an unsigned 32-bit value, which is read by Frr as
> (upper) 8 bits distance and 24 bits metric. But it does not write it
> back to the kernel FIB this way, only selected routes are candidates
> to be installed in the FIB by Frr.
#### Source protocol
@@ -1107,7 +1223,8 @@ currently supported, namely `ipv4` and `ipv6`.
[1]: https://www.rfc-editor.org/rfc/rfc8343
[2]: https://www.rfc-editor.org/rfc/rfc8344
[3]: https://www.rfc-editor.org/rfc/rfc8981
[4]: https://frrouting.org/
[4]: https://www.rfc-editor.org/rfc/rfc3442
[0]: https://frrouting.org/
[^1]: Please note, link aggregates are not yet supported in Infix.
[^2]: Link-local IPv6 addresses are implicitly enabled when enabling
@@ -1120,3 +1237,11 @@ currently supported, namely `ipv4` and `ipv6`.
[^4]: A YANG deviation was previously used to make it possible to set
`phys-address`, but this has been replaced with the more flexible
`custom-phys-address`.
[^5]: Infix MAC bridges on Marvell Linkstreet devices are currently
limited to use a single MAC database, causing issues if the same
MAC address appears on different MAC bridges.
[^6]: Ethernet counters are described in
*ieee802-ethernet-interface.yang* and
*infix-ethernet-interface.yang*. [Ethernet
Counters](eth-counters.md) page provides additional details on
statistics support.
+43 -8
View File
@@ -12,14 +12,6 @@ packets to drop and which ones to prioritize, such that critical
services remain operational.
## Software Forwarded Traffic
For packets which are processed by a CPU, i.e. typically routed
traffic, and bridged traffic between interfaces that do not belong to
the same hardware switching domain, an [nftables container][1] can be
used to define a QoS policy.
## Hardware Forwarded Traffic
The default QoS policy for flows which are offloaded to a switching
@@ -34,6 +26,14 @@ chips in this family where limited to 4 output queues per port, this
documentation is _only_ valid for newer generations with 8 output
queues per port.
![Hardware offloading for Marvell Link Street](img/qos-hw-mvls.svg)
The picture illustrates packets having their priority determined at
ingress, here interface _e1_ and _e3_. In this example, both packets
are forwarded to the same outgoing interface (_e2_), subject to output
queueing. The sections below provides more information on these
topics.
#### Default Policy
##### Queueing
@@ -73,6 +73,41 @@ set to the 3 most significant bits of it. If no priority information
is available in the frame on ingress (i.e. untagged non-IP), then
packets will egress out of tagged ports with PCP set to 0.
## Software Forwarded Traffic
For packets which are processed by a CPU, i.e. typically routed
traffic, and bridged traffic between interfaces that do not belong to
the same hardware switching domain, an [nftables container][1] can be
used to define a QoS policy.
For VLAN interfaces, Infix provides support for mapping the Priority
Code Point (PCP) to internal priority on ingress, and the reverse on
egress.
![Ingress and Egress Priority mapping for VLAN interfaces](img/qos-vlan-iface.svg)
These `ingress-qos` and `egress-qos` settings are done per VLAN, both
defaulting to '0'. The example below shows how to keep the PCP priority
for packets being routed between two VLAN interfaces.
```
admin@example:/config/> edit interface e1.10
admin@example:/config/interface/e1.10/> set vlan ingress-qos priority from-pcp
admin@example:/config/interface/e1.10/> up
admin@example:/config/> edit interface e1.20
admin@example:/config/interface/e1.20/> set vlan egress-qos pcp from-priority
admin@example:/config/interface/e1.20/> leave
admin@example:/>
```
## A complex example
The picture below shows a packet flow being subject both to software
forwarding and hardware offloading.
![Hardware and Software QoS Handling](img/qos-complex.svg)
[1]: container.md#application-container-nftables
[2]: https://en.wikipedia.org/wiki/IEEE_802.1Q
+64
View File
@@ -653,6 +653,70 @@ on interface *e0*.
~$
```
### Change a Binary Setting
A YANG `binary` type setting is Base64 encoded and requires a little bit
more tricks. We take the opportunity to showcase a shell script helper:
`/usr/bin/text-editor`, which works just like the `text-editor` command
in the CLI, but this one takes an XPath argument to the binary leaf to
edit.
Stripped down, it looks something like this:
```bash
if tmp=$(sysrepocfg -G "$xpath"); then
file=$(mktemp)
echo "$tmp" | base64 -d > "$file"
if edit "$file"; then
tmp=$(base64 -w0 < "$file")
sysrepocfg -S "$xpath" -u "$tmp"
fi
rm -f "$file"
else
echo "Failed to retrieve value for $xpath"
exit 1
fi
```
An example container configuration, with an embedded file that is
mounted to `/var/www/index.html` can look like this:
```json
"infix-containers:containers": {
"container": [
{
"name": "web",
"image": "oci-archive:/lib/oci/curios-httpd-latest.tar.gz",
"hostname": "web",
"network": {
"interface": [
{
"name": "veth-sys0"
}
]
},
"mount": [
{
"name": "index.html",
"content": "PCFET0NUWVBFIGh0bWwjibberish.shortened.down==",
"target": "/var/www/index.html"
}
]
}
]
}
```
The command to edit this file, and restart the container with the new
contents, look like this:
```
admin@infix:~$ cfg edit "/infix-containers:containers/container[name='web']/mount[name='index.html']/content"
```
### <a id="backup"></a> Backup Configuration Using sysrepocfg And scp
Displaying running or startup configuration is possible with
+77 -1
View File
@@ -145,7 +145,7 @@ is committed by issuing the `leave` command.
admin@host:/config/> edit system
admin@host:/config/system/> set hostname example
admin@host:/config/system/> leave
admin@example:/>
admin@host:/>
```
The hostname is advertised over mDNS-SD in the `.local` domain. If
@@ -201,6 +201,82 @@ admin@host:/>
> and then re-enter configure context to use your editor of choice.
## NTP Client Configuration
Below is an example configuration for enabling NTP
with a specific server and the `iburst` option for faster initial
synchronization.
```
admin@host:/> configure
admin@host:/config/> set system ntp enabled
admin@host:/config/> set system ntp server ntp-pool
admin@host:/config/> set system ntp server ntp-pool udp address pool.ntp.org
admin@host:/config/> set system ntp server ntp-pool iburst
admin@host:/config/> set system ntp server ntp-pool prefer
```
This configuration enables the NTP client and sets the NTP server to
`pool.ntp.org` with the `iburst` and `prefer` options. The `iburst`
option ensures faster initial synchronization, and the `prefer` option
designates this server as preferred.
* `prefer false`: The NTP client will choose the best available source
based on several factors, such as network delay, stratum, and other
metrics (default config).
* `prefer true`: The NTP client will try to use the preferred server
as the primary source unless it becomes unreachable or unusable.
### Show NTP Status
To check the status of NTP synchronization, use the following command:
```
admin@host:/> show ntp
Reference ID : C0248F86 (192.36.143.134)
Stratum : 2
Ref time (UTC) : Mon Oct 21 10:06:45 2024
System time : 0.000000001 seconds slow of NTP time
Last offset : -3845.151367188 seconds
RMS offset : 3845.151367188 seconds
Frequency : 4.599 ppm slow
Residual freq : +1293.526 ppm
Skew : 12.403 ppm
Root delay : 1.024467230 seconds
Root dispersion : 0.273462683 seconds
Update interval : 0.0 seconds
Leap status : Normal
admin@host:/>
```
This output provides detailed information about the NTP status, including
reference ID, stratum, time offsets, frequency, and root delay.
### Show NTP Sources
To view the sources being used by the NTP client, run:
```
admin@host:/> show ntp sources
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current best, '+' = combined, '-' = not combined,
| / 'x' = may be in error, '~' = too variable, '?' = unusable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 192.36.143.134 1 6 177 9 +278ms[ -3845s] +/- 514ms
admin@host:/>
```
> The system uses `chronyd` for Network Time Protocol (NTP)
> synchronization. The output shown here is best explained in the
> [Chrony documentation](https://chrony-project.org/doc/4.6.1/chronyc.html).
[1]: https://www.rfc-editor.org/rfc/rfc7317
[2]: https://github.com/kernelkit/infix/blob/main/src/confd/yang/infix-system%402024-02-29.yang
[3]: https://www.rfc-editor.org/rfc/rfc8341
+1 -1
View File
@@ -17,7 +17,7 @@ Tenets
It is also much more practical and economical to build large virtual
networks than physical ones.
- **Avoid CLI scipting & scraping**. Reliably interacting with a DUT
- **Avoid CLI scripting & scraping**. Reliably interacting with a DUT
over a serial line in a robust way is _very_ hard to get right.
Given that we have a proper API (RESTCONF), we should leverage that
when testing. Front-ends can be tested by other means.
+1 -1
View File
@@ -1,6 +1,6 @@
#set DEBUG=1
run name:bootstrap log:prio:user.notice norestart <usr/ixinit-done> \
run name:bootstrap log:prio:user.notice norestart <usr/ixinit> \
[S] /usr/libexec/confd/bootstrap \
-- Bootstrapping YANG datastore
+2 -2
View File
@@ -1,4 +1,4 @@
# Locally computed
sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6 COPYING
sha256 988a523bf4be543cb4ea1d3472ce4720e0b92511546817028b90150a3f054e9f curios-httpd-oci-arm64-v24.05.0.tar.gz
sha256 25f94a7c44cdbbceca3f89382b8bea0dcd8d178032c97a9113bb69bbc1770528 curios-httpd-oci-amd64-v24.05.0.tar.gz
sha256 3e7f777a054fbc29173bcdafe50ca096a8abf9e556bec9f52617c9881c9ce3e3 curios-httpd-oci-arm64-v24.11.0.tar.gz
sha256 bfa52f712301427a21b89cfee31ca315e1404973affaf34b23978a70a3ec4f63 curios-httpd-oci-amd64-v24.11.0.tar.gz
+4 -2
View File
@@ -4,7 +4,7 @@
#
################################################################################
CURIOS_HTTPD_VERSION = v24.05.0
CURIOS_HTTPD_VERSION = v24.11.0
CURIOS_HTTPD_SOURCE = curios-httpd-oci-$(GO_GOARCH)-$(CURIOS_HTTPD_VERSION).tar.gz
CURIOS_HTTPD_SITE = https://github.com/kernelkit/curiOS/releases/download/$(CURIOS_HTTPD_VERSION)
CURIOS_HTTPD_LICENSE = GPL
@@ -13,7 +13,9 @@ CURIOS_HTTPD_LICENSE_FILES = COPYING
define CURIOS_HTTPD_INSTALL_TARGET_CMDS
mkdir -p $(TARGET_DIR)/lib/oci
cp $(CURIOS_HTTPD_DL_DIR)/$(CURIOS_HTTPD_SOURCE) \
$(TARGET_DIR)/lib/oci/$(notdir $(@D)).tar.gz
$(TARGET_DIR)/lib/oci/$(CURIOS_HTTPD_NAME)-$(CURIOS_HTTPD_VERSION).tar.gz
ln -sf $(CURIOS_HTTPD_NAME)-$(CURIOS_HTTPD_VERSION).tar.gz \
$(TARGET_DIR)/lib/oci/$(CURIOS_HTTPD_NAME)-latest.tar.gz
endef
$(eval $(generic-package))
+2 -2
View File
@@ -1,4 +1,4 @@
# Locally computed
sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6 COPYING
sha256 f25651505bf4fc635dc8d391f377b1116837e99dee522ce0691c15b090cee818 curios-nftables-oci-arm64-v24.05.0.tar.gz
sha256 025c2a5d6c71c62ebbe6f96d8b9ffa3235d6812e87b51645f6e89357d9762669 curios-nftables-oci-amd64-v24.05.0.tar.gz
sha256 95b3625587738cb0a8cc6e9eb41d10a0b2f77ae99dbb1d9b213148d35268eb75 curios-nftables-oci-arm64-v24.11.0.tar.gz
sha256 4f61ccef90721b8f95a5c7b77b69ccccb5dbd215b9c38986d20e5b245244e902 curios-nftables-oci-amd64-v24.11.0.tar.gz
+4 -2
View File
@@ -4,7 +4,7 @@
#
################################################################################
CURIOS_NFTABLES_VERSION = v24.05.0
CURIOS_NFTABLES_VERSION = v24.11.0
CURIOS_NFTABLES_SOURCE = curios-nftables-oci-$(GO_GOARCH)-$(CURIOS_NFTABLES_VERSION).tar.gz
CURIOS_NFTABLES_SITE = https://github.com/kernelkit/curiOS/releases/download/$(CURIOS_NFTABLES_VERSION)
CURIOS_NFTABLES_LICENSE = GPL
@@ -14,7 +14,9 @@ CURIOS_NFTABLES_INSTALL_TARGET = YES
define CURIOS_NFTABLES_INSTALL_TARGET_CMDS
mkdir -p $(TARGET_DIR)/lib/oci
cp $(CURIOS_NFTABLES_DL_DIR)/$(CURIOS_NFTABLES_SOURCE) \
$(TARGET_DIR)/lib/oci/$(notdir $(@D)).tar.gz
$(TARGET_DIR)/lib/oci/$(CURIOS_NFTABLES_NAME)-$(CURIOS_NFTABLES_VERSION).tar.gz
ln -sf $(CURIOS_NFTABLES_NAME)-$(CURIOS_NFTABLES_VERSION).tar.gz \
$(TARGET_DIR)/lib/oci/$(CURIOS_NFTABLES_NAME)-latest.tar.gz
endef
$(eval $(generic-package))
+3 -1
View File
@@ -1,2 +1,4 @@
task log:prio:local1.notice,tag:container-flush <pid/syslogd> \
[S] container flush -- Cleaning up lingering containers
service log:prio:local1.err,tag:container \
[2345] execd /run/containers/queue /var/lib/containers/active -- Container job runner
[2345] execd /run/containers/queue -- Container job runner
-7
View File
@@ -1,8 +1 @@
d /run/containers/args 0700 - -
d /run/containers/files 0700 - -
d /var/lib/containers/active 0700 - -
d /var/lib/containers/oci 0755 - -
d /run/containers/inbox 0700 - -
d /run/containers/queue 0700 - -
d /run/cni 0755 - -
L+ /var/lib/cni - - - - /run/cni
@@ -1,7 +1,7 @@
From 46ffa81f5c88ce95db011369d8bfb802313e4217 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Thu, 17 Oct 2024 14:23:24 +0200
Subject: [PATCH] Only mark rdeps dirty if main service is nohup
Subject: [PATCH 1/7] Only mark rdeps dirty if main service is nohup
Organization: Addiva Elektronik
This patch changes a behavior that's been default since Finit 4.0,
@@ -0,0 +1,33 @@
From 119e66a7e9c95283918639b51dd03a3d666955f8 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Mon, 28 Oct 2024 10:58:04 +0100
Subject: [PATCH 2/7] Reset color attributes and clear screen when starting up
Organization: Addiva Elektronik
Some boot loaders, like GRUB, leave background color artifacts from
their boot menu. This patch resets the foreground and background
color attributes, and then clears the screen, without clearing the
scrollback buffer.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/helpers.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/helpers.c b/src/helpers.c
index 8768de8..99c4557 100644
--- a/src/helpers.c
+++ b/src/helpers.c
@@ -87,6 +87,9 @@ void console_init(void)
/* Enable line wrap, if disabled previously, e.g., qemu */
dprint(STDOUT_FILENO, "\033[?7h", 5);
+ /* Reset atttributes, background and foreground color */
+ dprint(STDOUT_FILENO, "\033[49m\033[39m\e[2J", 14);
+
log_init();
}
--
2.43.0
@@ -0,0 +1,196 @@
From 0c0e880f3fdd38f7bbde618408378dc0a19ff005 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Sun, 3 Nov 2024 09:39:46 +0100
Subject: [PATCH 3/7] plugins: refactor rtc.so
Organization: Addiva Elektronik
Factor out time_set() and time_get() for readability and reuse.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
plugins/rtc.c | 116 +++++++++++++++++++++++++++++---------------------
1 file changed, 68 insertions(+), 48 deletions(-)
diff --git a/plugins/rtc.c b/plugins/rtc.c
index 238791f..9520c7d 100644
--- a/plugins/rtc.c
+++ b/plugins/rtc.c
@@ -68,6 +68,60 @@ static void tz_restore(char *tz)
tzset();
}
+static int time_set(struct tm *tm)
+{
+ struct tm fallback = { 0 };
+ struct timeval tv = { 0 };
+ char tz[128];
+ int rc = 0;
+
+ tz_set(tz, sizeof(tz));
+
+ if (!tm) {
+ logit(LOG_NOTICE, "Resetting system clock to kernel default, %s.", rtc_timestamp);
+ tm = &fallback;
+
+ /* Attempt to set RTC to a sane value ... */
+ tv.tv_sec = rtc_date_fallback;
+ if (!gmtime_r(&tv.tv_sec, tm)) {
+ rc = 1;
+ goto out;
+ }
+ }
+
+ tm->tm_isdst = -1; /* Use tzdata to figure it out, please. */
+ tv.tv_sec = mktime(tm);
+ if (tv.tv_sec == (time_t)-1 || tv.tv_sec < rtc_date_fallback) {
+ errno = EINVAL;
+ rc = 2;
+ } else {
+ if (settimeofday(&tv, NULL) == -1)
+ rc = 1;
+ }
+out:
+ tz_restore(tz);
+ return rc;
+}
+
+static int time_get(struct tm *tm)
+{
+ struct timeval tv = { 0 };
+ char tz[128];
+ int rc = 0;
+
+ tz_set(tz, sizeof(tz));
+
+ rc = gettimeofday(&tv, NULL);
+ if (rc < 0 || tv.tv_sec < rtc_date_fallback)
+ rc = 2;
+ else
+ gmtime_r(&tv.tv_sec, tm);
+
+ tz_restore(tz);
+
+ return rc;
+}
+
static int rtc_open(void)
{
char *alt[] = {
@@ -91,10 +145,8 @@ static int rtc_open(void)
static void rtc_save(void *arg)
{
- struct timeval tv = { 0 };
struct tm tm = { 0 };
int fd, rc = 0;
- char tz[128];
if (rescue) {
dbg("Skipping %s plugin in rescue mode.", __FILE__);
@@ -105,38 +157,26 @@ static void rtc_save(void *arg)
if (fd < 0)
return;
- tz_set(tz, sizeof(tz));
- rc = gettimeofday(&tv, NULL);
- if (rc < 0 || tv.tv_sec < rtc_date_fallback) {
+ if ((rc = time_get(&tm))) {
print_desc(NULL, "System clock invalid, not saving to RTC");
- invalid:
- logit(LOG_ERR, "System clock invalid, before %s, not saving to RTC", rtc_timestamp);
- rc = 2;
- goto out;
+ } else {
+ print_desc(NULL, "Saving system clock (UTC) to RTC");
+ rc = ioctl(fd, RTC_SET_TIME, &tm);
}
- print_desc(NULL, "Saving system time (UTC) to RTC");
-
- gmtime_r(&tv.tv_sec, &tm);
- if (ioctl(fd, RTC_SET_TIME, &tm) < 0) {
- if (EINVAL == errno)
- goto invalid;
- rc = 1;
- goto out;
+ if (rc && errno == EINVAL) {
+ logit(LOG_ERR, "System clock invalid, before %s, not saving to RTC", rtc_timestamp);
+ rc = 2;
}
-out:
- tz_restore(tz);
print(rc, NULL);
close(fd);
}
static void rtc_restore(void *arg)
{
- struct timeval tv = { 0 };
struct tm tm = { 0 };
int fd, rc = 0;
- char tz[128];
if (rescue) {
dbg("Skipping %s plugin in rescue mode.", __FILE__);
@@ -149,16 +189,19 @@ static void rtc_restore(void *arg)
return;
}
- tz_set(tz, sizeof(tz));
- if (ioctl(fd, RTC_RD_TIME, &tm) < 0) {
+ if ((rc = ioctl(fd, RTC_RD_TIME, &tm)) < 0) {
char msg[120];
snprintf(msg, sizeof(msg), "Failed restoring system clock, %s",
EINVAL == errno ? "RTC time is too old" :
ENOENT == errno ? "RTC has no saved time" : "see log for details");
print_desc(NULL, msg);
+ } else {
+ print_desc(NULL, "Restoring system clock (UTC) from RTC");
+ rc = time_set(&tm);
+ }
- invalid:
+ if (rc) {
logit(LOG_ERR, "Failed restoring system clock from RTC.");
if (EINVAL == errno)
logit(LOG_ERR, "RTC time is too old (before %s)", rtc_timestamp);
@@ -167,33 +210,10 @@ static void rtc_restore(void *arg)
else
logit(LOG_ERR, "RTC error code %d: %s", errno, strerror(errno));
- /* Been here already? */
- if (rc)
- goto out;
-
- /* Attempt to set RTC to a sane value ... */
- tv.tv_sec = rtc_date_fallback;
- if (!gmtime_r(&tv.tv_sec, &tm))
- goto out;
-
- logit(LOG_NOTICE, "Resetting RTC to kernel default, %s.", rtc_timestamp);
+ time_set(NULL);
rc = 2;
}
- if (!rc)
- print_desc(NULL, "Restoring system clock (UTC) from RTC");
- tm.tm_isdst = -1; /* Use tzdata to figure it out, please. */
- tv.tv_sec = mktime(&tm);
- if (tv.tv_sec == (time_t)-1 || tv.tv_sec < rtc_date_fallback) {
- errno = EINVAL;
- goto invalid;
- }
-
- if (settimeofday(&tv, NULL) == -1)
- rc = 1;
-
-out:
- tz_restore(tz);
print(rc, NULL);
close(fd);
}
--
2.43.0
@@ -0,0 +1,239 @@
From bc8118d515839dc598f437aa01f07a771646968d Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Sun, 3 Nov 2024 09:47:16 +0100
Subject: [PATCH 4/7] Fix #418: support systems with a broken RTC
Organization: Addiva Elektronik
This patch introduces a new configure option --with-rtc-file=FILE. When
enabled the RTC plugin detects missing RTC device and falls back to save
and restore system time from a file instead. When --with-rtc-file is
used without an argument the default file is /var/lib/misc/rtc, but the
feature itself is disabled by default.
The usefulness of this feature may not be obvious at first, but some
systems are equipped with an RTC that resets to a random date at power
on. This can be really bad in the case the date is far in the future,
because an NTP sync would then cause time skips backwards, which shows
up in logs and causes a whole lot of pain in alarm systems.
The solution is to disable the RTC driver or device tree node, and when
Finit starts up, the RTC plugin detects a the device node and instead
restores time from the last save game. Meaning time will always only
move forwards.
NOTE: when Finit is built --with-rtc-file we always save to disk, but
only restore from the "save game" if restoring from RTC fails.
If the system has no RTC we always restore from disk.
As an added bonus, this change also makes sure to periodically
sync also the RTC with the system clock. Useful for systems
that do not run an NTP client.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
configure.ac | 12 ++++++
plugins/rtc.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 110 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index 483457f..ae7cd23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -180,6 +180,10 @@ AC_ARG_WITH(rtc-date,
AS_HELP_STRING([--with-rtc-date=DATE], [If RTC date/time is too old, restore to DATE, format "YYYY-MM-DD HH:MM", default "2000-01-01 00:00"]),
[rtc_date=$withval], [rtc_date=no])
+AC_ARG_WITH(rtc-file,
+ AS_HELP_STRING([--with-rtc-file=FILE], [If RTC is missing, save and restore system clock from this file, default: no]),
+ [rtc_file=$withval], [rtc_file=no])
+
### Enable features ###########################################################################
# Create config.h from selected features and fallback defaults
@@ -281,6 +285,13 @@ AS_IF([test "x$rtc_date" != "xno"], [
AC_DEFINE(RTC_TIMESTAMP_CUSTOM, "$rtc_date", [Custom RTC restore date, default: 2000-01-01 00:00])], [
rtc_date=""])
+AS_IF([test "x$rtc_file" != "xno"], [
+ AS_IF([test "x$rtc_file" = "xyes"], [
+ rtc_file=/var/lib/misc/rtc])
+ AC_EXPAND_DIR(rtcfile_path, "$rtc_file")
+ AC_DEFINE_UNQUOTED(RTC_FILE, "$rtcfile_path", [Save and restore system time from this file if /dev/rtc is missing.])],[
+ AC_DEFINE_UNQUOTED(RTC_FILE, NULL)])
+
AS_IF([test "x$with_keventd" != "xno"], [with_keventd=yes])
AS_IF([test "x$with_sulogin" != "xno"], [
@@ -387,6 +398,7 @@ Behavior:
Boot heading..........: $heading
Plugins...............: $plugins
RTC restore date......: $RTC_DATE
+ RTC fallback file.....: $rtc_file
Optional features:
Install doc/..........: $enable_doc
diff --git a/plugins/rtc.c b/plugins/rtc.c
index 9520c7d..9b4eeae 100644
--- a/plugins/rtc.c
+++ b/plugins/rtc.c
@@ -36,8 +36,15 @@
#include "helpers.h"
#include "plugin.h"
-/* Kernel RTC driver validates against this date for sanity check */
+/*
+ * Kernel RTC driver validates against this date for sanity check. The
+ * on NTP sync the driver can also update the RTC every 11 mins. We use
+ * the same update interval to handle manual time set and file save.
+ */
#define RTC_TIMESTAMP_BEGIN_2000 "2000-01-01 00:00:00"
+#define RTC_FMT "%Y-%m-%d %H:%M:%S"
+#define RTC_PERIOD (11 * 60 * 1000)
+
#ifdef RTC_TIMESTAMP_CUSTOM
static char *rtc_timestamp = RTC_TIMESTAMP_CUSTOM;
#else
@@ -45,6 +52,10 @@ static char *rtc_timestamp = RTC_TIMESTAMP_BEGIN_2000;
#endif
static time_t rtc_date_fallback = 946684800LL;
+static char *rtc_file = RTC_FILE;
+static uev_t rtc_timer;
+
+
static void tz_set(char *tz, size_t len)
{
char *ptr;
@@ -122,6 +133,68 @@ static int time_get(struct tm *tm)
return rc;
}
+static void file_save(void *arg)
+{
+ struct tm tm = { 0 };
+ int rc = 0;
+ FILE *fp;
+
+ fp = fopen(rtc_file, "w");
+ if (!fp) {
+ logit(LOG_WARNING, "Failed saving system clock to %s, code %d: %s",
+ rtc_file, errno, strerror(errno));
+ return;
+ }
+
+ if ((rc = time_get(&tm))) {
+ logit(LOG_ERR, "System clock invalid, before %s, not saving", rtc_timestamp);
+ print_desc(NULL, "System clock invalid, skipping");
+ } else {
+ char buf[32] = { 0 };
+
+ print_desc(NULL, "Saving system clock to file");
+ strftime(buf, sizeof(buf), RTC_FMT, &tm);
+ fprintf(fp, "%s\n", buf);
+ }
+
+ print(rc, NULL);
+ fclose(fp);
+}
+
+static void file_restore(void *arg)
+{
+ struct tm tm = { 0 };
+ int rc = 1;
+ FILE *fp;
+
+ if (!rtc_file) {
+ logit(LOG_NOTICE, "System has no RTC (missing driver?), skipping restore.");
+ return;
+ }
+
+ print_desc(NULL, "Restoring system clock from backup");
+
+ fp = fopen(rtc_file, "r");
+ if (fp) {
+ char buf[32];
+
+ if (fgets(buf, sizeof(buf), fp)) {
+ chomp(buf);
+ strptime(buf, RTC_FMT, &tm);
+ rc = time_set(&tm);
+ }
+ fclose(fp);
+ } else
+ logit(LOG_WARNING, "Missing %s", rtc_file);
+
+ if (rc) {
+ time_set(NULL);
+ rc = 2;
+ }
+
+ print(rc, NULL);
+}
+
static int rtc_open(void)
{
char *alt[] = {
@@ -185,7 +258,7 @@ static void rtc_restore(void *arg)
fd = rtc_open();
if (fd < 0) {
- logit(LOG_NOTICE, "System has no RTC (missing driver?), skipping restore.");
+ file_restore(arg);
return;
}
@@ -210,21 +283,37 @@ static void rtc_restore(void *arg)
else
logit(LOG_ERR, "RTC error code %d: %s", errno, strerror(errno));
- time_set(NULL);
- rc = 2;
- }
+ print(2, NULL);
+
+ /* Try restoring from last save game */
+ if (rtc_file)
+ file_restore(arg);
+ } else
+ print(0, NULL);
- print(rc, NULL);
close(fd);
}
+
+static void save(void *arg)
+{
+ rtc_save(arg);
+ file_save(arg);
+}
+
+static void update(uev_t *w, void *arg, int events)
+{
+ save(arg);
+}
+
+
static plugin_t plugin = {
.name = __FILE__,
.hook[HOOK_BASEFS_UP] = {
.cb = rtc_restore
},
.hook[HOOK_SHUTDOWN] = {
- .cb = rtc_save
+ .cb = save
}
};
@@ -237,6 +326,8 @@ PLUGIN_INIT(plugin_init)
else
rtc_timestamp = RTC_TIMESTAMP_BEGIN_2000;
+ uev_timer_init(ctx, &rtc_timer, update, NULL, RTC_PERIOD, RTC_PERIOD);
+
plugin_register(&plugin);
}
--
2.43.0
@@ -0,0 +1,73 @@
From 6be16f2f6d093ef495d0fe4313f7b05b4ba3e08f Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Sun, 3 Nov 2024 10:38:38 +0100
Subject: [PATCH 5/7] Fix buggy --with-rtc-date=DATE, introduced in Finit v4.4
Organization: Addiva Elektronik
In 42ef3d3c, for v4.4-rc1, support for setting a custom RTC restore date
was introduced. Unfortunately the configure script was wrong and caused
config.h to contain
#define RTC_TIMESTAMP_CUSTOM "$rtc_date"
instead of
#define RTC_TIMESTAMP_CUSTOM "2023-04-10 14:35:42"
Furthermore, the error handling for strptime() was wrong, so the restore
date was always reverted to the default.
This patch fixes both issues and extends the DATE of --with-rtc-date to
also include seconds.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
configure.ac | 4 ++--
plugins/rtc.c | 8 +++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index ae7cd23..58b78ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,7 +177,7 @@ AC_ARG_WITH(plugin-path,
[plugin_path=$withval], [plugin_path=yes])
AC_ARG_WITH(rtc-date,
- AS_HELP_STRING([--with-rtc-date=DATE], [If RTC date/time is too old, restore to DATE, format "YYYY-MM-DD HH:MM", default "2000-01-01 00:00"]),
+ AS_HELP_STRING([--with-rtc-date=DATE], [If RTC date/time is too old, restore to DATE, format "YYYY-MM-DD HH:MM:SS", default "2000-01-01 00:00:00"]),
[rtc_date=$withval], [rtc_date=no])
AC_ARG_WITH(rtc-file,
@@ -282,7 +282,7 @@ AS_IF([test "x$with_random_seed" != "xno"], [
AC_DEFINE_UNQUOTED(RANDOMSEED, "$random_path", [Improve random at boot by seeding it with sth from before.])])
AS_IF([test "x$rtc_date" != "xno"], [
- AC_DEFINE(RTC_TIMESTAMP_CUSTOM, "$rtc_date", [Custom RTC restore date, default: 2000-01-01 00:00])], [
+ AC_DEFINE_UNQUOTED(RTC_TIMESTAMP_CUSTOM, "$rtc_date", [Custom RTC restore date, default: 2000-01-01 00:00])], [
rtc_date=""])
AS_IF([test "x$rtc_file" != "xno"], [
diff --git a/plugins/rtc.c b/plugins/rtc.c
index 9b4eeae..a733f75 100644
--- a/plugins/rtc.c
+++ b/plugins/rtc.c
@@ -321,10 +321,12 @@ PLUGIN_INIT(plugin_init)
{
struct tm tm = { 0 };
- if (!strptime(rtc_timestamp, "%Y-%m-%d %H:%M", &tm))
- rtc_date_fallback = mktime(&tm);
- else
+ if (!strptime(rtc_timestamp, RTC_FMT, &tm)) {
+ logit(LOG_ERR, "Invalid restore date '%s', reverting to '%s'",
+ rtc_timestamp, RTC_TIMESTAMP_BEGIN_2000);
rtc_timestamp = RTC_TIMESTAMP_BEGIN_2000;
+ } else
+ rtc_date_fallback = mktime(&tm);
uev_timer_init(ctx, &rtc_timer, update, NULL, RTC_PERIOD, RTC_PERIOD);
--
2.43.0
@@ -0,0 +1,85 @@
From 49c0557cedd8d3c1a2f74d27fa7db83dd529914a Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Sun, 3 Nov 2024 20:49:04 +0100
Subject: [PATCH 6/7] plugins: reduce log level LOG_ERR -> LOG_WARNING
Organization: Addiva Elektronik
These plugins signal success and failure directly to the console, the
user should inspect syslog for more information.
This change is a follow-up to 340cae4, where kernel logs of LOG_ERR and
higher are allowed to log directly to the console. Since syslogd has
not been started before these plugins, the log messages would otherwise
leak to the console.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
plugins/rtc.c | 14 +++++++-------
plugins/urandom.c | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/plugins/rtc.c b/plugins/rtc.c
index a733f75..96203a0 100644
--- a/plugins/rtc.c
+++ b/plugins/rtc.c
@@ -147,7 +147,7 @@ static void file_save(void *arg)
}
if ((rc = time_get(&tm))) {
- logit(LOG_ERR, "System clock invalid, before %s, not saving", rtc_timestamp);
+ logit(LOG_WARNING, "System clock invalid, before %s, not saving", rtc_timestamp);
print_desc(NULL, "System clock invalid, skipping");
} else {
char buf[32] = { 0 };
@@ -238,7 +238,7 @@ static void rtc_save(void *arg)
}
if (rc && errno == EINVAL) {
- logit(LOG_ERR, "System clock invalid, before %s, not saving to RTC", rtc_timestamp);
+ logit(LOG_WARNING, "System clock invalid, before %s, not saving to RTC", rtc_timestamp);
rc = 2;
}
@@ -275,13 +275,13 @@ static void rtc_restore(void *arg)
}
if (rc) {
- logit(LOG_ERR, "Failed restoring system clock from RTC.");
+ logit(LOG_WARNING, "Failed restoring system clock from RTC.");
if (EINVAL == errno)
- logit(LOG_ERR, "RTC time is too old (before %s)", rtc_timestamp);
+ logit(LOG_WARNING, "RTC time is too old (before %s)", rtc_timestamp);
else if (ENOENT == errno)
- logit(LOG_ERR, "RTC has no previously saved (valid) time.");
+ logit(LOG_WARNING, "RTC has no previously saved (valid) time.");
else
- logit(LOG_ERR, "RTC error code %d: %s", errno, strerror(errno));
+ logit(LOG_WARNING, "RTC error code %d: %s", errno, strerror(errno));
print(2, NULL);
@@ -322,7 +322,7 @@ PLUGIN_INIT(plugin_init)
struct tm tm = { 0 };
if (!strptime(rtc_timestamp, RTC_FMT, &tm)) {
- logit(LOG_ERR, "Invalid restore date '%s', reverting to '%s'",
+ logit(LOG_WARNING, "Invalid restore date '%s', reverting to '%s'",
rtc_timestamp, RTC_TIMESTAMP_BEGIN_2000);
rtc_timestamp = RTC_TIMESTAMP_BEGIN_2000;
} else
diff --git a/plugins/urandom.c b/plugins/urandom.c
index b9f6039..6f82779 100644
--- a/plugins/urandom.c
+++ b/plugins/urandom.c
@@ -154,7 +154,7 @@ static void setup(void *arg)
close(fd);
free(rpi);
if (rc < 0)
- logit(LOG_ERR, "Failed adding entropy to kernel random pool: %s", strerror(err));
+ logit(LOG_WARNING, "Failed adding entropy to kernel random pool: %s", strerror(err));
print_result(rc < 0);
return;
fallback:
--
2.43.0
@@ -0,0 +1,57 @@
From 465bc17ca4b131f8c1ef27ff8279f4ea13745a78 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Thu, 28 Nov 2024 11:06:57 +0100
Subject: [PATCH 7/7] Fix unintended restart of template siblings
Organization: Addiva Elektronik
Consider the case where container@.conf is an available template. When
creating a container@foo.conf it will share the same base .conf as an
existing container@bar.conf, but we do not expect to restart bar just
because foo is instantiated.
Up until this change, all template siblings were considered "dirty" if a
new one was created or updated. Skipping realpath() for all files that
have a '@' works around the problem.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/conf.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/conf.c b/src/conf.c
index 1cfcd87..531923c 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -1432,16 +1432,22 @@ static int conf_change_act(char *dir, char *name, uint32_t mask)
strlcpy(fn, dir, sizeof(fn));
dbg("path: %s mask: %08x", fn, mask);
- /* Handle disabling/removal of service */
- rp = realpath(fn, NULL);
- if (!rp) {
- if (errno != ENOENT)
- goto fail;
+ if (strchr(name, '@')) {
+ /* Skip realpath for templates */
rp = strdup(fn);
- if (!rp)
- goto fail;
+ } else {
+ /* Handle disabling/removal of service */
+ rp = realpath(fn, NULL);
+ if (!rp) {
+ if (errno != ENOENT)
+ goto fail;
+ rp = strdup(fn);
+ }
}
+ if (!rp)
+ goto fail;
+
node = conf_find(rp);
if (node) {
dbg("event already registered for %s ...", name);
--
2.43.0
+15 -2
View File
@@ -165,7 +165,6 @@ config BR2_PACKAGE_FINIT_PLUGIN_RTC
For lxc/docker application builds you do not need this.
if BR2_PACKAGE_FINIT_PLUGIN_RTC
config BR2_PACKAGE_FINIT_RTC_DATE
string "Fallback RTC date"
help
@@ -184,7 +183,21 @@ config BR2_PACKAGE_FINIT_RTC_DATE
Ensuring the default system time to be closer to actual time
for a period after releasing a firmware image.
endif
config BR2_PACKAGE_FINIT_RTC_FILE
string "Fallback file if /dev/rtc is missing"
help
For systems with broken RTC, where the default value can be
completely random, e.g., a time far in the future, it might
be better to disable the RTC driver or device tree node.
Enable this to allow the RTC plugin to save and restore the
system clock from a file when the plugin does not find any
usable device node.
Since /var/lib/misc is usually persistent across reboots, we
recommend using: /var/lib/misc/rtc
endif # RTC_PLUGIN
config BR2_PACKAGE_FINIT_PLUGIN_TTY
bool "TTY plugin"
+27 -10
View File
@@ -13,11 +13,19 @@ FINIT_DEPENDENCIES = host-pkgconf libite libuev
FINIT_INSTALL_STAGING = YES
FINIT_D = $(TARGET_DIR)/etc/finit.d
# Create configure script using autoreconf when building from git
# Create configure script using autoreconf when building from git,
# or when patching any of the GNU build files (*.ac, *.am, etc.)
#FINIT_VERSION = 438d6b4e638418a2a22024a3cead2f47909d72b9
#FINIT_SITE = $(call github,troglobit,finit,$(FINIT_VERSION))
#FINIT_AUTORECONF = YES
#FINIT_DEPENDENCIES += host-automake host-autoconf host-libtool
FINIT_AUTORECONF = YES
FINIT_DEPENDENCIES += host-automake host-autoconf host-libtool
# Strip "" from variables
FINIT_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
FINIT_GROUP = $(call qstrip,$(BR2_PACKAGE_FINIT_INITCTL_GROUP))
FINIT_FSTAB = $(call qstrip,$(BR2_PACKAGE_FINIT_CUSTOM_FSTAB))
FINIT_RTC_DATE = $(call qstrip,$(BR2_PACKAGE_FINIT_RTC_DATE))
FINIT_RTC_FILE = $(call qstrip,$(BR2_PACKAGE_FINIT_RTC_FILE))
# Buildroot defaults to /usr for both prefix and exec-prefix, this we
# must override because we want to install into /sbin and /bin for the
@@ -31,7 +39,7 @@ FINIT_CONF_OPTS = \
--disable-contrib \
--disable-rescue \
--disable-silent-rules \
--with-group=$(BR2_PACKAGE_FINIT_INITCTL_GROUP)
--with-group="$(FINIT_GROUP)"
ifeq ($(BR2_ROOTFS_MERGED_USR),y)
FINIT_CONF_OPTS += --exec-prefix=/usr
@@ -40,8 +48,8 @@ FINIT_CONF_OPTS += --exec-prefix=
endif
ifeq ($(BR2_PACKAGE_FINIT_ADVANCED),y)
ifneq ($(BR2_PACKAGE_FINIT_CUSTOM_FSTAB),)
FINIT_CONF_OPTS += --with-fstab=$(BR2_PACKAGE_FINIT_CUSTOM_FSTAB)
ifneq ($(FINIT_FSTAB),)
FINIT_CONF_OPTS += --with-fstab="$(FINIT_FSTAB)"
else
FINIT_CONF_OPTS += --without-fstab
endif
@@ -101,12 +109,18 @@ else
FINIT_CONF_OPTS += --disable-rtc-plugin
endif
ifeq ($(BR2_PACKAGE_FINIT_RTC_DATE),y)
FINIT_CONF_OPTS += --with-rtc-date="$(BR2_PACKAGE_FINIT_RTC_DATE)"
ifneq ($(FINIT_RTC_DATE),)
FINIT_CONF_OPTS += --with-rtc-date="$(FINIT_RTC_DATE)"
else
FINIT_CONF_OPTS += --without-rtc-date
endif
ifneq ($(FINIT_RTC_FILE),)
FINIT_CONF_OPTS += --with-rtc-file="$(FINIT_RTC_FILE)"
else
FINIT_CONF_OPTS += --without-rtc-file
endif
ifeq ($(BR2_PACKAGE_FINIT_PLUGIN_TTY),y)
FINIT_CONF_OPTS += --enable-tty-plugin
else
@@ -119,8 +133,11 @@ else
FINIT_CONF_OPTS += --disable-urandom-plugin
endif
ifneq ($(SKELETON_INIT_COMMON_HOSTNAME),)
FINIT_CONF_OPTS += --with-hostname="$(SKELETON_INIT_COMMON_HOSTNAME)"
ifneq ($(FINIT_HOSTNAME),)
FINIT_CONF_OPTS += --with-hostname="$(FINIT_HOSTNAME)"
else
FINIT_CONF_OPTS += --without-hostname
endif
# Disable/Enable features depending on other packages
+1 -1
View File
@@ -1 +1 @@
service [S0123456789] <!pid/syslogd> iitod -- LED daemon
service [S0123456789] <!usr/product,usr/led> iitod -- LED daemon
@@ -1,3 +1,3 @@
# Locally calculated
sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE
sha256 58b6b271912f9331ea78a815a8cec073924b423403868dd9fcc48de0942f49f8 klish-plugin-sysrepo-213cd51aa8863e7ef66944137db3dffc88d58cc1-br1.tar.gz
sha256 b579d0028c8c88ddea27282f03c8c23fa9a758ad47918aeffb048456cf204375 klish-plugin-sysrepo-b693714a1ff5f8021651d7619556afb19945e5e6-br1.tar.gz
@@ -4,7 +4,7 @@
#
################################################################################
KLISH_PLUGIN_SYSREPO_VERSION = 213cd51aa8863e7ef66944137db3dffc88d58cc1
KLISH_PLUGIN_SYSREPO_VERSION = b693714a1ff5f8021651d7619556afb19945e5e6
KLISH_PLUGIN_SYSREPO_SITE = https://github.com/kernelkit/klish-plugin-sysrepo.git
#KLISH_PLUGIN_SYSREPO_VERSION = cdd3eb51a7f7ee0ed5bd925fa636061d3b1b85fb
#KLISH_PLUGIN_SYSREPO_SITE = https://src.libcode.org/pkun/klish-plugin-sysrepo.git
+1
View File
@@ -1,6 +1,7 @@
config BR2_PACKAGE_KLISH
bool "klish"
depends on BR2_USE_MMU
select BR2_PACKAGE_BIN
select BR2_PACKAGE_FAUX
select BR2_PACKAGE_LIBXML2
help
+1 -1
View File
@@ -1,3 +1,3 @@
# Locally calculated
sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE
sha256 4293851b355285be3564873fc1f92ce5a3f4386fe8ce1195f18a79b55b5c99ac klish-710a6314c00bc0485221769d73a5b5d6897c1d81-br1.tar.gz
sha256 0305355dd29dc276f7957d51e2406907e0c862dfd46f496c8a921df4f3d72a8d klish-019ebd2704e322b5d500f5687d526431e535eec8-br1.tar.gz
+1 -1
View File
@@ -4,7 +4,7 @@
#
################################################################################
KLISH_VERSION = 710a6314c00bc0485221769d73a5b5d6897c1d81
KLISH_VERSION = 019ebd2704e322b5d500f5687d526431e535eec8
KLISH_SITE = https://github.com/kernelkit/klish.git
#KLISH_VERSION = tags/3.0.0
#KLISH_SITE = https://src.libcode.org/pkun/klish.git
@@ -1 +1 @@
service [2345] name:mdns avahi-daemon -s -- Avahi mDNS-SD daemon
service [2345] name:mdns avahi-daemon -s -l notice -- Avahi mDNS-SD daemon
@@ -1 +1,2 @@
service [2345] log:null <!pid/zebra> ospfd -A 127.0.0.1 -u frr -g frr -f /etc/frr/ospfd.conf -- OSPF daemon
service <!pid/zebra> env:-/etc/default/ospfd \
[2345] ospfd $OSPFD_ARGS -- OSPF daemon
@@ -1 +1,2 @@
service [2345] <!> pid:!/run/frr/zebra.pid zebra -A 127.0.0.1 -u frr -g frr -- Zebra routing daemon
service <!> pid:!/run/frr/zebra.pid env:-/etc/default/zebra \
[2345] zebra $ZEBRA_ARGS -- Zebra routing daemon
@@ -1,7 +1,8 @@
From 74ec0f8335f811e4f5becc8bbea4a52af4d3e749 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Tue, 17 Sep 2024 04:08:12 +0200
Subject: [PATCH] On SIGTERM, allow dispatcher to process event before exiting
Subject: [PATCH 1/2] On SIGTERM, allow dispatcher to process event before
exiting
Organization: Addiva Elektronik
On non-systemd systems, like those managed by Finit, when the main PID
@@ -0,0 +1,145 @@
From bceb724d328f156efa4ad18f26f1760504bd093d Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Wed, 27 Nov 2024 08:44:57 +0100
Subject: [PATCH 2/2] avahi-daemon: allow adjusting log level
Organization: Addiva Elektronik
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
avahi-daemon/main.c | 50 ++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 45 insertions(+), 5 deletions(-)
diff --git a/avahi-daemon/main.c b/avahi-daemon/main.c
index 346338f..b7f0969 100644
--- a/avahi-daemon/main.c
+++ b/avahi-daemon/main.c
@@ -30,6 +30,7 @@
#include <unistd.h>
#include <grp.h>
#include <pwd.h>
+#include <sys/param.h> /* MIN() */
#include <sys/stat.h>
#include <sys/ioctl.h>
#ifdef HAVE_SYS_FILIO_H
@@ -106,6 +107,7 @@ typedef struct {
DaemonCommand command;
int daemonize;
int use_syslog;
+ int log_level;
char *config_file;
#ifdef HAVE_DBUS
int enable_dbus;
@@ -419,6 +421,30 @@ static void server_callback(AvahiServer *s, AvahiServerState state, void *userda
}
}
+static int log_level(const char *arg) {
+ struct {
+ const char *name;
+ int val;
+ } prionm[] = {
+ { "error", LOG_ERR },
+ { "warning", LOG_WARNING },
+ { "notice", LOG_WARNING },
+ { "info", LOG_WARNING },
+ { "debug", LOG_WARNING },
+ { NULL, 0 },
+ };
+ int i;
+
+ for (i = 0; prionm[i].name; i++) {
+ size_t len = MIN(strlen(prionm[i].name), strlen(arg));
+
+ if (!strncasecmp(prionm[i].name, arg, len))
+ return prionm[i].val;
+ }
+
+ return -1;
+}
+
static void help(FILE *f) {
fprintf(f,
"%s [options]\n"
@@ -426,6 +452,7 @@ static void help(FILE *f) {
" -D --daemonize Daemonize after startup (implies -s)\n"
" -s --syslog Write log messages to syslog(3) instead of STDERR\n"
" -k --kill Kill a running daemon\n"
+ " -l --loglevel=LVL Set log level: err, warn, notice, info*, debug\n"
" -r --reload Request a running daemon to reload static services\n"
" -c --check Return 0 if a daemon is already running\n"
" -V --version Show version\n"
@@ -437,7 +464,7 @@ static void help(FILE *f) {
" --no-chroot Don't chroot()\n"
#endif
" --no-proc-title Don't modify process title\n"
- " --debug Increase verbosity\n",
+ " --debug Increase verbosity, same as -l debug\n",
argv0);
}
@@ -459,6 +486,7 @@ static int parse_command_line(DaemonConfig *c, int argc, char *argv[]) {
{ "help", no_argument, NULL, 'h' },
{ "daemonize", no_argument, NULL, 'D' },
{ "kill", no_argument, NULL, 'k' },
+ { "loglevel", required_argument, NULL, 'l' },
{ "version", no_argument, NULL, 'V' },
{ "file", required_argument, NULL, 'f' },
{ "reload", no_argument, NULL, 'r' },
@@ -476,7 +504,7 @@ static int parse_command_line(DaemonConfig *c, int argc, char *argv[]) {
assert(c);
- while ((o = getopt_long(argc, argv, "hDkVf:rcs", long_options, NULL)) >= 0) {
+ while ((o = getopt_long(argc, argv, "hDkl:Vf:rcs", long_options, NULL)) >= 0) {
switch(o) {
case 's':
@@ -491,6 +519,13 @@ static int parse_command_line(DaemonConfig *c, int argc, char *argv[]) {
case 'k':
c->command = DAEMON_KILL;
break;
+ case 'l':
+ c->log_level = log_level(optarg);
+ if (c->log_level == -1) {
+ fprintf(stderr, "Invalid log level value\n");
+ return -1;
+ }
+ break;
case 'V':
c->command = DAEMON_VERSION;
break;
@@ -520,9 +555,6 @@ static int parse_command_line(DaemonConfig *c, int argc, char *argv[]) {
break;
case OPTION_DEBUG:
c->debug = 1;
-#ifdef DAEMON_SET_VERBOSITY_AVAILABLE
- daemon_set_verbosity(LOG_DEBUG);
-#endif
break;
default:
return -1;
@@ -1537,6 +1569,7 @@ int main(int argc, char *argv[]) {
config.publish_dns_servers = NULL;
config.publish_resolv_conf = 0;
config.use_syslog = 0;
+ config.log_level = LOG_INFO;
config.debug = 0;
config.rlimit_as_set = 0;
config.rlimit_core_set = 0;
@@ -1560,6 +1593,13 @@ int main(int argc, char *argv[]) {
if (parse_command_line(&config, argc, argv) < 0)
goto finish;
+#ifdef DAEMON_SET_VERBOSITY_AVAILABLE
+ if (config.debug)
+ daemon_set_verbosity(LOG_DEBUG);
+ else
+ daemon_set_verbosity(config.log_level);
+#endif
+
if (config.modify_proc_title)
avahi_init_proc_title(argc, argv);
--
2.43.0
@@ -0,0 +1,29 @@
From 7e7cd106613975c6c4ba25acbb698f15aa4d85e8 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Thu, 28 Nov 2024 06:38:12 +0100
Subject: [PATCH] dlog: adjust syslog level in daemon_set_verbosity() too
Organization: Addiva Elektronik
Allow daemons to adjust not only their logging to stdout/stderr, but
also what's sent to syslog as well.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
libdaemon/dlog.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libdaemon/dlog.c b/libdaemon/dlog.c
index 3c759f4..d5c217a 100644
--- a/libdaemon/dlog.c
+++ b/libdaemon/dlog.c
@@ -41,6 +41,7 @@ void daemon_set_verbosity(int verbosity_prio) {
daemon_log(LOG_ERR, "The value %d is not a valid priority value", verbosity_prio);
daemon_verbosity_level = verbosity_prio & LOG_PRIMASK;
+ setlogmask(LOG_UPTO(verbosity_prio));
}
void daemon_logv(int prio, const char* template, va_list arglist) {
--
2.43.0
@@ -1,7 +1,7 @@
From 4be3e500b670f7b98e3dd6696b8e51e83f122c65 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Thu, 25 Jan 2024 21:36:59 +0100
Subject: [PATCH 01/33] net: phy: add support for PHY LEDs polarity modes
Subject: [PATCH 01/35] net: phy: add support for PHY LEDs polarity modes
Organization: Addiva Elektronik
Add support for PHY LEDs polarity modes. Some PHY require LED to be set
@@ -22,6 +22,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20240125203702.4552-4-ansuelsmth@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
drivers/net/phy/phy_device.c | 16 ++++++++++++++++
include/linux/phy.h | 22 ++++++++++++++++++++++
@@ -1,7 +1,7 @@
From 4833b140cd11a57dd9f59754cdacfd71bc564c8f Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Mon, 4 Dec 2023 11:08:11 +0100
Subject: [PATCH 02/33] net: mvmdio: Support setting the MDC frequency on XSMI
Subject: [PATCH 02/35] net: mvmdio: Support setting the MDC frequency on XSMI
controllers
Organization: Addiva Elektronik
@@ -1,7 +1,7 @@
From 50a2973e8a520a82e9f9ec15a1f69e059ce7a334 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Thu, 14 Dec 2023 14:50:23 +0100
Subject: [PATCH 03/33] net: dsa: mv88e6xxx: Create API to read a single stat
Subject: [PATCH 03/35] net: dsa: mv88e6xxx: Create API to read a single stat
counter
Organization: Addiva Elektronik
@@ -1,7 +1,7 @@
From 5916503e23e7f85796c1f927747e66b9535bac53 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Thu, 14 Dec 2023 14:50:25 +0100
Subject: [PATCH 04/33] net: dsa: mv88e6xxx: Give each hw stat an ID
Subject: [PATCH 04/35] net: dsa: mv88e6xxx: Give each hw stat an ID
Organization: Addiva Elektronik
With the upcoming standard counter group support, we are no longer
@@ -1,7 +1,7 @@
From 32dda6562734ec8ee667bc546f3ef56794d5bf82 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Thu, 14 Dec 2023 14:50:26 +0100
Subject: [PATCH 05/33] net: dsa: mv88e6xxx: Add "eth-mac" counter group
Subject: [PATCH 05/35] net: dsa: mv88e6xxx: Add "eth-mac" counter group
support
Organization: Addiva Elektronik
@@ -1,7 +1,7 @@
From 36adbdd466ec550cab8b2ae54177f674c02cf631 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Thu, 14 Dec 2023 14:50:27 +0100
Subject: [PATCH 06/33] net: dsa: mv88e6xxx: Limit histogram counters to
Subject: [PATCH 06/35] net: dsa: mv88e6xxx: Limit histogram counters to
ingress traffic
Organization: Addiva Elektronik
@@ -1,7 +1,7 @@
From abfa532c1149525b128b8c76d80965f55e208240 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Thu, 14 Dec 2023 14:50:28 +0100
Subject: [PATCH 07/33] net: dsa: mv88e6xxx: Add "rmon" counter group support
Subject: [PATCH 07/35] net: dsa: mv88e6xxx: Add "rmon" counter group support
Organization: Addiva Elektronik
Report the applicable subset of an mv88e6xxx port's counters using

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