Compare commits

..
903 Commits
Author SHA1 Message Date
Joachim Wiberg eec5546100 board/common: add missing newline at end of /etc/motd
With the changes in 9847a8f we can keep the /etc/motd file with a proper
newline at EOF so that also Classic builds make sense.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-03-01 20:19:17 +01:00
Joachim Wiberg 4451e70ba8 .github: adjust release tag variables
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-03-01 18:38:22 +01:00
Joachim Wiberg 1f29bfa5a6 .github: set 'latest' flag for non-pre-release builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-03-01 16:03:26 +01:00
Joachim Wiberg aea6ef3961 doc: update release notes for v24.02
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-03-01 14:17:20 +01:00
Joachim Wiberg 1e4a88e0b9 doc: new text-editor topic for cli
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-03-01 14:14:33 +01:00
Joachim Wiberg ba25914cbe confd: add support for changing text-editor backend
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-03-01 14:13:43 +01:00
Joachim Wiberg 84391c18a4 board/common: introduce Debian-like alternatives system
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-03-01 14:13:06 +01:00
Joachim Wiberg c73b3b59c2 doc: update CLI introduction and tutorial with new commands
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-03-01 11:30:51 +01:00
Joachim Wiberg b3e6a38d76 package/klish: bump for motd-like Banner="" extension for klish.conf
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-03-01 10:04:19 +01:00
Joachim Wiberg 9847a8fdd1 confd: migrate infix-system:motd -> infix-system:motd-banner
Inspired by openconfig-system[1], except the infix-system type is binary
to allow encoding an entire file, with optional control characters.

The openconfig-system model also carries login-banner, which is displayed
before login.  This could be added later to infix-system to let the user
set an OpenSSH login Banner.

[1]:  https://openconfig.net/projects/models/schemadocs/yangdoc/openconfig-system.html

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-03-01 10:04:19 +01:00
Joachim Wiberg 87bffb3816 confd: import base64 encode/decode functions, 3-clause BSD licensed
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-03-01 10:04:19 +01:00
jovatnandGitHub 8b44a42424 Update ChangeLog.md
Remote trailing dot (.)

[skip ci]
2024-02-29 14:33:13 +01:00
jovatnandGitHub 2e408d2ee1 Update ChangeLog.md
Include IETF Hardware data in news section.

[skip ci]
2024-02-29 14:31:03 +01:00
Joachim Wiberg 300734872c doc: minor fixups and clarfiy new port counters as augments
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-29 14:19:41 +01:00
jovatnandGitHub 6b91a6765c Update ChangeLog.md
Proposed changes to description of ietf-hardware and infix-hardware models.

[skip ci]
2024-02-29 14:08:37 +01:00
Joachim Wiberg 9ab8bd5bc9 doc: restore lost diff link
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-29 12:44:33 +01:00
Joachim Wiberg 955de32ea8 doc: prepare v24.02 release notes
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-29 12:39:42 +01:00
Joachim Wiberg b449b7ea82 Revert ".github: temporarily disable Infix Classic builds"
This reverts commit 2bcb02d3ef and thus
reeneables classic builds again.  Since we build on /mnt on the runner
there should be enough room also for them.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-29 12:16:14 +01:00
Mattias Walström f0c23ca048 Update revision for infix-if-type 2024-02-29 10:22:32 +01:00
Mattias WalströmandJoachim Wiberg c6626b6520 test: Increase timeouts for OSPF tests
This since when running the test in the cloud with github
supplied runner, everthing sometimes gets really slow.
2024-02-29 09:46:08 +01:00
Joachim Wiberg 9c203f614b confd: log error when failing to record changes to NTP client
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-29 09:14:53 +01:00
Joachim Wiberg 1df1df7096 .github: new package requirement for coverity runs
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-29 08:54:58 +01:00
Joachim Wiberg 92744b7318 statd: fix string length comparison
Calling strlen() returns a size that's one byte less than what's needed
to store the string, so when comparing with sizeof(), which returns the
number of available bytes, we must compare >= and not just >.

Found by GCC using 'make check'.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-29 08:45:23 +01:00
Joachim Wiberg be7b434d74 Update list of 'make check' packages
- new: execd, keyack
 - statd has been converted to autotools

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-29 08:44:08 +01:00
Joachim Wiberg a47e8b6d4a statd: fix library ordering for linker
When building for cppcheck/coverity we may get a stupid linker that can
wind up not finding, e.g., fexist() in libite (-lite) if it's not added
last in the list of libraries.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-29 08:42:07 +01:00
Joachim Wiberg b004f081a1 .github: check disk usage in $HOME
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-29 07:55:31 +01:00
Joachim Wiberg 06365fa3da .github: sync release job with latest changes
- Cleanup any docker images to free up space
 - Build on /mnt
 - Update artifacts: pattern after API changes
 - Add .sha256 checksums to each release tarball

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-29 07:47:54 +01:00
Joachim Wiberg 75b47b8a7a .github: adapt to new artifact action behavior
No more artifact/ subdirectory with upload/download-artifact v4,
artifacts are already in the working directory.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-29 07:17:24 +01:00
Joachim Wiberg aa039449da .github: fake it, let qemu target build in $HOME
Apparently, running "make test-qeneth" from an output directory that's
not in $HOME does not work in Azure.  This patch adds an exception for
the x86_64-netconf target that ensures regression tests run just as if
nothing had changed.

Other platform//variants will be built on /mnt for the time being since
we're running out of space in the runner:

df -h =================================================================
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        73G   58G   16G  80% /
tmpfs           7.9G  172K  7.9G   1% /dev/shm
tmpfs           3.2G  1.1M  3.2G   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda15      105M  6.1M   99M   6% /boot/efi
/dev/sdb1        74G  4.1G   66G   6% /mnt
tmpfs           1.6G   12K  1.6G   1% /run/user/1001
=======================================================================

This is the output of the new "Manny" investigator, it revealed that we
only have 16 GiB of space, after checkout and cache donwload, to build
and upload *all* platforms/variants.  Hence the cheat with /mnt, which
we honestly don't know will remain mounted on these runners.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 20:57:14 +01:00
Joachim Wiberg cd7412aea4 .github: use correct build directory variable
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 18:45:56 +01:00
Joachim Wiberg 2564d2597b .github: sudo make me a build directory
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 18:42:33 +01:00
Joachim Wiberg cb1054e4a3 .github: use /mnt as output directory for builds
- Clean up any lingering docker images
 - Redirect output to /mnt/$arch-$flavor

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 18:39:48 +01:00
Joachim Wiberg 24549d149c .github: split into multiple selectable jobs
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 18:33:22 +01:00
Mattias WalströmandJoachim Wiberg 2bf6ec7d1a test: ipv4_autoconf: Fix racecondition on slow test-PCs
Refactor test, remove fragile solution with tcpdump started AFTER
the linklocal was activated, this opened for a race condition since
it was listening for a message sent once.

Now wait for the linklocal address instead.
2024-02-28 18:25:43 +01:00
Mattias WalströmandJoachim Wiberg ac97ce01a5 test: iface: Fix bug in function address_exist()
did not allow any other protocol to checked except DHCP
2024-02-28 18:25:43 +01:00
Joachim Wiberg a730cc0439 .github: peek & poke
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 18:24:35 +01:00
Joachim Wiberg 3c8879cbdf .github: take inventory also after checkout & cache restore
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 18:18:40 +01:00
Joachim Wiberg c9dc5b928a .github: check disk
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 17:01:01 +01:00
Joachim Wiberg a9458f79b1 .github: run cleanup *after* taking inventory
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 15:35:49 +01:00
Joachim Wiberg 1b1ca208e1 .github: give Manny a broom
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 15:34:03 +01:00
Joachim Wiberg 5ee342849d .github: add warehouse manager
TODO: add optional cleanup input argument.

[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 15:09:41 +01:00
Joachim WibergandMattias Walström 2bcb02d3ef .github: temporarily disable Infix Classic builds
Debugging build/runner problems with GitHub Actions.  Resolution pending
self-hosted runner becoming operational.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 13:55:57 +01:00
Joachim WibergandMattias Walström c1787622a1 test: fix running on systems without /dev/kvm
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 13:55:57 +01:00
Joachim WibergandMattias Walström e0f97b1840 .github: run regression tests only once, either push or pull-request
Currently the regression tests runs twice when branches and PR:s originate
from the same repo.  This commit adopts a fix suggested at

https://wildwolf.name/github-actions-how-to-avoid-running-the-same-workflow-multiple-times/

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 13:55:57 +01:00
Mattias Walström d1b9f1fb45 Add new test start_from_startup.py to just see that the device can boot from startup config
Useful to run in a loop.
2024-02-28 13:18:51 +01:00
Mattias Walström e77772e8c5 test: usb: Refactor to use a common function to wait boot 2024-02-28 13:18:51 +01:00
Mattias Walström c6d9c68726 Add new function that only waits for boot (reboot) to complete
This since it can take an undefined time to reboot the DUT.
2024-02-28 13:18:51 +01:00
Mattias Walström 103398f070 make run: Increase default memory for qemu
This since the image has gotten larger.
2024-02-28 13:13:32 +01:00
Joachim WibergandMattias Walström 2f844f9ac7 Revert ".github: switch regression test to self-hosted runner"
This reverts commit 4b2acdedc5 since the
self-hosted runner(s) are not yet working properly.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-28 11:21:53 +01:00
Richard AlpeandMattias Walström 27a4278cce statd: add good-octets counters
This patch adds out-good-octets and in-good-octets as augment in
the infix-ethernet-interface yang model. These counters represents
OctetsTransmittedOK and OctetsReceivedOK from ethtool.

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-28 11:21:53 +01:00
Joachim Wiberg 3a04bec92d test: drop --interactive in non-interactive docker sessions
With a self-hosted runner we get the following classic error when
calling `make test-unit`:

    make[1]: Entering directory '/home/runner/_work/infix/infix/buildroot'
    /home/runner/_work/infix/infix/test/env /home/runner/_work/infix/infix/test/9pm/9pm.py /home/runner/_work/infix/infix/test/case/all-repo.yaml /home/runner/_work/infix/infix/test/case/all-unit.yaml
    the input device is not a TTY
    make[2]: *** [/home/runner/_work/infix/infix/board/x86_64/board.mk:14: test-unit] Error 1

This patch drops interactive from all non-interactive docker sessions.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 12:33:20 +01:00
Joachim Wiberg 9aa9a60aca test: replace hard-coded dependency on podman in Infamy
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 12:05:31 +01:00
Joachim Wiberg 954d26a7e2 statd: fix build without containers
Some customers do not need, or do not want, to be able to run
containers, so all NETCONF related daemons and applications
need to take this into consideration.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 11:47:07 +01:00
Joachim Wiberg 4b2acdedc5 .github: switch regression test to self-hosted runner
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 11:46:44 +01:00
Joachim Wiberg 0741d2a655 .github: simplify PR template slightly add reminder of YANG changes
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 10:39:22 +01:00
Joachim Wiberg e38063c0ac Minor update/clarification now that content has shifted downwards
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 10:27:19 +01:00
Joachim Wiberg a2bc3bef61 .github: reduce number of caches required by CI builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 10:08:20 +01:00
Joachim Wiberg eceeb8c59f confd: fix cni_popen() when building without container support
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 08:14:41 +01:00
Joachim Wiberg d12d66b013 package/klish-plugin-sysrepo: display default value in help text
When available, show the default value of a leaf node after the
description when issuing 'help leaf-node'.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 08:14:41 +01:00
Joachim Wiberg e73742504d Add new intro blurb from homepage to README
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 08:14:41 +01:00
Joachim Wiberg 6cde353029 Drop unicode from tagline, does not survive syslog
The tagline is read by Finit at boot, from /etc/os-release, and
logged when changing runlevel.  The unicode charachter does not
survive the trip via syslog to log file.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 08:14:41 +01:00
Joachim Wiberg a9e78aa329 patches/iproute2: backport ip address 'accept symbolic names'
This change completes the backport of symbolic names for ip address
protocol field:

    ip addr add IFADDR proto 5
=>
    ip addr add IFADDR proto dhcp

Ref:
https://lore.kernel.org/netdev/20230602155419.8958-1-stephen@networkplumber.org/

Fix #286

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 08:14:41 +01:00
Joachim Wiberg 7a52f49c7d execd: fix printf format specifier for systemf()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 08:14:41 +01:00
Joachim Wiberg ba76103c7f execd: refactor to autotools
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 08:14:41 +01:00
Joachim Wiberg b0b1a79aa5 statd: refactor to autotools, same as confd
Fix issue #299

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 08:14:41 +01:00
Joachim Wiberg 5762a73c45 package/confd: reduce sysrepo default log level
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 08:14:41 +01:00
Joachim Wiberg 4909a9e553 patches: backport finit silence udevd by default
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-27 08:14:41 +01:00
Joachim WibergandTobias Waldekranz 83821def3b confd: always create bridge with default_pvid 0
Fix #310
2024-02-26 16:36:29 +01:00
Richard AlpeandJoachim Wiberg f1ab05a86f yanger: remove stray variables and brackets (cosmetic)
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-26 13:01:06 +01:00
Richard AlpeandJoachim Wiberg 412ee33f09 yanger: fix indentation (cosmetic)
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-26 13:01:06 +01:00
Richard AlpeandJoachim Wiberg 0f3433e9a0 yanger: remove stray semicolons (cosmetic)
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-26 13:01:06 +01:00
Richard AlpeandJoachim Wiberg 807b113d4e yanger: refactor test backend
Simplify the code a bit by passing the test file to the runner
function instead of checking it in every caller.

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-26 13:01:06 +01:00
Richard AlpeandJoachim Wiberg 5f25c063d5 yanger: introduce main function
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-26 13:01:06 +01:00
Joachim Wiberg 5038cd47e5 .github: proposed pull request template/checklist
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 5386ec9a3a test,doc,board: Infamy Made Easy
As of 4768cae6, we can use conserver/telnet to connect to the docker0
bridge IP:90XX, where XX is DUTXX.  This was a great UX improvement
and this patch set aims to further the experience by:

 - allow running Infamy (infix-test container) completely rootless¹
 - reduce the expsed port range 50->10 (can be improved further)
 - use 'podman --publish-all' ports, which allocates ten random
   ports for the exposed Qemu telnet ports
 - add Quick Start Guide to doc/testing.md

This restores the possiblity of running multiple "make test-sh"
instances, e.g., when multiple users share the same server.

The 'console' script included in this commit uses 'podman inspect' to
find the port number for a given DUT, and optional instance.  It takes
either the console/dut number (1-N), or the dut name from the topology.

Also in this commit:
 - set hostname for easy identification (for console script)
 - set conatainer --name to hostname
 - adjust workdir from buildroot to infix/test
 - simplify PS1 and add time to prompt (when did the test finish?)

When running 'make test-sh' the prompt now tells you which instance you
are running, e.g., infmay10.  Calling 'console 1 infamy10' connects to
console 1 (port 9001) on the infamy10 instance.

For more information, see the Quick Start Guide in doc/testing.md.  It
shows how to use the new helper scripts: console and shell.

Fix #227

_______
¹) devs using podman, instead of docker, with slirp4netns installed, can
   run the infix-test container completely rootless.  We like this, and
   as of today podman is our recommendation.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 00c2c0c608 test/case: new test, container connected using physical interface
Verifies that a regular/physical port/interface can be handed over to a
container.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 4856705803 test/case: new test, plain bridge + veth connection for container
Vanilla bridge and veth pair managed entirely by Infix.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg a38f5902c8 test/case: new test, verify connectivity behind docker0 masquerade
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg ec4c1b1d70 test/case: new test, basic container test
- New helper class for container testing
 - New helper class to urllib, Furl

Due to extremely weak Python-fu in the undersigned, this patch changes
the __init__.py file to add new helper classes for container tests.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg bdbbfcb50f test/infamy: improved logging for connect + factory-default
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg f8b4a858bc test/infamy: pep-8 cleanup and simplification
- Fix most of what pylint complains about
 - Simplify constructs and add missing whitespace
 - Simplify output of YANG model downloader

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 3da045dd40 test/infamy: handle empty NETCONF reply from remote
This patch handles a corner case we for some reason have not run into
yet.  With the new container operational data it was triggered almost
immediately, so let's add some basic guards around it and return None

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 72a86301f0 test/infamy: save location data for Device and add address() method
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Tobias WaldekranzandJoachim Wiberg fcc9fe84f4 test/infamy: Support calling arbitrary functions from within a netns
Add a helper that lets you call a Python function (or lambda) in the
context of a network samespace.

Example:

    with infamy.IsolatedMacVlan("eth0") as ns:
        res = ns.call(lambda: subprocess.run(["ip", "link"],
	                                     capture_output=True))
	print(res.stdout, f"\n[exitcode:{res.returncode}]")

    The call to subprocess.run will be executed in the context of the
    network namespace, and thus only list "lo" and the "iface"
    macvlan.

The return value of the function passed to ns.call() is passed back
over a multiprocessing.Pipe, which requires that the object be
"picklable". This is true for most objects (even more complex ones
like the CompletedProcess object seen in the example above). Some
notable exceptions are things like file objects, sockets, etc.

The setns(2) syscall is unfortunately not available in current
versions of Python shipped with neither Ubuntu nor Alpine at the time
of this writing. Therefore, shoot from the hip, assume that we're
running on an x86_64 CPU, and just hotwire the syscall directly with
some constants we found in a dumpster.
2024-02-25 19:49:27 +01:00
Joachim Wiberg 9ce763662f package/curios-httpd: new package, bundle a demo container
This is an example of how to create a package that downloads an OCI
archive and installs it to /lib/oci

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 257636d997 package/klish: bump for __ptype -> xml param.name fix
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 25c31ce218 src/klish-plugin-infix: improve log message on failed copy
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg bcdd311cb8 src/klish-plugin-infix: support for copying remote files with auth
This patch adds the optional 'user name' argument to the 'copy' command,
enabling using curl scp/sftp protocols for fetching and uploading files.

Changes to cfg_adjust() allow saving and referencing files in the user's
home directory.  Useful for both fetching upgrade bundles and container
images.

The 'dir' command now lists files in both $HOME and /cfg.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 3159d6c042 src/klish-plugin-infix: new symbol shell@infix with user tracking
This patch adds a new klish symbol, shell@infix, which performs proper
droprivs before calling the configured shell.

Fix #298: track user id so shell command gets correct user

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 8354997104 src/klish-plugin-infix: break out shell to optional shell.xml
Some customers don't want unprivileged CLI users to be able to exit to
a shell.  The shell is currently hard-coded to bash, but should be one
of the ietf-system shells, configurable --with-shell=foo.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg b0a0b31e68 src/klish-plugin-infix: refactor copy@infix, allow file -> file copy
This refactor is basically only an extra step after

   copy source-ds -> dest-ds

to also

   copy source-file -> dest-file

Which in the case of factory-config and startup-config is relevant.  We
want to update the startup datastore, in case of additional commands,
but also the file /cfg/startup-config.cfg in case of consecutive reboot.

Fix #259 copy factory-config startup-config

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 686f0bec03 confd: refactor, relocate container network code to cni.[ch]
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 360d3b322d confd: use podman stop/start to prevent container corruption
Sending SIGTERM to conmon is not a safe shutdown of a podman container.
To handle gracefully handle shutdown, restarting and provide an orderly
start of dependencies, we use the Finit sysv trick via container script
wrapper to call 'podman stop foo'.

However, since podman does not support syslog as output for containers
we employ an old FIFO trick with another program, k8s-logger, to allow
logs to reach syslog.  Please note that k8s-logger must have properly
started before we call `podman start` -- this makes us fully dependent
on the 'container' wrapper script.  Hence the documentation update.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 6fa1eb9e00 package/k8s-logger: new package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg a530db9ae5 board/common: confine containers in their own parent cgroup
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 337f39a74d board/common: quiet flag and check if running for start/stop
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 3b5c0248d7 confd: handle factory-default RPC better wrt. container networks
Because sysrepo callbacks are threaded and factory-default RPC is called
from a separate subscription (to prevent blocking), we cannot prevent
ietf-intefaces.c from being called before infix-containers.c, regardless
of the priority we set for our subscriptions.

When assigning a physical network interface this becomes a bit of a pain
during factory-default RPC since the physical interface is hidden from
the host network namespace.

So, when applying factory to running, we check each interface if it was
a container-network previously, if so we call on the container script in
the exit of the current dagger generation to move the interface back to
the host netns.

This affects all other functions that assume interfaces only live in the
host netns.  To that end a set of new helper functions have been added
to wrap iproute2 commands in nsenter when the interface lives elsewhere.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 168fb24957 confd: handle building without containers
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg ec3e3b3322 confd: minor refactor, split hook, improve log messages
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 67bb7e5928 confd: simplify container network naming
The interface name is already a unique qualifier, so we can simplify CNI
network naming to ease the burden when debugging.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 214ca82bd6 confd: allow host container interfaces without IP address
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg a05a3609c5 confd: add sloppy inference of container-network type
"Sloppy" because, for some reason, we don't get sysrepo update callbacks
for presence containers.  I.e., when calling 'set container-network'
compared to 'edit container-network'.

Yes, I've gone over klish-plugins-sysrepo with a fine-toothed comb to
see if it's the culprit, but no, it seems to be sysrepo.  Hence the
defaulting of the type also in the change path.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg e4aa36dfe7 confd: tighten up container data validation in YANG model
Review found quite a few strings that could be given an obvious pattern
or specialized sub-type, e.g. inet:ip-address, to restrict the input
data validation.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 34b06fa448 confd: update container documentation and YANG models
Due to the deprecation of CNI i Podman[1], and its upcoming removal in
Podman v5.0, we decided to cut our losses and modify all documentation
and models to become backend neutral.  We will continue to use CNI as
long as possible -- it gives us host interfaces, for instance, that is
not part of netawark yet, it seems.

Also, sync mount and volume documentation with YANG model changes.

[1]: https://blog.podman.io/2023/11/cni-deprecation-and-removal-from-podman-5-0/

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 81d8643a6f confd: rename container 'file' to 'mount', add more mount types
After discussions in the development team, and an external demo, we
decided to rename file mounts to just mounts and adopt established
nomenclature.

With this change we now allow mounting any type of file or directory
from the host to the container, for regular files/directories a bind
mount is used.  We also introduce 'source' and 'type', to support
mounting of host files and directories, the destination path has been
renamed to 'target'.  The mount cousin, 'volume', which basically is a
specialized mount, has also been updated to use 'target'.

The 'source' and 'content' are now hidden behind a YANG choice to ensure
users can only use them the intended way (either/or not both).

Initial models had 'destination' (path) as mandatory, with this change
we can reintroduce that to ensure this proper configurations.

The documentation in both YANG model and markdown has been updated,
significantly, to provide lots of examples.

Please note, glob style mounts have not been tested, at all.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 8edf238b68 confd: handle active but unsaved containers in unclean shutdowns
When container configurations are not saved to startup-config and the
user reboot the system (or lose power) we will have lingering active
containers cached on persistent storage.

This patch adds a cleanup() function to the post hook, right before
we try to launch any new containers.  This callback must be run for
all cases, even if the running-config has no containers configured.

Also, a minor amendment to volume pruning.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 61cba2615f confd: make container privileged mode configurable
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg a6f6fcac6a confd: add support for oci: and oci-archive: images
1. add support for extracting, and finding the directory holding the
    index.json metadata file in, OCI images.  An archive in Infix is either
    a .tar or .tar.gz archive, which we need to unpack for this version of
    podman to be able to load them.
 2. new RPC '/infix-containers:oci-load' calls 'container load' of an
    OCI archive (tarball), optionally gzipped.  The resulting image uses
    the directory name of the unpacked tarball, so the container script
    offers a way to retag the image after loading it.

First class citizens in container transport are docker:// and the OCI
family of URI:s.  A docker:// URL, or a local docker-archive:path, is
assumed to be well formed, in which case we leave it up to podman to
handle.

Note: 'podman import' does not fully understand OCI formats.  It drops
      ENTRYPOINT and COMMAND, while 'podman load' handles things a lot
      better.  Only letdown is it does not support nameing the image.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 8ea159ce5d confd: add feature flag for containers
Not all customers want Container support in their Ínfix builds.  This
patch adds build-time support for detecting if podman is enabled in
the configuration.

 - Klish container commands have been broken out to their own xml file
 - infix-interfaces have been given a 'containers' feature
 - ietf-interfces.c enables 'containers' feature on an #ifdef
 - infix-container.c is only built if --enable-containers

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 235d3e46e6 confd: major refactor of infix-containers after team review
- Rename container/container -> containers/container
 - Collapse containers-state into containers
 - Complete refactor of network/host-network for improved UX.  A new
   must expression ensure mutual exclusion between host and networks
 - Rename entrypoint -> command, for consistency (overrides ENTRYPOINT)
 - Move nodes around a bit for more logical placement in model
 - Clean out all traces of a container on removal
 - Rename container image_id -> image-id for consistency

The active queue is for tracking currently running containers, ensuring
only relevant changes are applied, and also for container image upgrade,
at the end of which these scripts are re-run to activate the new image

Also, fix misplaced '-f' when pruning unused volumes.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg a9a7b7016d statd: initial support for container-state information
Also, add missing dependency on libite to packaging.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg ed86a29bfc doc: initial container documentation
Brief overview of configuration support.  Need to add admin-exec level
commands, but since operational and actions still are missing, we keep
it out until after the code review.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 580599f549 confd: misc. fixes and cleanup
- drop debug logs
 - no need to restart upgraded containers, they restart automatically
 - fix ordering in volume prune (when containers are removed)
 - skip directories in container activation (inbox -> execd queue)
 - Fix 'container pull IMG creds USER[:PASS]' bug, extra '=' variable
   assignment inside infix.xml
 - Fix 'container run IMG CMD ARGS' to actually put the CMD in
   ENTRYPOINT and append ARGS to image.  The podman run and create
   commands are *not* behaving the same way
 - Rename 'attach' to 'exec', execute command inside an running container
 - Add 'container [shell | connect]' to start shell in -- " -- " -- " --
 - Add 'container [stat | cleanup | usage stats]' commands
 - Add in="tty" to commands thay may end up being interactive
 - Split <ACTION> line into multiple lines for readability
 - Fix container shift logic:

     root@infix-00-00-00:/> show container
     /usr/sbin/container: line 361: shift: shift count out of range

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg b7d119b23f confd: add NETCONF actions to start/stop/restart containers
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg ff32314676 confd: rename volume dir -> path, same as bind-mounted files
Also, update container YANG model descriptions and ensure 'path' is
mandatory for each list element and attach a regexp pattern to fix
the mountpoint to an absolute path inside the container.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg cd4e8b0a9f confd: add support for mounting read-only files in containers
In the container configuration context:

    edit file ntp.conf
    set path /etc/ntp.conf
    set content

The last command opens a text editor where you can paste the contents
of the file.  This is stored base64 encoded in the datastore as well
as in JSON/XML.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 31502c8aab confd: add support for upgrading container images
This patch adds a new CLI command 'container upgrade foo', where 'foo'
is the name of the container.  If more than one container use the same
image, multiple upgrades must be done because a container runs not on
the 'image:tag' but on the hash of the 'image:tag' it was created from.

Rename "done" queue to "active", since we want to recreate an active
container after fetching an updated base image.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg aafa88b648 confd: add support for container volumes
This commit adds support for writable container volumes.  A volume, when
compared to a mount, is a writable directory created when the container
starts and is automatically rsync'ed with the underlying directory it
is mounted on on first use.  A mount otoh does not rsync so it results
only in an empty directory inside the container.

The podman/docker mount feature will be used later to bind mount single
files or sharing directories from the host, e.g., /sys/class/leds/ to
one of more containers.

Note: unused volumes are automatically pruned.  Hence, a volume
      currently cannot be moved to another container.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 414703e851 confd: minor refactor, /run/container/env -> /run/container/args
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 256c462c0c confd: add support for read-only containers
This creates a container without a writable layer.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 679a6671ed confd: do not recreate existing containers that are unchanged
This patch allows containers created with "podman create" to surivce
rebots, and even reconfigurations at runtime, as long as their config
has not changed.  Allowing some level of persistence in the writable
layer given to containers.

For even more persistency, support for volumes (they sync with dir in
container on first use) and mounts (creates empty writable dirs in the
container) must be added.  A third option, a variant of mounts, is to
allow a leaf-list "file", where binary content can be added and then
mounted into the container, e.g.

/run/containers/files/$name/file.ext -> container://$name/etc/file.ext

None of this is available yet, but seems likely we need to add in the
very near term.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg d8dde9cde2 confd: add support for custom container ENTRYPOINT
This was a tough nut to crack.  Turns out the trick to changing the
ENTRYPOINT is to set --entrypoint=command and then call 'podman create
... command args'.  Not entirely obvious since the documented approach
is to use a JSON array as the argument: podman create
--entrypoint='["command", "args" ]'.

Admittedly, encoding this in C to transfer it via a POSIX shell script
to the command line, is not the easiest task I've undertaken.  So I gave
up and found this workaround.

Worth noting, however, is that one *must* set `--entrypoint`, it is not
enough to just append the command to the 'podman create' command line.
Due to differences in docker and podman, we cannot supply the full args
to an alternate entrypoint command.  But for the command to actually run
we need to override the image's ENTRYPOINT and send the command and args
as the last arguments on the command line to podman create.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg f1bf02eda5 confd: refactor how container networks are sent to container helper
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg aa7ea66a0d confd: add support for setting container hostname
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 7a57d4f0fa confd: add support for container environment variables
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 3d85eba3fc confd: add support for publishing container ports
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg b04c81199d confd: add support for host containers, shares host's interfaces
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg ffd2128614 confd: add support for container restart and restart policy
Also, ensure the deleted container is actually deleted before recreating
it with a new configuration.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 2b19b61068 confd: add support for manual start of containers
This commit adds 'manual:yes' to the container's Finit service
configuration and changes from pod: to container: prefix for a
unique namespace to prevent collision with regular services.

The prefix container: is more correct that pod:, which should
be reserved for any future pod support.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>

confd: fix missing variable in container script condition

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 0f0c119553 configs: sync r2s defconfig with latest changes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 5fdc408ade configs: add libssh2 to NETCONF builds, needed by libcurl
libcurl use libssh2 for scp/sftp access

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 9e801dfa2f confd: initial support for Docker containers using podman
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 0bda0727b7 confd: minor, whitespace only
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 0b6f7a6b93 package/execd: new local package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg ad0463e96c libsrx: minor, constify since we don't modify these args
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 3bdf360b2e libsrx: minor, coding style
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 58ebae5624 yanger: pep-8 style fixes and cleanup
- reserved words: map -> xlate
 - add missing docstrings
 - convert to recommended constructs: proto in (foo, bar)
 - drop unused 'f' format strings: f""
 - too short exception vars: e -> err, d -> entry
 - drop unnecessary () in if expressions
 - add whitespace for readability and navigation

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg b3e418c6a7 board/common: let qemu.sh take kernel/init args on command line
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg f0f0e737a9 board/common: BusyBox ash != bash, set bash as root default shell
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 84f83d635b board/common: fix #294: drop 'v' from version in filenames
The files inside a release tarball, as well as the tarball name itself,
should not have the leading 'v', that's just for the tag.

Also, add -ver to GNS3 disk.img file as well.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg e5dd01ffcc patches/finit: fix out-of-place [OK] messages at shutdown/reboot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 4f98b0b761 package/podman: install bash completion
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 074754d42d package/podman: minor, drop helper scripts
To be replaced with native support for generating container network
interfaces and running under finit.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 51dc940059 package/klish-plugin-sysrepo: new commands 'change' + 'text-editor'
This bump adds support for 'set foo' to set foo=true, but also two new
commands from srp_helper@: 'change password', 'text-editor content'.

 - ietf-system: 'change password' now starts an interactive session that
   results in a random-salted sha512 encrypted hash.
 - 'text-editor <node-of-binary-type>', starts 'editor file | base64'
 - 'set <node-of-bool-type>', sets node=true

A prototype askpass script has been added as a proof-of-concept.  It
follows the design of other askpass style programs, like ssh-askpass,
that pass the resulting password on stdout.  With the additional support
for also writing it to an output file, e.g., a pipe.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 4793cf0770 package/skeleton-init-finit: silence mdev/mdevd/udevd log notices
On every system reconf (initctl reload) the .conf files are evaluated
again and log notices about skipping alternative syslogd enties are
logged.

We know that we run the udevd dependend syslogd entry, and everything
else basically in runlevel S depends on it, so not much else would work
if syslogd didn't start.  So we can safely set 'nowarn'.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 0468f35fb6 cli: minor, whitespace and fix 'show' subcommand help
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Joachim Wiberg 1e87a30147 confd: skip ethtool command for etherlike interfaces
When "plopping" back an interface from another network namespace, e.g.,
when removing a container network interface, we cannot just rely on the
'ethernet' node *not* being available for an interface.

Experience shows that sysrepo might send us a curve ball (see comment)
which we interpret to be a true Ethernet interface.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-25 19:49:27 +01:00
Mattias Walström 83effa6fd4 Use common CFLAGS in all src-packages.
And fix bugs that the new CFLAGS find.
2024-02-23 14:01:23 +01:00
Mattias Walström 8f996859dc Add infix CFLAGS, used when building src/ (confd, statd....) 2024-02-23 14:01:23 +01:00
Mattias Walström 4869b73b14 test: usb: test startup with no hardware configuration
In this case the USB ports shall be locked.
2024-02-23 14:01:23 +01:00
Mattias Walström c1309da10b infamy: Add support to copy running to startup
Also add support for rebooting unit.
2024-02-23 14:01:23 +01:00
Mattias Walström acc39b1b15 yanger: usb: Refactor to only check authorized_default if locked/unlocked
authorized is unreliable on boot.
2024-02-23 14:01:23 +01:00
Mattias Walström ddd0fc5a35 yanger: vpd: set class to vpd for all vpd nodes
class is mandatory in the standard.
2024-02-23 14:01:23 +01:00
Mattias Walström afa243cd2f confd: core: keep one instance of /run/system.json open
Add entry in struct confd to keep it accessable for all callbacks.
2024-02-23 14:01:23 +01:00
Mattias Walström b66b56f504 probe: rename usb-ports-names => usb-port-names 2024-02-23 14:01:23 +01:00
Mattias Walström d4a1a7c91c doc: Add USB documentation 2024-02-23 14:01:23 +01:00
Mattias Walström c57a4655b8 ietf-routing: Handle return value from touch() 2024-02-23 14:01:23 +01:00
Mattias Walström 30e2a814eb factory: getchar() returns integer not char 2024-02-23 14:01:23 +01:00
Mattias Walström caea3132c9 probe: Change to return the sysfs path for authorized and authorized_default
Leave it to confd to check if the file exist.
2024-02-23 14:01:23 +01:00
Mattias Walström 746392cac5 x86_64: Update linux_defconfig with USB as module
This to be able to control USB ports in infix using authorized in /sys
2024-02-23 14:01:23 +01:00
Mattias Walström 5afaeae46c Update qeneth to support USB 2024-02-23 14:01:23 +01:00
Mattias Walström 15b32cfcc2 infamy: Add a simple USB test 2024-02-23 14:01:23 +01:00
Mattias Walström 8e0db4c7e4 topology: virt: Add usb-sticks 2024-02-23 14:01:23 +01:00
Mattias Walström 420e0d5b36 qeumu: Add USB ports 2024-02-23 14:01:23 +01:00
Mattias Walström 69eae34203 probe: Add support for virtual USB ports (qemu) 2024-02-23 14:01:23 +01:00
Mattias Walström c0a071e87a Add 'show hardware' only show USB port status for now 2024-02-23 14:01:23 +01:00
Mattias Walström 2011f5cbf2 modprobe.d: Unauthorize all USB ports on boot 2024-02-23 14:01:23 +01:00
Mattias Walström a6ff416401 confd: Add support for ietf-hardware
Add supports to enable disable USB port
2024-02-23 14:01:23 +01:00
Mattias Walström 66c20aa79d bootstrap: Enable states feature to ietf-hardware 2024-02-23 14:01:23 +01:00
Mattias Walström b0f2388153 probe: Add support for multiple /sys nodes for a of-node 2024-02-23 14:01:23 +01:00
Mattias Walström 5e707753e9 ietf-hardware: YANG: Deviate everything not supported yet 2024-02-23 14:01:23 +01:00
Mattias Walström 6099ac79e2 Add script to generate entries for external ports
For the user to be able to enable them in runtime
2024-02-23 14:01:23 +01:00
Mattias Walström 6f41ea5ccb probe: Read information about external ports (usb)
from Device tree and put it into system.json
2024-02-23 14:01:23 +01:00
Mattias Walström c58bd5ead4 aarch64: Configure USB_CORE as a module
This to be able to control the USB ports in infix using authorized in /sys
2024-02-23 14:01:23 +01:00
Mattias Walström bd9acd003d Alder: DTS: Add information about external ports (USB) 2024-02-23 14:01:23 +01:00
Richard AlpeandTobias Waldekranz 0cb1459f43 cli-pretty: only print stp state if oper status is up
Only print bridge port stp state if operational status of the
interface is up.

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-20 21:43:48 +01:00
Richard AlpeandTobias Waldekranz 1827b65182 test: update cli-output to reflect new bridge output
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-20 21:43:48 +01:00
Richard AlpeandTobias Waldekranz 1807306178 cli-pretty: print vlan filtering bridge
Handle printing a vlan filtering bridge in "show interfaces".

Example output:
br0             bridge     DOWN        vlan:10u,20t
│               ipv4                   192.168.1.1/24 (static)
├ e0            bridge     DISABLED    vlan:10u,20t pvid:10
└ e1            bridge     DISABLED    vlan:10t,20u pvid:20
br1             bridge
└ e2            bridge     FORWARDING  vlan:30u pvid:30
e3              ethernet   UP          02:00:00:00:00:03
                ipv6                   fe80::ff:fe00:3/64 (link-layer)
e4              ethernet   UP          02:00:00:00:00:04
                ipv6                   fe80::ff:fe00:4/64 (link-layer)
lo              ethernet   UP          00:00:00:00:00:00
                ipv4                   127.0.0.1/8 (static)
                ipv6                   ::1/128 (static)

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-20 21:43:48 +01:00
Richard AlpeandTobias Waldekranz 475a3a2919 yanger: add bridge vlan, pvid and stp-state
This patch adds information about a vlan filtering bridge to the
operational datastore.

The information included is vlans, pvid and stp-state. These changes
reflects what can be configured though confd.

NOTE: pvid is still missing for bridge interfaces. Discussions on how
to best add this is ongoing. It's currently not configurable due to an
existing self check in the infix-if-bridge yang model.

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-20 21:43:48 +01:00
Richard AlpeandTobias Waldekranz 0937921cbc test: add br1 to sysrepo emulator
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-20 21:43:48 +01:00
Richard AlpeandTobias Waldekranz 6ad80c80ab test: make e2 into br1 bridge port in system output
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-20 21:43:48 +01:00
Richard AlpeandTobias Waldekranz 4150f45cc4 test: add system output for vlan filtering bridge
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-20 21:43:48 +01:00
Richard AlpeandTobias Waldekranz 1da00a9764 yang: add stp-state to infix-if-bridge
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-20 21:43:48 +01:00
Tobias Waldekranzandjovatn 015215073a doc: Initial documention of VPD 2024-02-13 15:45:29 +01:00
Richard AlpeandJoachim Wiberg d73d5440c5 test: remove hardcoded interface type
This can now a days be inferred and isn't needed. Also, the interface
type in virtual testing is now etherlike not ethernet.

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-05 18:01:30 +01:00
Richard AlpeandJoachim Wiberg 104a70d46c confd: handle etherlike delete as ethernet
This resolves the regression where configured etherlike interface mac
addresses where not deleted from the system.

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-05 18:01:30 +01:00
Richard AlpeandJoachim Wiberg 795f2615cb test: update cli output test to reflect etherlike changes
* Remove bogus ethernet statistics for br0
* Change parentbus for e0 and e1 to make them ethernet devices (not
  virtio -> etherlike).

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-05 18:01:30 +01:00
Richard AlpeandJoachim Wiberg debcf81a7a yanger: only fill eth info for Ethernet interfaces
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-05 18:01:30 +01:00
Richard AlpeandJoachim Wiberg ee50a7c061 yanger: identify new interface type "etherlike"
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-05 18:01:30 +01:00
Richard AlpeandJoachim Wiberg f35f176860 confd: identify virtio interfaces as "etherlike"
Instead of "ethernet". Prior to this patch virtio interfaces where
identified as "ethernet", which resulted in /run/net trying to enable
autoneg on them. Which isn't supported and resulted in an ABANDONED
"default config".

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-05 18:01:30 +01:00
Richard AlpeandJoachim Wiberg 198be2a9c6 confd: add new interface type "etherlike"
Needed for devices that share a lot of properties with an ethernet
device but doesn't support "ethtool" and such. An example is TAP
interfaces.

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-05 18:01:30 +01:00
Richard AlpeandJoachim Wiberg 79ce152abb confd: fix indentation in gen-interfaces
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-05 18:01:30 +01:00
Tobias WaldekranzandJoachim Wiberg 870d41644f confd: ethtool: Condense logic around autoneg configuration
Rely on the interface diff to figure out if any autoneg related config
has changed; if so, generate the resulting configuration based on the
current interface config.

- Remove loopback check, the model only allows ethernet config on
  interfaces of type "ethernet".

- Split up the input validation of speed/duplex to give the user an
  error message with as much specificity as possible.

- Validate that the configured speed/duplex is supported.

- Move the generated script to execute earlier to avoid unnecessary
  link flapping.

- Use negative POSIX error codes, these are (or at least should be)
  mapped to sysrepo errors in netdag_gen_iface.
2024-02-05 18:01:30 +01:00
Richard AlpeandJoachim Wiberg 43017cc79f confd: add the ability to set speed, duplex and autoneg
Add the ability to configure interface speed, duplex and autoneg.
Initially this was pared with YANG model deviations that restricted
explicit interface speed and duplex when autoneg was enabled. But due
to conflicting default states in YANG, this code was dropped.

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-02-05 18:01:30 +01:00
Joachim Wiberg a6a480cbf9 .github: add missing $ in variables
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-02 10:15:13 +01:00
Joachim Wiberg f4f62e1c02 .github: fix syntax error in workflows, missing 'with:' for params
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-02 09:08:44 +01:00
Joachim Wiberg cd521ca789 .github: only run Coverity Scan for KernelKit org.
The Infix scan token we have is only valid for KernelKit, so for any
downstream forks we must not attempt to run this workflow.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-02-02 08:53:02 +01:00
Tobias WaldekranzandMattias Walström a97dc8b870 defconfig: Enable keyack for NETCONF builds 2024-02-01 14:18:14 +01:00
Tobias WaldekranzandMattias Walström 583881c1f9 keyack: Add program to wait for key press and release
Useful for testing buttons bound to a gpio-key, e.g. a factory reset
button.
2024-02-01 14:18:14 +01:00
Mattias Walström 8e0caed530 Bump github actions version 2024-02-01 13:20:57 +01:00
Mattias Walström 2240be50c5 Revert "Bump github actions version"
This reverts commit 3155a99cab.
2024-01-31 16:56:37 +01:00
Mattias Walström 3155a99cab Bump github actions version 2024-01-31 14:27:57 +01:00
Mattias Walström 6b23a2b432 confd: infix-dhcp: Remove dead code 2024-01-31 14:27:57 +01:00
Mattias Walström cabb9ea6a5 Add badge to the kernelkit discord 2024-01-31 14:27:57 +01:00
Mattias Walström ef5d5d21a0 statd: Free sub when exit on error 2024-01-31 14:27:57 +01:00
Mattias Walström 0d31f501e1 Run coverity check each day 2024-01-31 14:27:57 +01:00
Joachim WibergandTobias Waldekranz 307cdb02b4 confd: bump infix-dhcp-client YANG model version for release
The DHCP client YANG model saw a lot of changes added in the 23.12
sprint, fortunately there was never an official release.

This commit bumps the model version for v24.01.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-30 15:32:38 +01:00
Joachim WibergandTobias Waldekranz fbe6accdf3 Clarify what happens without /plen
Co-authored-by: Tobias Waldekranz <tobias@waldekranz.com>
2024-01-30 15:32:38 +01:00
Joachim WibergandTobias Waldekranz 228891935d dhcp-client: allow setting hostname, and update /etc/hosts
This should be the last outstanding issue to fix #278.  Please note,
it is undefined what happens if you have two DHCP clients that request
hostname, and changing hostname from NETCONF at runtime will overwrite
any hostname set by the DHCP client.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-30 15:32:38 +01:00
Joachim WibergandTobias Waldekranz 12f5a88b3b confd: infer default DHCP client options
For maximum flexibility we allow the user to full control over the DHCP
options the client requests.  For this to work we must tell udhcpc to
not set any of its defaults behind the scenes, so we call it with '-o'.

This commit adds support for inferring these udhcpc default options in
NETCONF.  So when enabling the DHCP client we now get the same set of
sane options as udhcpc otherwise hides from us.

Fixes #278, at least wrt. the lack of sent options.  Allowing the client
script to set the hostname will be added in a later commit.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-30 15:32:38 +01:00
Joachim WibergandTobias Waldekranz faa6ce849b dhcp-client: don't assume we got option 1 (subnet)
If we don't get subnet, then just set the IP address.

Issue #278

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-30 15:32:38 +01:00
Joachim WibergandTobias Waldekranz 08cec2e9bc confd: add exception for hostname DHCP client option
No need to guard the hostname option in quotes, it must not contain
whitespace.  If user configured more than one word, use first.

Fixes #283

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-30 15:32:38 +01:00
Jon-Olov VatnandMattias Walström 94dd57a741 Extending and updating OSPF documentation
- Adding information on OSPF interface settings
- Adding CLI example to Debug OSPFv2 section
- and some additional minor changes

[skip ci]
2024-01-30 13:49:31 +01:00
Henrik NordstromandJoachim Wiberg 4c5d5fb045 board/aarch64: alder: Remove Micro-SD support
There is no Micro-SD slot on the alder board. Not even an
optional one.
2024-01-29 18:05:07 +01:00
Mattias Walström 6d0f666ae1 CLI: OSPF: Add database and routes as show ospf subcommands 2024-01-29 14:49:28 +01:00
Mattias WalströmandTobias Waldekranz 051658d36a Add test to se that it is possible to get all operational data
Unlikley to fail though.
2024-01-27 23:56:31 +01:00
Mattias WalströmandTobias Waldekranz 0aeae9d8e8 dts: Add factory reset button as keybord (button)
Also add a tool useful to test the reset button.
2024-01-27 23:53:54 +01:00
Richard AlpeandTobias Waldekranz 0549de0eec infix-*.yang: fix indentation (2 spaces)
Align indentation in all infix yang models to be 2 spaces.

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-01-23 21:25:39 +01:00
Mattias Walström 9c466b84df clang-format: Fix correct linux-formatting 2024-01-23 15:30:40 +01:00
Mattias Walström 0033a92c80 qemu.sh: Fix bug when emulate VPD
Wrong date format for manufacture-date
2024-01-23 15:30:40 +01:00
Mattias Walström c4320cd036 ietf-hardware: Add infix deviations 2024-01-23 15:30:40 +01:00
Mattias Walström c1d616159f Add ietf-hardware and iana-hardware yangfiles 2024-01-23 15:30:40 +01:00
Mattias Walström c826e06311 statd: Listen for ietf-hardware requests 2024-01-23 15:30:40 +01:00
Mattias Walström e73b3afe8c statd: Refactor subscription callbacks
Add a new generic callback to reduce code duplication.
2024-01-23 15:30:40 +01:00
Mattias Walström 8a2bc3dae9 statd: Coding style 2024-01-23 15:30:40 +01:00
Mattias Walström 22269b6057 Yanger: Implement ietf-hardware
Wrap all VPD data and show them as components in ietf-hardware.
2024-01-23 15:30:40 +01:00
Richard AlpeandJoachim Wiberg 641d328238 infix-eth-if.yang: update revision
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-01-22 16:50:36 +01:00
Richard AlpeandJoachim Wiberg 7657b49b2b infix-eth-if.yang: deviate negotiation-status not-supported
Signed-off-by: Richard Alpe <richard@bit42.se>
2024-01-22 16:50:36 +01:00
Richard AlpeandJoachim Wiberg 2d38896cd5 infix-eth-if.yang: remove comment about deviating eth
This is now supported by Infix.

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-01-22 16:50:36 +01:00
Joachim WibergandTobias Waldekranz 236f3ec183 board/aarch64/r2s: patch device tree for factory-password-hash
Since the Nanopi R2S does not have a VPD, we use this mechanism to set
the default admin password.  Without one, Infix will refuse to generate
the factory- and failure-config files, and thus refuse to start.

On custom boards in production we have VPD in ONIE format that contains
a per-device unique SHA256 hashed admin user password.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-22 11:20:01 +01:00
Joachim WibergandTobias Waldekranz 2ade7fd9ab configs/r2s_defconfig: resort/make update-defconfig
Loss of BusyBox "show others", uboot-tools, and e2fsprogs, are likely
due to resolved dependencies from other packages.  E.g., Frr requires
bash.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-22 11:20:01 +01:00
Joachim WibergandTobias Waldekranz 10ec9089bc Initial support for Nanopi R2S from FriendlyELEC
Support for this is based on the upstream Buildroot R2S defconfig and
the myLinux extensions and stripped-down kernel defconfig.  For more
information about the Nanopi R2S, see the FriendlyELC wiki at:

    https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R2S

Please note, due to the lack of a VPD on the board, and some very poor
devicetree skills by yours truly, Infix currently refuse to boot on this
board.  An in-devicetree factory-password-hash node has to be added, and
will be done soon.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-22 11:20:01 +01:00
Joachim WibergandTobias Waldekranz 000811fced board/common: skip if not SIGN_ENABLED
All Infix builds should be signed, but for some test equipment, and
during board bringup, this may be too much of a hassle.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-22 11:20:01 +01:00
Joachim WibergandTobias Waldekranz 234527319e patches/uboot: move to sub-directory, does not apply to older u-boot
The Nanopi R2S currently only works with an older U-Boot v2021.10.  This
commit only relocates the CN9130 patches to a sub-directory.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-22 11:20:01 +01:00
Mattias Walström 3b87a077f9 ietf-routing: Add limitation on supported routing-protocols
Only OSPFv3 and Static routes is currently allowed in infix.
2024-01-18 14:20:13 +01:00
Mattias Walström b6d802c46f Update OSPF documentation
Remove now no longer needed prefix of keys.
2024-01-18 14:20:13 +01:00
Mattias Walström 2ea2ff5c83 Update klish to allow identityref as keys properly 2024-01-18 14:20:13 +01:00
Tobias WaldekranzandMattias Walström 7081934473 Promote all members of wheel to sudoers
Install the sudo command, and let all members of the "wheel" group run
any command as the superuser.

This ensures that administrators have full access to the system,
primarily for troubleshooting, diagnostics, and remote scripting
purposes.
2024-01-18 10:28:32 +01:00
Tobias WaldekranzandJoachim Wiberg 74ed929873 confd: Change the default shell of the admin user to bash
This let's users script infix devices without needing any special
NETCONF tools installed - ssh is enough. E.g. you can get the running
version with something like:

    ssh INFIX-HOST sysrepocfg -X -fjson -d operational \
    	-x "/system-state/platform/os-release" | jq .

It also means that SCP works as expected, by default.
2024-01-18 00:02:55 +01:00
Tobias WaldekranzandJoachim Wiberg f3678ac93f Provide a hint of how to access the CLI when other shells are used
For users with a shell other than clish, such as bash, print out a
hint of how to enter clish, when logging in.
2024-01-18 00:02:55 +01:00
Tobias WaldekranzandJoachim Wiberg 6ef80d5847 Add a default message of the day (/etc/motd)
This is injected to the factory-config during bootstrap, and can then
be changed as usual via /system/motd.
2024-01-18 00:02:55 +01:00
Mattias WalströmandJoachim Wiberg 43fbe4e8b1 OSPF: Add operational support to se router state per interface 2024-01-15 16:29:06 +01:00
Mattias WalströmandJoachim Wiberg aa68cd73c7 OSPF: Fix nasty bug when router-ids was converted to host routes
Caused collision with the key (prefix) in the list
2024-01-15 16:29:06 +01:00
Mattias WalströmandJoachim Wiberg c9f426763a Add new test to test suite 2024-01-15 16:29:06 +01:00
Mattias WalströmandJoachim Wiberg d3a61b5161 Add new physical topology for virtual tests with 4 duts
Also add a matching standard topology.
2024-01-15 16:29:06 +01:00
Mattias WalströmandJoachim Wiberg b799366d0a infamy: route: Add function to check if an area is NSSA 2024-01-15 16:29:06 +01:00
Mattias WalströmandJoachim Wiberg 9788046c64 OSPF: Add area-type to operational 2024-01-15 16:29:06 +01:00
Mattias WalströmandJoachim Wiberg c906236be5 OSPF: Add support for setting explicit-router-id 2024-01-15 16:29:06 +01:00
Mattias WalströmandJoachim Wiberg 4801c1f060 OSPF: Fix bug with ospf-status script did not work with NSSA or Stub areas
For some reason FRR put [NSSA] and [Stub] in the key with the area id
2024-01-15 16:29:06 +01:00
Mattias WalströmandJoachim Wiberg b48798b23a test: Set hostname for OSPF tests to detect the role 2024-01-15 16:29:06 +01:00
Mattias WalströmandJoachim Wiberg 15aaa70d63 test: infamy: route: Fix logic when checking if route exist 2024-01-15 16:29:06 +01:00
Mattias WalströmandJoachim Wiberg ad7c4fc737 OSPF: Implement interface setting to set cost 2024-01-15 16:29:06 +01:00
Mattias WalströmandJoachim Wiberg 388c02b29a test: Create a larger OSPF test
This will test, multiple areas with cost and BFD (requires link
breakers in infamy, not yet implemented there yet)

Also test NSSA-areas.
2024-01-15 16:29:06 +01:00
Mattias WalströmandJoachim Wiberg 95e9334812 OSPF: Add support to generate a default route inside OSPF 2024-01-10 17:51:46 +01:00
Mattias WalströmandJoachim Wiberg 34c807e955 OSPF: Add test case for unnumbered interfaces 2024-01-10 17:51:46 +01:00
Mattias WalströmandJoachim Wiberg b469a6a260 OSPF: Add passive interface and interface type to operational 2024-01-10 17:51:46 +01:00
Mattias WalströmandJoachim Wiberg 72dc0f87f5 infamy: route: Add support to read ospf status 2024-01-10 17:51:46 +01:00
Mattias WalströmandJoachim Wiberg 94ae818895 OSPF: add support to change network type for interface
Implemented types are broadcast and point-to-point
2024-01-10 17:51:46 +01:00
Mattias WalströmandJoachim Wiberg 3240de833f OSPF: Add support for passive interface 2024-01-10 17:51:46 +01:00
Joachim WibergandTobias Waldekranz d70abc5f21 board/common: let dagger script set LOG_PID with parent PID
This adds [PPID] to the syslog lines to the dagger script.  After all,
the dagger script is a proxy for confd, so when reading the logs it
seems natural to see the PID of confd rather than a script that will
die soon anyway.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-09 21:24:41 +01:00
Joachim WibergandTobias Waldekranz 504f0d53de package/finit: bump for v4.7 release
LICENSE hash changed due to udpated copyright years.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-09 21:24:41 +01:00
Mattias WalströmandJoachim Wiberg 4c33641667 Bump infix routing version 2024-01-09 11:06:41 +01:00
Mattias WalströmandJoachim Wiberg 21ce43031c OSPF: Fix bug when BFD is not enabled on all OSPF interfaces
Enable bfdd if bfd is enabled on any OSPF interface.
2024-01-09 11:06:41 +01:00
Mattias WalströmandJoachim Wiberg 54e97dbbd5 infix-routing: Deviate everything that is not currently supported 2024-01-09 03:56:17 +01:00
Mattias WalströmandJoachim Wiberg b503afe67b Fix regression after 35d74cecd4
Show normal next-hops also, not only next-hop-list routes
2024-01-09 03:56:17 +01:00
Mattias WalströmandJoachim Wiberg 7cce19d45c test: Add show routes (ipv4 and ipv6) to test CLI test suite 2024-01-09 03:56:17 +01:00
Mattias WalströmandJoachim Wiberg 35d74cecd4 Operational: Add support for multiple next-hop for routes 2024-01-08 10:04:44 +01:00
Mattias WalströmandJoachim Wiberg c0e7a6c03c OSPF: Add possibility to check status in CLI
Use vtysh for now.
2024-01-08 10:04:44 +01:00
Mattias WalströmandJoachim Wiberg 20cc36864a OSPF: Enable BFD integration
admin@example:/config/> edit routing control-plane-protocol ietf-ospf:ospfv2 name default
    admin@example:/config/routing/control-plane-protocol/ietf-ospf:ospfv2/name/default/ospf/> set area 0.0.0.0 interface e0 bfd enabled true
    admin@example:/config/routing/control-plane-protocol/static/name/default/> leave
    admin@example:/>
2024-01-08 10:04:44 +01:00
Mattias WalströmandJoachim Wiberg 729652469f infix-routing: Remove comments 2024-01-08 10:04:44 +01:00
Mattias WalströmandJoachim Wiberg 17409d1686 Add limitation on one area/interface
Since this is a limitation in FRR.
2024-01-08 10:04:44 +01:00
Mattias WalströmandJoachim Wiberg c8f7d0ee1c Check if OSPF is enabled not only if the node exist 2024-01-08 10:04:44 +01:00
Joachim WibergandMattias Walström 40c42c8fc1 dnsmasq.conf: D-Bus is not enabled in Classic builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-27 06:36:48 +01:00
Joachim WibergandMattias Walström 86dc560482 configs: sync classic with netconf defconfig essentials
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-27 06:36:48 +01:00
Joachim WibergandMattias Walström e821db57ce package/skeleton-init-finit: start sysklogd on classic builds
Classic builds don't have udev but rather mdev or mdevd.  This patch
imports support from myLinux for conditionally starting sysklogd on
classiic builds.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-27 06:36:48 +01:00
Joachim WibergandMattias Walström 2305f6adfd board: relocate prod scripts to netconf builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-27 06:36:48 +01:00
Joachim WibergandMattias Walström 4b6b90a79b board: fix breakage in classic builds
- Relocate python based probe to netconf builds, and
 - Restore basic shell script based probe for classic builds

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-27 06:36:48 +01:00
Mattias WalströmandJoachim Wiberg dd26838098 Documentation: Add information about OSPF stub areas 2023-12-26 12:11:37 +01:00
Mattias WalströmandJoachim Wiberg 79eefdec03 OSPF: Implement NSSA/Stub areas
admin@infix-00-00-00:/config/> edit routing control-plane-protocol ietf-ospf:ospfv2 name default
set ospf area 0.0.0.1 area-type nssa-area
set ospf area 0.0.0.1 area-type stub-area
set ospf area 0.0.0.1 summary true
set ospf area 0.0.0.1 default-cost 100
2023-12-26 12:11:37 +01:00
Mattias WalströmandJoachim Wiberg 2e8ba44abc libsrx: add lydx_get_bool to parse bool values 2023-12-26 12:11:37 +01:00
Mattias WalströmandJoachim Wiberg 2b154c1825 infix-routing: Add support for operational data
Now these are implemented:
* OSPF Router ID
* Neighbor status
* OSPF routing table
2023-12-26 12:11:37 +01:00
Mattias WalströmandJoachim Wiberg b5d0e2b007 ospf-status: Reimplement in python
This to be more flexible when adding operational data.
Also add support for neighbors.
2023-12-26 12:11:37 +01:00
Mattias WalströmandJoachim Wiberg 6db8c2bc75 infamy:netns: Add traceroute support 2023-12-26 12:11:37 +01:00
Joachim WibergandTobias Waldekranz 70c640fe48 configs: add htop, useful for debugging and monitoring
Better than Busybox top, and can attach strace to services.  So very
useful for debugging and monitoring a system.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-18 17:32:27 +01:00
Joachim WibergandTobias Waldekranz a36338f222 package/skeleton-init-finit: watchdogd must be in root cgroup
Since watchdogd may need to run with SCHED_RR, when the supervisor is enabled,
which is not supported by cgroupsv2, we ask Finit to always runs it in the
root cgroup.  We must also raise the limit for rtprio to all possible values
for SCHED_RR that a user can set in /etc/watchdogd.conf

Finally, add support for reading extra args from /etc/default/watchdogd

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-18 17:32:27 +01:00
Joachim WibergandTobias Waldekranz a6043ba4bc package/skeleton-init-finit: minor, add comment explaining the name
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-18 17:32:27 +01:00
Joachim WibergandTobias Waldekranz 871a536b1b Minor, add comment for Buildroot package overrides
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-18 17:32:27 +01:00
Joachim WibergandTobias Waldekranz 812b7748bb package/finit: sync package description with myLinux
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-18 17:32:27 +01:00
Mattias WalströmandJoachim Wiberg fc301201c6 ietf-ospf: Deviate everything thats not supported 2023-12-18 17:28:00 +01:00
Mattias WalströmandJoachim Wiberg 4e7bdc58d4 Add OSPFv2 support
A very limited part of the YANG model is implemented so far, basicly it is OSPFv2 with multiple areas and you can change timers
for the interfaces. Limited operational support.

admin@infix-00-00-00:/config/> edit routing control-plane-protocol ietf-ospf:ospfv2 name default
admin@infix-00-00-00:/config/routing/control-plane-protocol/ietf-ospf:ospfv2/name/default/> set ospf area 0.0.0.0 interface e0 enabled true
admin@infix-00-00-00:/config/routing/control-plane-protocol/ietf-ospf:ospfv2/name/default/> leave
2023-12-18 17:28:00 +01:00
Joachim WibergandMattias Walström 95c3e5c67c test: new test, verify dhcp option 121 is preferred over option 3
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 6b84bb4b13 test: new test, verify dhcp option 3 (router)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström a61b3b8aef test: minor refactor to check for nexthop (gw) in routes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström cb5419c84c test: new test, basic DHCP client
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 5056424867 test: new infamy DHCP server class
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 6244777f8e test: disable yang validation before sending config to target
This should probably be an optional argument to this method instead.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 556a7d884e test: two new methods to fetch ietf-ip ipv4 addresses
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström a745642ba2 confd: refactor, let default options to use same code path
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström a944923c6c test: add method, print all data for a given interface
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 4b08ccf842 test: rename method
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 0f7cee8192 test: minor, update module description
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 2b372dda28 test: fix regression in starting qeneth from e644d87c
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 62ef3e3fe8 board/netconf: add 'cfg' alias for 'sysrepocfg -f json'
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 95bcc1d902 cli: for consistency with YANG model, rename METRIC --> PREF(ERENCE)
In review discussions we have decided, for resonsons of consistency over
correctness, to rename this column to match the YANG model node name
rather than the Linux kernel name.

Also, right align the values.  Numbers should always be right-aligned.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström eb89f14ea3 confd: add netlink condition to dhcp-client, <net/IFNAME/running>
This patch ensures that the DHCP client is not started until the
interface is up and running (link).  If the interface goes down,
or loses link, the client is stopped and everything learned from
the server (address, routes, DNS/NTP servers, etc.) is remvoed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström e2e36d6439 patches/finit: backport silencing of noisy log messages
When an optional service doesn't exist, and the run/task/service stanza
clearly list `nowarn`, we should not log missing/skipping messages. This
patch-set is backported from the upcoming Finit v4.7

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström b6f8ec04b8 patches/finit: drop old v4.4 patches (on v4.6 now)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 6d3d49d7fd cli: add 'show dns' command to display DNS client status
This includes locally configured DNS and any learned from DHCP.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 993844d7b0 confd: refactor infix-dhcp-client options from leaf-list to list
This commit changes the DHCP options from plain flags to customizable
options with optional values.  This works for most key:value options,
but not for the more complex ones, e.g. option 81.  For this we have
dedicated handling to use `udhcpc -F fqdn` instad.

Additionally, the inference a default option list has been removed in
favor of a set of generic default options: router, dns, domain, address,
broadcast, ntpsrv, search, staticroutes, msstaticroutes.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 282fb1e74e confd: initial support for extended dhcp client settings
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 8eff9e6d6a confd: add support for arping (1 ARP w/ 1 sec timeout)
This should be longer, there are devices out there (in the industry)
that may drop the ball on a single ARP, or may be in deep sleep (IoT),
so we should send like 5 ARP with at least 1 sec between them before
timing out.

However, this requires patching BusyBox a bit, so skipping for now.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström c10e5797e9 confd: update DHCP YANG model, new options, arping, and route metric
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström eb0022b39d doc: list supported DHCP client options
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström c14b4e4152 confd: initial enhancements to DHCP client
- Add support for option 12, provide current hostname to server for
   registering the lease with -- this allows registering in local DNS
   for some DHCP servers.
 - Add support for option 50, request any previously cached IP address
 - Override option 60, vendor class identifier, with Infix vYY.MM
 - Adjust timers and retry options to be more persistant
 - Include initial metric as environment variable to client
 - Disable all default options, set a hard-coded subset, which will be
   replaced in a later commit by a generated list.
 - Ensure udhcpc creates a pid file, in case we may need to start any
   other service/task in sync with the DHCP client

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 2fa5dcfea0 board/common: major refactor of udhcpc script
- New log() function replaces stdout logging
 - New set_dhcp_routes() and clr_dhcp_routes() functions
   - Set all option 121 routes with same metric
   - Set all option 3 routers with increasing metric (this is what the
     reference udhcpc scripts do, and RFC says the routers should be
     listed in order of preference ...)
   - Clearing routes must, like IP addresses, be done both by interface
     and protocol.  This refactor makes sure to delete any DHCP routes
     set on the given interface (in case options change)
 - Use resolvconf per-interface search+nameserver
 - Cache IP lease so we can ask for it back later
 - On deconfig|leasefail|nak, make sure to clean up anything that might
   be lingering from this interface.  E.g., we can get leasefail when a
   server denies our request to prolong a lease.
 - On renew|bound, refresh routes, and set search+dns + NTP servers

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 49aec29a8d board/common: add support for acquiring NTP server from DHCP server
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 945716bdf1 confd: refactor ntp client setup
Move from everything in a single /etc/chrony.conf to a split up with
configuration and server snippets.  The latter comes in the form of
configured (static) and DHCP client (dynamic) server setup.

To accomodate this new scheme we need to detect when serves are removed
from the configuration, so not only have the whole change_ntp() been
refactored, it has been extended with a new pass.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Joachim WibergandMattias Walström 66037ae2de cli: add 'show ntp [sources]' command to admin-exec
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-14 16:40:41 +01:00
Mattias WalströmandTobias Waldekranz 5adff79ad7 netopeer2: Add upstream patch to get submodules when listing modules 2023-12-11 09:10:52 +01:00
Mattias WalströmandTobias Waldekranz 797d69e774 Add support for downloading required yang models automatic 2023-12-11 09:10:52 +01:00
Mattias WalströmandJoachim Wiberg 86557e447f Routing: Fix regression when adding static routes
Add autotest to regresssion suite to catch this
2023-12-07 14:52:00 +01:00
Mattias WalströmandJoachim Wiberg 4bea414f08 IPv6 Static routing: Update documentation 2023-12-07 14:52:00 +01:00
Mattias WalströmandJoachim Wiberg eab3c4d191 Add support for IPv6 static routing
admin@example:/> configure
admin@example:/config/> edit routing control-plane-protocol static name default
admin@example:/config/routing/control-plane-protocol/static/name/default/> set ipv6 route 2001:db8:3c4d:200::/64 next-hop next-hop-address 2001:db8:3c4d:1::1
admin@example:/config/routing/control-plane-protocol/static/name/default/> leave
admin@example:/>

admin@infix-00-01-00:/> show routes ipv6
PREFIX                        NEXT-HOP                      METRIC    PROTOCOL
2001:db8:3c4d:50::/64         eth4                          256       kernel
2001:db8:3c4d:200::1/128      lo                            256       kernel
fe80::/64                     eth3                          256       kernel
fe80::/64                     eth2                          256       kernel
fe80::/64                     eth1                          256       kernel
fe80::/64                     eth0                          256       kernel
fe80::/64                     eth5                          256       kernel
fe80::/64                     eth4                          256       kernel
::/0                          2001:db8:3c4d:50::1           20        static
2023-12-07 14:52:00 +01:00
Mattias WalströmandJoachim Wiberg a31b907bc0 Enable net.ipv6.conf.all.forwarding=1
This since the per interface setting does not work as in ipv4
The only way to limit forward (per interface) for ipv6 is by
using netfilter.
2023-12-07 14:52:00 +01:00
Richard AlpeandMattias Walström 734cc18919 test: change iface e4 state to down in cli unit test
This commit illustrates how to update the system output and
corresponding cli output.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-12-05 10:02:51 +01:00
Richard AlpeandMattias Walström 2661225aeb test: break out unit test and run early in GH actions
Break out unit tests to separate make target as they don't require all
the built code and infrastructure that the normal tests does.

Run the unit tests early in the Github action stage. They don't
require a full build. This will give early feedback to the users.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-12-05 10:02:51 +01:00
Richard AlpeandMattias Walström a9fd58c772 test: add offline unit test for yanger and cli-pretty
In this patch we add some arbitrary system output files which contains
interface data. Such as the output from "ip link" and "ethtool". These
files are used by yanger instead of running the actual commands.

Yanger then generates a lot of YANG json data, which are merged using
jq into something that looks like the sysrepo operational data on
a running system. This data is then passed though cli-pretty and its
ouput is compared to the static expected output in the .txt files in
cli-output.

Here's a basic flow overview.
* system-output/foo.json -> yanger ->> data
* system-output/bar.json -> yanger ->> data
* data -> merge -> sysrepo-operational-data
* sysrepo-operational-data -> cli-pretty -> output.txt
* compare output.txt too cli-output/show-foobar.txt

The result of this is that if something changes in yanger OR in
cli-pretty. The corresponding system-output file needs to be updated
for the test to pass. This is indented to catch regression where the
output is unintentionally changed.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-12-05 10:02:51 +01:00
Richard AlpeandMattias Walström ce37b33390 yanger: use argparse in yanger
This should be a non-functional change in preparation for upcoming
patches.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-12-05 10:02:51 +01:00
Joachim WibergandMattias Walström 415632f3b7 Fix #177: ensure bridge is not bridge port to itself
admin@infix-00-00-00:/> configure
admin@infix-00-00-00:/config/> edit interface br0
admin@infix-00-00-00:/config/interface/br0/> set bridge-port bridge br0
admin@infix-00-00-00:/config/interface/br0/> leave
Error: Must refer to a bridge interface (and not itself). (Data location "/ietf-interfaces:interfaces/interface[name='br0']/infix-interfaces:bridge-port/bridge".)
Failed committing candidate to running: Validation failed

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-05 10:02:25 +01:00
Joachim WibergandTobias Waldekranz d69f51a173 Fix #224: relocate /lib/infix to /libexec/infix
The /lib directory is not intended for executable scripts and programs.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-04 10:24:35 +01:00
Joachim WibergandTobias Waldekranz e644d87c31 Relocate qeneth and 9pm submodules to test/
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-01 20:57:54 +01:00
Joachim Wiberg 531bea0523 Fix #238: disable history in bash wrapper for klish
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-01 16:59:11 +01:00
Joachim Wiberg 5e26c82787 buildroot: bump to latest kkit branch for ugprades of sysrepo et al
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-01 16:45:07 +01:00
Mattias WalströmandTobias Waldekranz b29df19478 infamy: Add support for devices with other default password 2023-12-01 15:58:27 +01:00
Mattias WalströmandTobias Waldekranz 2cdb0a3d18 ietf_routing/static_routing: Fix test stability
Remove all sleeps and replace them with util.until()
2023-12-01 15:58:27 +01:00
Joachim Wiberg 978d08b19a package/klish-plugin-sysrepo: drop developer debug in 'set' command
Also, slight update of error messages in same command.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-12-01 14:28:16 +01:00
Tobias Waldekranz 769b7c2ba1 package/skeleton-init-finit: Run the getty in runlevel 9
Normally, no logins are actually possible, but this will have two
desirable effects effects:

- /etc/issue will be printed when hitting return over the console,
allowing the user to see the bootstrapping errors again, without
having to reboot the system.

- On devleoper builds, with CONFIG_TARGET_ENABLE_ROOT_LOGIN, we can
login as root and debug issues.
2023-11-30 11:39:42 +01:00
Tobias Waldekranz f4a604f63c Prevent non-essential services from running in runlevels > 6
In case failure-config fails to load, we park the system in runlevel
9. In this state, we only want the most essential services running.
2023-11-30 11:39:42 +01:00
Tobias Waldekranz 445fbf7873 confd: Notify user of all bootstrapping issues via login banners
Collect all bootstrapping issues in all banner-like files during boot,
so that they are presented to the user when logging in. This should
make it harder to miss overlook the fact that a system is running in a
degraded state.
2023-11-30 11:39:42 +01:00
Tobias Waldekranz af2b1f95a9 confd: Only move to runlevel 9 if failure-config fails to load
Before this change, the system would move to runlevel 9 as soon as
startup-config failed to load, in which no getty is allowed to run.

Instead, we want to reserve that runlevel for when failure-config
itself also fails to load, since the system will have no valid login
credentials at that point.
2023-11-30 11:39:42 +01:00
Joachim Wiberg f0c99b14dd src/confd: add support for routes set by ZeroConf agent
This fixes [ERR] from CLI `show routes`, and broken operational status
in setups with DHCP client enabled by default.

Feature (static routing) introduced in release cycle, no need to bring
up in release notes.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-30 11:03:16 +01:00
Joachim Wiberg 2428bf9a2c Update ChangeLog for v23.11.0-rc2
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-30 08:04:40 +01:00
Joachim Wiberg 14be582578 .github: ensure the leading 'v' in version is retained
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-30 08:02:39 +01:00
Tobias WaldekranzandJoachim Wiberg 10ece4378b confd: Don't cache libyang module references
As it turns out, references to module objects are not safe to keep
across callbacks. In particular: loading a new model into sysrepo at
runtime may cause it to move objects around in memory.

Therefore, fetch a valid reference to "infix-system" on every callback
instead.
2023-11-29 23:52:37 +01:00
Tobias WaldekranzandMattias Walström c5ba2971e6 test/docker: Add tshark
Needed by new sniffer implementation.
2023-11-29 16:57:48 +01:00
Tobias WaldekranzandMattias Walström 5f299ee151 test/infamy: Generalize wait functionality into "until" 2023-11-29 16:57:48 +01:00
Mattias Walström f7e9c44516 Fix problems when running test on real hardware not qemu
* sniffer did not work correctly
* links did not come upp as quick as in qemu
* must_reach in netns was to narrow, increase timeout
* add wait function to handle poll
2023-11-29 16:57:48 +01:00
Tobias WaldekranzandJoachim Wiberg bf5de743c6 test/docker: Add jq to docker
Needed by upcoming unit tests.
2023-11-29 11:28:14 +01:00
Joachim WibergandTobias Waldekranz 5ed5cca982 package/confd: install avahi _netconf-ssh._tcp service record
Currently we only advertise SSH+SFTP services over mDNS-SD, which are
the default services from the avahi package.  This patch adds support
for _netconf-ssh._tcp as well.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-29 07:34:05 +01:00
Joachim Wiberg 19977a9b32 cli-pretty: fix fallback version and datetime for show software
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-28 15:30:59 +01:00
Joachim Wiberg 18c698fe14 doc: spelling, ordering, and missing markdown link fixes
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-28 14:31:17 +01:00
Joachim Wiberg 481638a343 .github: check for true second level heading as release separator
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-28 14:16:49 +01:00
Joachim Wiberg 67a57ef52e doc: indent table, confuses release action
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-28 14:15:08 +01:00
Joachim Wiberg f61e8e4699 doc: update ChangeLog for v23.11.0-rc1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-28 13:30:09 +01:00
Joachim Wiberg 0ff5b94ec6 klish-plugin-infix: rename command 'erase' -> 'remove' file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-28 11:15:32 +01:00
Joachim Wiberg 09032dc4bb klish-plugin-infix: extend copy command with curl
Allow copy from/to with either datastore, file (in /cfg), or curl.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-28 11:15:32 +01:00
Joachim Wiberg 8f68a35b7b klish-plugin-infix: minor, rename type portar -> ifaces
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-28 11:15:32 +01:00
Joachim WibergandGitHub ada60bd705 src/klish-plugin-infix: fix 'show version' command 2023-11-28 09:43:10 +01:00
Tobias WaldekranzandJoachim Wiberg 985c2fd600 board/aarch64: alder: Disable EEE
Empirical studies shows that the surge protection on the alder board
is not compatible with Energy Efficient Ethernet.

Root cause has not yet been determined.
2023-11-27 16:54:46 +01:00
Henrik NordstromandJoachim Wiberg e26ff791eb Bump greenpak-programmer to v1.2
adds verification of programmed NVMEM / EEPROM
2023-11-27 14:11:06 +01:00
Joachim Wiberg f6c5685da8 doc: update changelog for v23.11-rc1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-27 14:05:56 +01:00
Joachim Wiberg 64aa3b544c package/klish-plugin-sysrepo: fix regression in release cycle
Fix regression in line-drawing characters, introduced in c38c8a4.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-27 14:04:45 +01:00
Tobias Waldekranz e0144ef9a3 board/aarch64: alder: Swap LED colors on 1G ports
On the P2's the only reasonable way (in terms of hardware patching
effort) of driving the LEDs is to have the green LEDs at the top and
the yellow ones at the bottom.
2023-11-27 12:31:58 +01:00
Tobias Waldekranz cf31a2642d board/aarch64: alder: Wire up IRQ to power board GPIOs
Turns out that the gpio-charger doesn't have polled fallback if the
GPIO pin can't function as an interrupt controller.

Fortunately, we have access to the IRQ pin, so we can just use that
for now and leave the driver as-is.
2023-11-27 12:31:58 +01:00
Tobias Waldekranz 1281edbee6 board/aarch64: alder: Swap VIN1/2 to match hardware 2023-11-27 12:31:58 +01:00
Joachim Wiberg 9415c0fb64 src/confd: drop /interfaces/interface/eth:ethernet config deviation
Drop this deviation for v23.11 since it clashes with pyang + NETCONFc client.
We expect to support configuration of speed+duplex in v23.12.

[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-27 10:03:03 +01:00
Joachim Wiberg f679ed7191 Update documentation, interfaces interface foo -> interface foo
With the latest bump of klish-plugin-sysrepo we no longer need the extra
container name in commands and paths.

Also, update the "show interfaces" example in the top-level README.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-27 10:03:03 +01:00
Joachim Wiberg e73e9d75e1 package/klish-plugin-sysrepo: bump for container-list collapse
This adds support for collapsing container-lists where applicable.
E.g., 'edit interfaces interface eth0' -> 'edit interface eth0'.

Great care has been taken to not mess up when container-lists are
critical, like ipv4/ipv6 routes.

Fix #187

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-27 10:03:03 +01:00
Joachim Wiberg 2365ab273a klish-plugin-infix: minor, help help text
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-27 10:03:03 +01:00
Mattias WalströmandJoachim Wiberg 35aa7a37e1 Documentation for routing support 2023-11-27 10:03:03 +01:00
Tobias WaldekranzandJoachim Wiberg e1db5bad78 rauc: Start after D-Bus
On occasion, rauc has problems registering with D-Bus. Ensure that the
D-Bus daemon is running before starting rauc.
2023-11-25 20:37:15 +01:00
Tobias WaldekranzandJoachim Wiberg be728accbb rauc: Remove unsupported argument from finit service stanza
Fixes: 0f410eb ("rauc: add support for tftp:// for bundles and syslog for logging")
2023-11-25 20:37:15 +01:00
Tobias WaldekranzandJoachim Wiberg 2da2e7fd5e confd: Fix failure-config generation when password is missing
Setting admin's password to "!" is not accepted by the model, which
means we end up in RMA mode, even in cases when a valid startup
exists.

Not supplying a password will cause confd to generate a locked
account, which is what we want.
2023-11-25 20:37:15 +01:00
Tobias WaldekranzandJoachim Wiberg e53fd91c7f common: probe: Support default passwords on devicetree based systems
In addition to QEMU, we can now source the factory default password
from real VPD EEPROMs, on systems that use a devicetree.
2023-11-25 20:37:15 +01:00
Tobias WaldekranzandJoachim Wiberg 17d1a529e8 common: qemu: Run without VPD by default
Infix will fallback to admin/admin on a QEMU system.
2023-11-25 20:37:15 +01:00
Tobias WaldekranzandJoachim Wiberg 0a746a9795 common: qemu: Only create VPD if it does not exist
This let's you create a custom one to test out different scenarios
without it being clobbered by qemu.sh.
2023-11-25 20:37:15 +01:00
Tobias WaldekranzandJoachim Wiberg b7cc0935ac common: qemu: Simplify VPD generation
Also, remove the "VBD" terminology. We will only emulate a single VPD
anyway.
2023-11-25 20:37:15 +01:00
Tobias WaldekranzandJoachim Wiberg b5ba1602ec common: onieprom: Don't read more data than needed when decoding TLV
There's little point in reading a 32kB EEPROM do decode a 100B
TLV. Instead figure out how much we need to read from the header.
2023-11-25 20:37:15 +01:00
Tobias WaldekranzandJoachim Wiberg 7679c4137e board/aarch64: alder: Tag VPD memories with board information
This is needed to make informed decisions about which hardware is
available, and what trust level it has.
2023-11-25 20:37:15 +01:00
Tobias WaldekranzandJoachim Wiberg 42d4079c06 board/aarch64: alder: Remove old definition of DDR_TEN MPP
Fixes: b7aa560 ("board/aarch64: alder: Remap SFP9_RX_LOS and DDR_TEN MPPs")
2023-11-25 20:37:15 +01:00
Tobias WaldekranzandJoachim Wiberg cb0f8739ad kernel: Import latest kkit-linux-6.5.y
- Fixes the locking warnings when configuring LEDs on 6393X
- Correctly power up 3310X PHYs strapped to start powered down
- Fix kernel oops when reading from blank NVMEM configured with an
  ONIE layout
2023-11-25 20:37:15 +01:00
Joachim Wiberg 6c6ae844f3 board/netconf: allow default metric 0 for kernel + dhcp routes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 14:29:56 +01:00
Joachim Wiberg 9655f98903 Fix #222: operational status b0rks on unknown route proto
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 14:29:16 +01:00
Joachim Wiberg 2be779718e Fix #221: set MFD_NOEXEC_SEAL flag on memfd
Silence kernel warning seems to be most secure option.  Also, set
MFD_CLOEXEC, because if we ever fork off a child it should never
get a copy of this fd.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 13:42:54 +01:00
Joachim Wiberg 748996dad8 Replace firmware with Linux OS, operating system, or software
We should avoid the use of the ambigous word 'firmware'.

[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 12:35:46 +01:00
Joachim Wiberg b544778cfe doc: update CLI tutorial with a software upgrade section
Also, refresh the list of available commands.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 12:35:46 +01:00
Joachim Wiberg 56c3b4a880 doc: minor updates to the CLI online help text
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 12:35:46 +01:00
Joachim Wiberg 630a005bef cli: add 'show software' command
New command 'show software' to display software versions on each
partition, install date, and which one is currently booted.

admin@infix-00-00-00:/> show software
NAME      STATE     VERSION                DATE
primary   booted    v23.10.0-132           2023-11-23T22:24:33+00:00
secondary inactive  v23.10.0-132           2023-11-23T22:24:33+00:00

admin@infix-00-00-00:/> show software name primary
Name      : primary
State     : booted
Version   : v23.10.0-132-gfd6e8ea
Size      : 61992960
SHA-256   : ed6146aec462b77fb8631b14c48d281dd0f4fdb9c062f9482d863ee854081358
Installed : 2023-11-23T22:24:33+00:00

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 12:35:46 +01:00
Joachim Wiberg 23e4ca3f48 cli-pretty: whitespace fixup only
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 12:35:46 +01:00
Joachim Wiberg df76b4820f klish-plugin-infix: add 'upgrade' command to install software updates
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 12:35:46 +01:00
Joachim Wiberg 938c8aa8c5 klish-plugin-infix: update terse help text for basic commands
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 12:35:46 +01:00
Joachim Wiberg 0f410eb3b2 rauc: add support for tftp:// for bundles and syslog for logging
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 12:35:46 +01:00
Joachim WibergandTobias Waldekranz c55d38df9a Use Kernelkit's IANA Enterprise Number
[skip ci]

Co-authored-by: Tobias Waldekranz <tobias@waldekranz.com>
2023-11-24 08:55:57 +01:00
Joachim Wiberg 9b1739283d confd: missing admin password, set error in /etc/issue & /etc/banner
The bootstrap script gets feedback from gen-admin-auth, on error we no
longer bail out but instead log the error and continue booting.  This
way a developer build with root login can diagnose the error.

When logging the error we also set /etc/issue, /etc/issue.net for local
and remote login services, as well as the dedicated /etc/banner used by
OpenSSH, to hold the error summary.  So when attaching to the console
port, or attempting to log in remotely with SSH, the error is printed
to indicate the device is not healthy.

Finally, since factory-config may be missing we need to bootstrap the
sysrepo db with something else, and fortunately we will always have a
failure-config to fall back on.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 08:55:57 +01:00
Joachim Wiberg f53f985dbc confd: do not fail if pwhash is missing in VPD, instead lock account
If pwhash is missing from system.json, lock account.  This allows for
more extensive diagnosis on developer builds with a root login.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 08:55:57 +01:00
Joachim Wiberg 8141cc13d1 confd: minor shellcheck fixes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 08:55:57 +01:00
Joachim Wiberg fdaface79f probe: use fallback password hash also for qeneth (regression tests)
Break fallback hash to a separate function and allow gen_qemu_system_file()
to return the status.  We'd like to update the qeneth templates to include
the same VPD data as is used with qemu.sh, but for now this is sufficient.

The Qemu detection has been changed to the, slightly more, secure detection
of qemu_fw_cfg filesystem.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 08:55:57 +01:00
Joachim Wiberg ff12ba72b5 confd: exctract password also for failure-config
This patch adds generation of the 20-authentication.json snippet also
for failure-config.  The gen-admin-auth script is extended with shell
parameter, since the default shell differs from factory-config.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 08:55:57 +01:00
Richard AlpeandJoachim Wiberg 63a34d570d Use default pwd hash from VPD in QEMU
This commit does several things. Its end goal is to fetch the admin
password hash from VPD memory during factory bootstrap.

To accomplish this probe creates a new file /run/system.json with
information read from a fw_cfg QEMU partition. The data from
/run/system.json is then later used during config bootstrap to fill in
the factory administrator password.

The idea is to make QEMU behave the same way hardware does, i.e. a
default/factory password should be fetched and used from
"hardware memory". The hardware portion of this is yet to be done.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-11-24 08:55:57 +01:00
Richard AlpeandJoachim Wiberg 17093eba22 confd: disable admin login in failure config
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-11-24 08:55:57 +01:00
Tobias Waldekranz 1e9cd310f8 board/common: Add self-provisioning scripts
This let's you netboot a system with a blank block device, and setup
all partitions, filesystems, images etc.
2023-11-23 12:18:28 +01:00
Tobias Waldekranz 252b894d55 rauc: Source service arguments from /etc/default, if available
This is need by upcoming provisioning scripts.
2023-11-23 12:18:28 +01:00
Tobias Waldekranz 98b9ca99cd defconfig: Build tools needed to self-provision Infix
Upcoming changes will add scripts to provision Infix to a blank block
device, which need these tools.
2023-11-23 12:18:28 +01:00
Tobias Waldekranz f258e030bd confd: Fix shellcheck warnings in gen-interfaces 2023-11-23 12:18:28 +01:00
Tobias Waldekranz 7f049db21f confd: Remove -6 option from gen-interfaces
With the behavior introduced in the referenced commit, port
interfaces (i.e. all ports on many systems) no longer get any SLAAC
address, leaving the user with no way of reaching the system.

Comment says this is by design, but that seems like an awkward
default.

Remove the option, and simplify gen_interfaces to either
- Enable SLAAC, if the port is not going to be part of any bridge, or
- Disabel SLAAC, if the port is going to be part of a bridge

If necessary, we can add an inverse option at a later date.

Fixes: d0f3960 ("confd: add -6 option to gen-interfaces for SLACC on port interfaces")
2023-11-23 12:18:28 +01:00
Tobias Waldekranz b7aa56071d board/aarch64: alder: Remap SFP9_RX_LOS and DDR_TEN MPPs
Layout changed from P1 to P2 becasue DDR_TEN must be connected to an
MPP with an internal pull-down, which MPP24 (old SFP9_RX_LOS) has.
2023-11-23 12:18:28 +01:00
Mattias Walström a0a80c8b77 Rename infix-routing to correct date
Should be 2023 not 2013.
2023-11-23 10:30:26 +01:00
Mattias Walström 37f7b5ba92 Add support for reading routing operational data for IPv4
In the CLI:
admin@infix-00-00-00:/> show routes
PREFIX                        DESTINATION                   PROTOCOL  METRIC
1.1.1.0/24                    e0                            kernel
192.168.100.0/24              1.1.1.1                       static    20
192.168.110.2/32              blackhole                     static    20
192.168.120.2/32              blackhole                     static    20
192.168.130.2/32              unreachable                   static    20
2023-11-23 10:30:26 +01:00
Jon-Olov VatnandJoachim Wiberg 6cfcf3ca10 Fixing and activating ieee802-ethernet yang deviations 2023-11-22 13:44:28 +01:00
Jon-Olov VatnandJoachim Wiberg 6669fee728 Draft infix deviations for ieee802-ethernet-interfaces
- Add deviations for non-supported statistics
- Limit config, currently we only have ro support
- Add deviations for non-supported configs and status leafs

[skip ci]
2023-11-22 13:44:28 +01:00
Joachim Wiberg 4bcac85e69 doc: helpful note to devs about re-enabling the root user for debug
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-22 12:04:05 +01:00
Joachim Wiberg 4c6d868627 Fix #215: impossible to enable NTP client
Regression introduced in ac0b0d5.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-21 19:24:05 +01:00
Joachim Wiberg c38c8a46ce package/klish: simplify, drop confusing comments
Also, change socket file path from /tmp to /run, as is customary.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-21 08:06:06 +01:00
Joachim Wiberg b6b03e4903 package/klish: simplify, maintain local version of klish.conf
Also, add -S option to less, which causes lines longer than the screen
width to be chopped (truncated) rather than wrapped.  With available
terminals supporting xterm a user can scroll right on really long lines.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-21 08:06:06 +01:00
Joachim Wiberg 69d0c16e30 src/klish-plugin-infix: show JSON of running-config
The default srp_show@sysrepo function creates the stripped down version
of running-config that, in the context of showing startup-config or the
factory-config, is very difficult to explain to users why they differ in
format.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-21 08:06:06 +01:00
Joachim Wiberg 30641cb243 package/klish: fix loss of Ctrl-C to abort current line edit
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-21 08:06:06 +01:00
Joachim Wiberg f32e2faf11 board/netconf: wrap klish in a fuzzy warm blanket
Having klish as the login shell means losing lots of neat features we've
gotten used to: help text in less pager, initial terminal probing on the
console, and more.

This commit replaces the clish -> klish symlnk with a fuzzy bash wrapper
that fixes all the above annoying little things.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-21 08:06:06 +01:00
Tobias WaldekranzandJoachim Wiberg 7e7d25d82e board/common: mnt: Remove old clixon remnants 2023-11-21 08:05:02 +01:00
Tobias WaldekranzandJoachim Wiberg 0a51b5e8e9 board/common: mnt: Be slightly less inconsistent with quoting 2023-11-21 08:05:02 +01:00
Tobias WaldekranzandJoachim Wiberg 2bfc524546 board/common: mnt: Correctly reset /var as part of a factory-reset
Before this change, the following would happen in /lib/infix/mnt if a
factory-reset was performed:

1. Copy the contents of /var from Squash into /mnt/var and bind mount
   /mnt/var over /var
2. Check for factory-reset
3. Clear /mnt/cfg/* and /mnt/var/*
4. Mount overlays

This ordering leaves the system with a completely empty /var on the
boot when a factory-reset is executed. Finit will fixup some of this
via its tmpfiles scripts, but we want the ability to ship files under
/var as part of the Squash and have these be available after the bind
mount, just like what happens at every other boot, when we don't
perform a factory-reset.

We solve this by delaying the bind mount (1) until after the reset has
been performed, together with all the overlays (4). While we're here,
make the fallback case, where no persistent /var is available, use a
bind mount as well. This should allow containers to be tested on such
setups, and it's one less flavor to test.

New order:

1. Check for factory-reset
2. Clear /mnt/cfg/* and /mnt/var/*
3. Mount overlays
4. Copy the contents of /var from Squash into /mnt/var and bind mount
   /mnt/var over /var

Now the only difference between a regular boot and a
"factory-reset-boot" is whether (2) executed or not.
2023-11-21 08:05:02 +01:00
Joachim Wiberg 5db84ddec6 Jack's hard-earned badges
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-20 13:34:19 +01:00
Joachim Wiberg ac63461bd8 confd: fix copy-paste error in dns-resolver
Found by Coverity Scan, CID 331048

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-20 13:34:19 +01:00
Joachim Wiberg 123808d6bb confd: check return value of mktime()
Found by Coverity Scan, CID 331032

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-20 13:34:19 +01:00
Joachim Wiberg b2331dc8ce confd: minor, coding style
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-20 13:34:19 +01:00
Joachim Wiberg 31bd1286a3 confd: minor, whitespace
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-20 13:34:19 +01:00
Joachim Wiberg da6b5a1950 confd: mark unchecked remove()/rename() as intentional
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-20 13:34:19 +01:00
Joachim Wiberg 1b825d4ac6 confd: fix memory leak in handle_sr_shell_update()
Found by Coverity Scan, CID 331029

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-20 13:34:19 +01:00
Joachim Wiberg 90af510092 confd: fix memory leak in handle_sr_passwd_update()
Found by Coverity Scan, CID 331033

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-20 13:34:19 +01:00
Joachim Wiberg c3045ecebb confd: fix obvious mistakes in checking return values
Found by Coverty Scan

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-20 13:34:19 +01:00
Joachim Wiberg f56baeb4fa confd: drop malplaced sr_free_values()
We haven't even called sr_get_items() yet.  Must've been a remnant
of an earlier refactor.

Fixes CID 331051

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-20 13:34:19 +01:00
Joachim Wiberg 2191202f2a statd: null terminate recv() buffer from netlink
Fixes CID 331053

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-20 13:34:19 +01:00
Tobias WaldekranzandJoachim Wiberg a4d02630c9 board/netconf: Define standard behavior for port LEDs
By default, assume that any LED with the function "tp", "sfp" or
"port" is attached to either an Ethernet PHY or MAC, with support for
offloading the "netdev" trigger.

Use green LEDs to indicate link/activity.

Disable any yellow LEDs for now, later on we can add alarm indications
etc. to these.
2023-11-19 08:50:19 +01:00
Tobias WaldekranzandJoachim Wiberg 6ce7f01d64 package/iito: Bump to 1.1.0
Needed to fix a memory leak, and to get access to the new "led-group"
driver.
2023-11-19 08:50:19 +01:00
Tobias WaldekranzandJoachim Wiberg 365ad5d565 board/aarch64: alder: Add LED setup for 1G ports 2023-11-19 08:50:19 +01:00
Tobias WaldekranzandJoachim Wiberg c4f8dadde0 board/aarch64: alder: Add LED setup for 10G ports 2023-11-19 08:50:19 +01:00
Tobias WaldekranzandJoachim Wiberg 405aa6510d kernel: Enable netdev LED trigger
This trigger can be offloaded into hardware by the PHY or MAC LED
attached to the netdev in question.
2023-11-19 08:50:19 +01:00
Tobias WaldekranzandJoachim Wiberg febb998702 kernel: Bump to 6.5.11 + kkit-linux-6.5.y
6.5.11: Pull latest fixes from stable tree

kkit-linux-6.5.y: LED support for 88X3310 PHY and 88E6393X switch.
2023-11-19 08:50:19 +01:00
Tobias WaldekranzandJoachim Wiberg 55afbb2a94 board/netconf: Only use iitod on netconf builds
None of the panic/failure/startup conditions make any sense on classic
builds where confd is not running.
2023-11-19 08:50:19 +01:00
Joachim Wiberg 072c3c6394 configs: enable our LED daemon iito in default builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-18 16:13:56 +01:00
Joachim Wiberg aceafb7555 package/iito: fix copy-paste error from confd.mk
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-18 16:13:27 +01:00
Joachim Wiberg 0810163528 configs: add missing iproute2 package, regression in 5031ff6
When dropping the net package in 5031ff6, a rebuild + test was not made
before pusing to main.  As a result Infix suddenly lost one of its most
important packages, iproute2.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-18 16:02:19 +01:00
Joachim Wiberg cc6232bf38 package/iito: relocate Finit conf and add tmpfiles.d for /run/led
Relocate Finit conf to package, like klish and confd.  Add condition to
ensure it is not started before mdev/udevd are up and kernel LED modules
have been loaded properly.

Also, add tmpfiles.conf to ensure /run/led is recreated at every boot.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-18 14:49:56 +01:00
Joachim Wiberg 2caf729ee8 github: enable building local src in host mode for analysis
Install libyang and sysrepo from source, too old packages in ubuntu-latest.

[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-17 18:04:18 +01:00
Joachim Wiberg 005eb58958 src: add support for host build check, for Coverity Scan
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-17 12:59:39 +01:00
Joachim Wiberg ff69fcfa69 libsrx: make autogen.sh executable
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-17 10:40:18 +01:00
Joachim Wiberg 41a14d3ca6 statd: refactor Makefile for host build
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-17 10:40:18 +01:00
Joachim Wiberg c529f06cf0 statd: fix gcc warning, "format not a string literal"
error: format not a string literal and no format arguments [-Werror=format-security]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-17 10:40:17 +01:00
Joachim Wiberg 04046437d7 confd: fix gcc warnings, "format not a string literal"
error: format not a string literal and no format arguments [-Werror=format-security]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-17 10:40:17 +01:00
Joachim Wiberg f7d1a72511 confd: tell automake about generated files for cleaning
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-17 10:40:17 +01:00
Joachim Wiberg 5031ff6224 net: drop unused 'net' package, replaced by dagger
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-17 09:49:32 +01:00
Mattias WalströmandJoachim Wiberg 1fd98758ba frr: add specific configuraion file
The new default behaviour is one gigantic file (frr.conf)
2023-11-17 07:19:28 +01:00
Mattias WalströmandJoachim Wiberg 2bcc9dbb3a vlan_ping: add some negative test
Test that it works when removing interfaces.
2023-11-17 07:19:28 +01:00
Mattias WalströmandJoachim Wiberg 171824c570 Add more memory to qemu devices
Since we now have FRR, there is not much memory left.
2023-11-17 07:19:28 +01:00
Mattias WalströmandJoachim Wiberg ef740a8abc test: routing/static_routing: Sleep some to wait FRR startup
This should be replaced with reading the operational status.
2023-11-17 07:19:28 +01:00
Mattias WalströmandJoachim Wiberg e6de267e29 Update qnenth submodule
Make the ports for the console at the qemu instances deterministic
2023-11-17 07:19:28 +01:00
Mattias WalströmandJoachim Wiberg 10b4b761c5 Routing: Limit to one instance per routing protocol 2023-11-17 07:19:28 +01:00
Mattias WalströmandJoachim Wiberg 85386382e3 Add FRR do defconfig 2023-11-17 07:19:28 +01:00
Mattias WalströmandJoachim Wiberg 4ea1a682da Add test-case for a static routing 2023-11-17 07:19:28 +01:00
Mattias WalströmandJoachim Wiberg a4cb66b642 infix-routing needs to be imported before infix-interfaces
Due to that infix-routing has a deviated node that depends on
a deviated node in infix-interfaces.
2023-11-17 07:19:28 +01:00
Mattias WalströmandJoachim Wiberg 4768cae603 Expose ports 9000-9050 for console connections outside docker 2023-11-17 07:19:28 +01:00
Mattias WalströmandJoachim Wiberg 0b1bd9e8a0 Implement IPv4 static routing in ietf-routing
Only config no operational state yet.

routing
  routing/control-plane-protocols
     control-plane-protocol static name default
        static-routes
          ipv4 route 192.168.200.0/24 next-hop special-next-hop blackhole
2023-11-17 07:19:28 +01:00
Mattias WalströmandJoachim Wiberg 03dbb409eb static-routing: Add model for ipv4/ipv6 routing 2023-11-17 07:19:28 +01:00
Henrik NordstromandJoachim Wiberg b36568bcb7 board/aarch64: alder: Watchdog support 2023-11-16 19:51:52 +01:00
Joachim Wiberg e7c6f255fd .clang-format: drop green goblin alignment
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-16 10:35:43 +01:00
Joachim Wiberg e26208afeb confd: reindent with new .clang-format (example)
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-16 10:35:43 +01:00
Joachim Wiberg 36175f599e Some use-package help for Emacs users
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-16 10:35:43 +01:00
Joachim Wiberg 715d17f475 statd: minor, cleanup, license headers
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-16 10:35:43 +01:00
Joachim Wiberg 485e4256a3 confd: minor, whitespace
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-16 10:35:43 +01:00
Joachim Wiberg 8af048462d src: proposed coding style for C, Linux++
The intention of this is to serve as a help/guidance for both devs and
reviewers of pull requests.

Baseline is taken from Linux v6.5.6, with some (possibly) controversial
additions (at the end of the file):

 - Do not enforce max line length
 - Alignment of variables, both when assigning and declaring
 - Use spaces to adjust when leading tabs are not enough (as Emacs)

I've also added a couple of exceptions for macros like TAILQ_FOREACH()
which are used as control statments (if, while, for), so the opening
brace should be on the same line -- otherwise clang-format thinkts we
are creating a recursive function ...

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-16 10:35:43 +01:00
Joachim Wiberg c867c8bd15 .github: initial workflow for Coverity Scan
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-16 10:06:23 +01:00
Joachim Wiberg 0de25f9c19 patches/netsnmp: add pid readiness signaling for Finit
This patch adds PID readiness notification to Net-SNMP.  This is
required for synchronizing processes like subagents.

PID readiness is similar to systemd READY=1 notification, which
Finit supports, but Net-SNMP only supports that at first startup
not after SIGHUP.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-15 15:09:14 +01:00
Richard AlpeandJoachim Wiberg d6928b933c statd: add speed to op data store and cli
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-11-15 15:08:40 +01:00
Richard AlpeandJoachim Wiberg 9ccb6bfd2d statd: add duplex to op data store and cli
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-11-15 15:08:40 +01:00
Richard AlpeandRichard Alpe 090a852644 statd: rewrite "backend" in python3
There should be no functional change in this patch.

In this patch we rewrite the data collection in python3. This is the
new script called "yanger". It runs various commands on the system,
such as "ip" and "ethtool". It then mangles the output data from these
commands into valid YANG data.

The yanger script is started from the sysrepo callback in the statd c
code. Its output is parsed using lyd_parse_data_fd().

This means that the daemon part of statd is still written in c and the
new python code is only used when getting a query callback from
sysrepo. The c code still handles the interface netlink messages from
the kernel which controls what interfaces statd should do sysrepo
subscribe/unsubscribe to.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-11-15 14:35:17 +01:00
Richard AlpeandRichard Alpe 9f4e12f8f5 libsrx: expose fsystemv()
Expose fsystemv() in header and remove static. This function can be
useful for others that needs to be in control of any output stream.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-11-15 14:35:17 +01:00
Richard AlpeandRichard Alpe f2919a2e44 cli: handle missing type and phys-address gracefully
Avoid crashing if they are missing from the input data.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-11-15 14:35:17 +01:00
Tobias WaldekranzandJoachim Wiberg de5b0061a8 common: Define standard LED behavior
Provide a set of standard rules for commonly available LEDs.
2023-11-14 16:41:03 +01:00
Tobias WaldekranzandJoachim Wiberg 2b7119b332 iito: Add package
Used to control LEDs based on system state.
2023-11-14 16:41:03 +01:00
Tobias WaldekranzandJoachim Wiberg 6d655d3f5e board/aarch64: alder: Add power supply status support
Add a gpio-charger for each input and wire up the alert LEDs to
trigger when their respective supply goes offline.
2023-11-14 16:41:03 +01:00
Tobias WaldekranzandJoachim Wiberg 2a9e87ea75 board/aarch64: alder: Update LED mapping
Also, blink the red boot LED during the kernel boot phase.
2023-11-14 16:41:03 +01:00
Tobias WaldekranzandJoachim Wiberg e454c4a8b6 board/aarch64: alder: Add power board related drivers
- I2C GPIO expanders, mainly used for LED control and power-good
  inputs

- LED blink support
2023-11-14 16:41:03 +01:00
Tobias WaldekranzandJoachim Wiberg 436f597aba board/aarch64: alder: Explicitly set USB role
This silences warnings from the kernel about implicitly selecting host
mode.
2023-11-14 16:41:03 +01:00
Tobias WaldekranzandJoachim Wiberg 9feed50d08 common: onieprom: Encode/decode ONIE EEPROMs from/to JSON 2023-11-14 16:41:03 +01:00
Joachim Wiberg c1fd4506e6 test: validate defconfigs, ensure root login is disabled
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-14 10:20:00 +01:00
Joachim Wiberg b4eb4508e4 configs: disable root login in NETCONF builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-14 10:20:00 +01:00
Ahmed KaricandJoachim Wiberg b43e4ce008 doc: added instructions for package override using local.mk 2023-11-14 10:11:09 +01:00
Joachim WibergandMattias Walström 9f792d56d6 package/skeleton-init-finit: hardening, no login services in RMA
When Infix Fail Secure Mode ends up in RMA state, runlevel 9, we should
not allow Finit to "time out" and give us a login prompt.  Instead we
disable all login services in runlevels 7-9, reserving these extra
levels for future failure modes.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-13 10:28:47 +01:00
Joachim WibergandMattias Walström 54ae8aaf8b src/klish-plugin-infix: change shell from /bin/sh to /bin/bash
Most defconfigs have Bash enabled, those that do not will have the
BusyBox symlink to ash.

This fixes the completion isses we've seen with initctl.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-13 10:28:47 +01:00
Joachim WibergandMattias Walström ab799c0622 src/klish-plugin-infix: minor, add missing keyword in help text
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-13 10:28:47 +01:00
Joachim WibergandMattias Walström 608f82afd6 Mark known services as 'notify:none', no readiness notification
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-13 10:28:47 +01:00
Joachim WibergandMattias Walström 2e1e99bbb0 package/finit: bump to v4.6
Mostly a Bug fix release.  Only major change is support for service
`notify:pid` and `readiness none` global option to change how Finit
expects readiness notification.

Fixes:

- Dbus and runparts regression in Finit v4.5.  The configure script must
  expand `FINIT_RUNPATH_` before defining it in `config.h`

- Service environment variables drop everything but the first argument,
  e.g., `VAR="foo bar qux"` drops everything but `foo`

- Internal conditions, e.g., `<int/bootstrap>` turn into flux when
  leaving bootstrap, causing depending services to stop

- Global environment variables declared with `set VAR=NAME` do not drop
  leading `set `, causing `'set VAR'='NAME'` in env.

- Sanity check environment variables, for services and globally.  Ensure
  the variable name (key) does not contain spaces, or a leading `set `

https://github.com/troglobit/finit/releases/tag/4.6

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-13 10:28:47 +01:00
Joachim WibergandGitHub 4930fa78a8 board/common/rootfs/etc/nginx: drop, unused
[skip ci]
2023-11-13 10:16:17 +01:00
Joachim Wiberg 3807d0bcbc doc: How to Customize Services in Hybrid Mode
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-08 17:21:00 +01:00
Joachim WibergandTobias Waldekranz 32c2319311 Fix #198: no defult PVID for a VLAN filtering bridge
- drop bridge pvid setting in YANG model, we require bridge ports to
   have explicit VLAN assignment (security)
 - refactor bridge_vlan_settings(), do not enable vlan_filtering if
   there are no VLANs configured on the bridge

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-08 16:03:28 +01:00
Mattias Walström 4889d402ec Use proper mkfs.ext4 when creating /var and /cfg partitions
Without this it used an genimage internal one, which did not set
the filetype feature on the filesystem. This caused
podman to refuse to start
2023-11-08 14:16:57 +01:00
Jon-Olov VatnandJoachim Wiberg 8e152d8db3 Fixing typos 2023-11-08 11:18:23 +01:00
Jon-Olov VatnandJoachim Wiberg 349011dc2d Extending VLAN Filtering Bridge documentation (PVID etc)
Adding missing information
- that PVID should (typically) be set for ports associated untagged
- that the bridge should associated with VLAN to terminate the VLAN
  in the bridge
2023-11-08 11:18:23 +01:00
Jon-Olov VatnandJoachim Wiberg 6a9a6780fa Extending the VLAN inteface documentation (picture and example)
Providing an additional config example (VLAN atop brigde)
Adding picture for this and the existing example (VLAN atop Eth)
Adding info on name conventions (eth.20 vs vlan10)
[skip ci]
2023-11-08 11:18:23 +01:00
Joachim Wiberg abb3952fb7 klish-plugin-infix: sync interactive command changes with upstream
Upstream has replaced interactive="true" with:

 - in="tty"
 - out="tty"
 - interrupt="true"

Also, disable Oneliners option since it's too confusing for users
compared to the regular JSON output for startup and factory-config

We can [skip ci] since we do not have any CLI tests yet.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-08 11:17:41 +01:00
Joachim Wiberg 7cbaebc435 klish: fix line drawing characters
For some reasone upstream changed the Pager (less) from -r to -R, to
explictly only allow ANSI color sequences.  This caused the 'show
interfaces' command to output <EF><33><13> style replacement chars
instead of UTF8 line drawing characters.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-08 11:17:41 +01:00
Joachim Wiberg 42ad40f905 rootfs: minor adjustments to /bin/yorn output formatting
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-08 11:17:41 +01:00
Joachim Wiberg 829b4061f6 confd: drop developer debug message
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-07 23:36:51 +01:00
Joachim Wiberg 1f618a5193 Fix #111: upgrade Klish & C:o to fix inference callbacks
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-07 23:36:51 +01:00
Joachim Wiberg 500ae3f8dd Fix #125: improve feedback on invalid configure input
This is an attempt at improving the error reporting from klish-plugin-infix,
or more specifically commit@infix.  Previously none of the sysrepo errors were
shown, now all the latest errors, as well as a few new ones specific to
interfaces have been added.

Example (eth0 does not exist):

    admin@infix-00-00-00:/config/> edit interfaces interface eth0
    admin@infix-00-00-00:/config/interfaces/interface/eth0/> leave
    Error: Mandatory node "type" instance does not exist. (Data location "/ietf-interfaces:interfaces/interface[name='eth0']".)
    Failed committing candidate to running: Validation failed
    admin@infix-00-00-00:/config/interfaces/interface/eth0/> set type ethernet
    admin@infix-00-00-00:/config/interfaces/interface/eth0/> leave
    Error: Cannot create fixed Ethernet interface eth0, wrong type or name.
           Please check your changes, try 'diff' and 'do show interfaces'.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-07 23:36:51 +01:00
Richard AlpeandJoachim Wiberg ff7b8ec9bf cli: speedup detailed interface view
This affects CLI command such as:
> show interface name p1

Prior to this patch, this took roughly ~1200ms on hardware and with
the path it takes roughly 50ms.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-11-06 20:12:16 +01:00
Richard AlpeandJoachim Wiberg 5b58c60919 test: cli: use random ipv4 addresses in bloated.json
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-11-06 20:10:43 +01:00
Richard AlpeandJoachim Wiberg e1080a5412 test: cli: use random ipv6 addresses in bloated.json
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-11-06 20:10:43 +01:00
Richard AlpeandJoachim Wiberg 8d2c3f862a test: cli: use random mac addresses in bloated.json 2023-11-06 20:10:43 +01:00
Richard AlpeandJoachim Wiberg 429e1463af cli: add support for printing veth pair
They have link set in there json data from ip link show.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-11-06 20:10:43 +01:00
Richard AlpeandJoachim Wiberg c0a1c7f259 cli: print iface auto-negotiation in detailed view
Print autoneg status as "on" or "off" if the data exists in the
operational datastore.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-11-06 11:28:53 +01:00
Richard AlpeandJoachim Wiberg 13092757a1 statd: add auto-negotiation status to op datastore
Add a python3 script "ethtool-to-json" which runs ethtool locally and
converts output which we are interested in into json. The script
simply json encodes the output from ethtool, i.e. it does not print it
in YANG format. This might be a good idea to change in the future if
the C code has to do a lot of ethtool to YANG translations.

The json output of the ethtool-to-json script is then parsed in C
using libjansson, translated to YANG and added to the operational
datastore.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-11-06 11:28:53 +01:00
Joachim Wiberg 40ac1595e5 .github: revert b4d7609, does not work as intended
The idea was to change regression tests to opt-in, but it does not work
as intended for our core devs, so revert.

If you do *not* want the workflow(s) to run on your fork, you can
disable them with the [...] button on the right-hand side, beside the
"Filter workflow runs" text entry, in the Actions view of your fork.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-06 10:04:03 +01:00
Mattias WalströmandJoachim Wiberg 69652280d8 Update documentation for VLAN configuration 2023-11-06 09:22:48 +01:00
Joachim Wiberg fd58eaba4c package/finit: backport critical runpath fix from upstream
Both the dbus plugin and runparts were slightly broken in Finit v4.5.
For details, see https://github.com/troglobit/finit/issues/383

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-05 23:57:48 +01:00
Joachim Wiberg c927578731 doc: fix nested HERE document for easy copy-paste to terminal
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-05 23:57:26 +01:00
Joachim WibergandTobias Waldekranz 62401377b0 Check for factory-reset condition from bootloader
Refactor factory-reset check slightly to check for a Finit condition
from the bootloader, as well as a custom check for br2-externals.

Note, the chgrp call has been extended to ensure admin users have
permission to create any file or directory in any overlay.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-03 12:55:44 +01:00
Joachim WibergandTobias Waldekranz d0f3960d71 confd: add -6 option to gen-interfaces for SLACC on port interfaces
This change updates the documentation for the script, hopefully it is
more readable now than the previous wall of text.

Also, a new -6 option to toggle IPv6 SLACC option for port interfaces.
This, in combination with omitting the -b option, allows for enabling
SLACC on interfaces that would otherwise not get an address.

No functional change, tested manually [skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-03 12:55:44 +01:00
Joachim Wiberg 64222bdac3 ChangeLog: corrections and minor cleanup of 23.10 release
When released the YANG status section claimed IPv4/IPv6 MTU was
not-supported, which was very confusing since the following Changes
section clearly states added support for it.

The YANG Status section was wrong.  It has also been cleaned up a bit.
E.g., no need to mention which native model provides an augment or a
deviation, to an end-user the only thing that matters is what is added
to or removed from the standard models.

[skip ci] becuase none of this warrants a rebuild.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-03 08:20:44 +01:00
Joachim Wiberg a591eeebce confd: fix description whitespace in native model
No logical change, keeping modification date and revision.  We may be
stricted in the future with this.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-03 08:16:04 +01:00
Joachim Wiberg 72b0f9f3eb board/common: add missing $VERSION to /etc/os-release PRETTY_NAME
Per spec[1], the PRETTY_NAME "May or may not contain a release code name
or OS version of some kind, as suitable." and seeing as this is not only
a common practice, Finit use this string in the heading when booting.

We've had this already in Infix a while back so it must have been lost
in one of many refactoring rounds.

[1]: https://www.freedesktop.org/software/systemd/man/latest/os-release.html

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-02 07:00:49 +01:00
Joachim WibergandTobias Waldekranz b7a0c7cf1f doc: add section Factory Defaults to branding document
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-01 21:50:47 +01:00
Joachim WibergandTobias Waldekranz 202b08d34d confd: allow overriding confdrc settings in a confdrc.local
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-01 21:50:47 +01:00
Joachim WibergandTobias Waldekranz 2c69be68e1 confd: minor, move placement of conditions to first row
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-01 21:50:47 +01:00
Joachim WibergandTobias Waldekranz d05de543e4 klish: update system path to factory-config
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-01 21:50:47 +01:00
Joachim WibergandTobias Waldekranz 87378b4fe3 confd: fix and simplify .json snippet collation to factory-config
First, fix collation of .json snippets to ensure they are sorted by
number, regardless of which directory they originate from.

Second, and with an unexpected twist, use /etc as the target directory
for factory-config.cfg and failure-config.cfg.  At first just to avoid
having the resulting .gen and .cfg files in /run/confd/, but it also
unintentionally gives us a way to provide a static /etc/factory-confg
in the image.  As the TODO says, not perfect but better than before.

Third, update load script to use the same base path as bootstrap by
sourcing the system /etc/confdrc.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-01 21:50:47 +01:00
Joachim Wiberg 69a3663a82 board/common: expose settings for Qemu machine and its RAM size
A customer specific build required more RAM to boot (bigger image and
more features), but there was no way to modify this as an end user.

This patch opens this up and should give our users a more smooth ride!

We can [skip ci] on this, no functional changes to the OS itself.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-31 18:21:09 +01:00
Richard AlpeandJoachim Wiberg 3bd104a46c cli: use pwgen secure and increase password length
Adhere to our recommendations and avoid pseudorandom passwords which
are "easy to remember". Also increase password length to 13 chars.

Side notes:
Knowing that a password contains at least one char, one number and so
on, lowers the number of possible passwords to test when brute forcing.

The entropy for the pwgen "easy to remember" passwords isn't good
(naturally).

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-31 13:16:37 +01:00
Joachim Wiberg 85a1bfc999 .github: add support for manually starting a release build
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-31 11:29:36 +01:00
Joachim Wiberg 5ebd473972 Update ChangeLog for Infix v23.10 [skip ci]
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-31 10:09:01 +01:00
Richard AlpeandJoachim Wiberg 12462d5b17 statd: add more ethtool counters to op datastore
Add counters from Ethtool groups to the operational datastore. The
mapping from Linux / Ethtool to YANG is described in the included
document eth-counters.md.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-31 10:01:55 +01:00
Joachim WibergandTobias Waldekranz afbf92c07e configs: drop x86_64_minimal_defconfig
Replaced with full build in GitHub Actions.  No other use-cases for it,
and too much of a hassle to maintain, so remove.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-31 09:28:28 +01:00
Joachim WibergandTobias Waldekranz 552550495a configs: reenable lost bash for netconf builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-31 09:28:28 +01:00
Joachim WibergandTobias Waldekranz 6503face19 package/finit: bump to v4.5
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-31 09:28:28 +01:00
Mattias Walström 90d94fe255 Remove ietf-if-vlan-encapsulation, it is replaced by infix-if-vlan
This is a followup for 941fc3158
2023-10-31 09:16:58 +01:00
Joachim WibergandTobias Waldekranz fc5310b3fd confd: adjust path to failure-config
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-30 12:48:14 +01:00
Joachim WibergandTobias Waldekranz 120e87ac99 confd: sort interfaces according to length and name
A list of interfaces: x10 x9 x8 x7 x6 x5 x4 x1 x2 x3 should be sorted in
order with x10 last.  Using the common 'sort -n' would generate: x1 x10
x2 ... so we use version sort.  This way we can ensure that the order of
bridge ports is natural and what end users expect.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-30 12:48:14 +01:00
Joachim WibergandTobias Waldekranz 7fd7a2e430 confd: regenerate failure-config and factory-config on each boot
Operational experience shows that the current Infix Fail Secure mode,
introduced in ca9daef, does not work in practice.

The factory datastore in sysrepo is created at boot with the YANG models
and the factory-config file.  When the factory-config file is generated
from older versions of these models, the resulting datastore may fail to
pass the validation and system will end up in an unrecoverable state.

Instead, both the factory-config and failure-config must be created at
every boot to match the YANG models in the active Linux image.  This
ensures loading the YANG models will always work and the system can
proceed to attempt to load startup-config to the running datastore.

If loading startup-config fails we can fall back to failure-config,
which like factory-config, will then provide a way to log in an dianose
the system.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-30 12:48:14 +01:00
Tobias WaldekranzandJoachim Wiberg c385e2e9c2 uboot: Import latest patches from u-boot-2023.07.y-kkit
Adds enough support for 6393X switchcore to enable netbooting from a
single port.
2023-10-30 11:24:18 +01:00
Tobias WaldekranzandJoachim Wiberg 97747a95ea common/uboot: Use factory-reset and dev-mode buttons, if available
If the bootloader knows about a factory-reset or dev-mode button, use
them to allow stopping the boot process, and to signal the
factory-reset condition to infix.
2023-10-30 11:24:18 +01:00
Tobias WaldekranzandJoachim Wiberg 01e43896df common/uboot: Explicitly separate kernel/user arguments
This way, we avoid arguments intended for userspace to be accidentally
parsed by the kernel.
2023-10-30 11:24:18 +01:00
Tobias WaldekranzandJoachim Wiberg 60c777fb41 common/uboot: If no valid boot media exists, fall back to netboot
This means that a device with a valid bootloader, but a completely
empty eMMC is still salvageable.
2023-10-30 11:24:18 +01:00
Tobias WaldekranzandJoachim Wiberg 194aa5de8a common/uboot: Use correct name of netboot in default order 2023-10-30 11:24:18 +01:00
Tobias WaldekranzandJoachim Wiberg 47fe0529f4 arm-trusted-firmware: Default to 16-bit DDR4 on CN9130 boards 2023-10-30 11:24:18 +01:00
Mattias WalströmandJoachim Wiberg 941fc31581 infix-vlan: Create a custom vlan model
This implements the new model infix-if-vlan.
The new CLI is:

root@infix-00-00-00:/config/interfaces/interface/vlan10/> set vlan id 10 lower-layer-if eth0

with an possible extra option for tag-type, default tag-type is c-vlan.
2023-10-27 10:53:55 +02:00
Joachim Wiberg be8bad9885 doc: add Versioning section to branding document
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-24 13:51:27 +02:00
Joachim Wiberg e03ab9c81b board/common: add help text for Qemu interface model
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-24 13:37:28 +02:00
Mattias WalströmandJoachim Wiberg f224d0d03d ietf-factory-default: Implement factory reset
fixes #157, fixes #156
2023-10-24 12:25:38 +02:00
Mattias WalströmandJoachim Wiberg d66740250c confd: Add support for timezone-utc-offset
Some deviations has been done the yang model to comply with tzdata
on linux.

This fixes #106
2023-10-20 12:55:02 +02:00
Mattias WalströmandJoachim Wiberg 0db65846c3 Add tzset() before localtime
Without it, the offset generated will always be zero.
But over netconf it will still be correct, most likely
because due to how libyang handles the date-and-time type.
2023-10-20 12:55:02 +02:00
Richard AlpeandJoachim Wiberg 4471c45d3c .github: use defconfig instead of minimal_defconfig
The issues seen in the regression tests looks related to files
missing from minimal defconfig.

Fixes #127.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-17 18:18:19 +02:00
Richard AlpeandJoachim Wiberg 5639e5bdd4 statd: ignore interfaces with group = internal
Don't add any info about interfaces which has "group" = "internal" to
the operational datastore.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-17 18:17:59 +02:00
Richard AlpeandJoachim Wiberg 1654773bc6 statd: ignore parent interface for kind dsa
DSA ports such as pX has "link" (parent) set to dsaY. We don't see it
that way from an networking perspective. In this commit we avoid
adding parent to the statd data structure if the linkinfo -> info_kind
is dsa. This means the ports shows up as regular interfaces, which is
what we want.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-17 18:17:59 +02:00
Richard AlpeandJoachim Wiberg 4a84ab95d0 statd: dsa ifaces has type infix-if-type:ethernet
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-17 18:17:59 +02:00
Richard AlpeandJoachim Wiberg f643b4f9dc statd: break out parent interface code (cosmetic)
A non functional change to prepare for upcoming patches.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-17 18:17:59 +02:00
Richard AlpeandJoachim Wiberg d6152ce6ea cli: add graceful error for missing json in cli-pretty
Print a graceful error message if the json data is missing of invalid.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-17 18:17:59 +02:00
Richard AlpeandJoachim Wiberg 1a3105c06d cli: pretty print existing Ethernet frame stats
Pretty print all Ethernet frame statistics from the operational
datastore. Only in the detailed interface view.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-17 18:17:59 +02:00
Richard AlpeandJoachim Wiberg 14dc3cf8a0 statd: add ethtool frame counters to op datastore
This patch adds the framework for reading ethtool statistics and
inserting it into the operational datastore.

The ethtool data we rely on is "group data" such as "eth-mac" or
"rmon".

This data can be displayed using:
ethtool --json -S e0 --all-groups

The "group data" is still missing for most common drivers, so testing
this will require a firmware which has support for it.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-17 18:17:54 +02:00
Joachim Wiberg 9292231674 .github: switch to ncipollo/release-action for latest build
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-17 18:08:07 +02:00
Joachim Wiberg 52023e918a confd: regenerate factory-config if factory-config.gen is missing
Regenerate if either factory-config.gen or failure-config.gen is missing.
This should not happen, but is better to check for the result rather than
the intermediate result.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-17 16:32:41 +02:00
Joachim Wiberg c6fae88268 Fix #166: drop SSDP entirely from Infix
mDNS-SD was added in Windows 10 Creators Update[1] (build 1703), relased
April 11, 2017.  This makes SSDP no longer critical for finding an Infix
device in Windows, both ping infix-01-02-03.local and using Chrome work.

Since all major operating systems now support mDNS-SD[2] we've decided
to standardize on that and LLDP for Infix and its derivatives.  Other
reasons for dropping it include, but is not limited to: lack of IPv6 in
the implementation we use, and potential security implications[3].

[1]: https://en.wikipedia.org/wiki/Windows_10,_version_1703
[2]: https://techcommunity.microsoft.com/t5/networking-blog/mdns-in-the-enterprise/ba-p/3275777
[3]: https://blog.cloudflare.com/ssdp-100gbps/

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-17 16:32:41 +02:00
Joachim Wiberg aa655abdc7 Fix #159: hacky generation of /etc/resolv.conf at boot
To be able to run "resolvconf -u" at boot we need dnsmasq up and running
and startup-config having been loaded successfully.  (No point when we
hare in fail secure mode.)

If this bugs out it can be pinpointed by an empty /etc/resolv.conf

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-17 13:26:26 +02:00
Joachim Wiberg cefe24c467 confd: support mixed bridge/router use-case in inteface generator
Fix #160

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-17 13:26:26 +02:00
Joachim Wiberg b4d760906f .github: disable actions by default [skip ci]
Enable actions by setting local variables in your fork of Infix.

Fix #170

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-17 13:26:26 +02:00
Joachim Wiberg acecbe7e5d Allow custom image filename being set in menuconfig
This adds support for the two /etc/os-release variables:

 - IMAGE_ID
 - IMAGE_VERSION

The former is configurable, with fallback to name-arch, and the latter
is only set for relase builds.  During releae builds the release will
be appended to the image name.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-17 13:26:26 +02:00
Joachim WibergandGitHub f6acc44104 doc: add Integration section [skip ci]
Detail operational experience with integrating 3rd party software, PROFINET.
2023-10-17 13:20:11 +02:00
Henrik NordstromandJoachim Wiberg 7b09b2524d greenpak-programmer: Bump to v1.1 which adds LICENSE.txt 2023-10-16 15:07:03 +02:00
Henrik NordstromandJoachim Wiberg 62131528ba Use single-word for CONFIG_PACKAGE.. bool 2023-10-16 15:07:03 +02:00
Henrik NordstromandJoachim Wiberg 5eb25e968b Add greenpak-programmer package 2023-10-16 15:07:03 +02:00
Joachim Wiberg 1698c6645c Disable bridge multicast snooping (IGMP/MLD) by default
The Marvell mv88e6xxx switch driver currently used in active projects do
not support multicast router ports properly yet.  Considering that Infix
do not yet have YANG support for configuring IGMP/MLD snooping, we have
decided to disable it in bridge setups by default.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-13 13:38:09 +02:00
Joachim Wiberg 830c885c2e confd: minor, fix comment
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-13 12:50:02 +02:00
Joachim Wiberg 17b6c234c1 confd: fix copy-paste error in runtime condition [skip ci]
We should only call 'error' in case loading failure-config fails, not if
loading startup-config fails. Unclear how this passed testing, must have
been a last minute change that got untested.

Found during integration in customer's br2-external.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-12 17:22:49 +02:00
Joachim Wiberg b44e303775 board/common: basic feature probe
Currently does not need any conditions, but may later need to check for
loaded modules and other capabilities.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-12 16:35:00 +02:00
Joachim Wiberg 3a3274c371 confd: ensure "word splitting" otherwise gen-interfaces fails
Overzealous shellcheck application lead to gen-intefaces not creating a
bridge when GEN_IFACE_OPTS was uncommented in /etc/confdrc

Verified in customer br2-external.

[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-12 14:56:00 +02:00
Joachim Wiberg 46bd3df13e board/common: fix string comparison operator [skip ci]
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-12 14:28:18 +02:00
Joachim WibergandTobias Waldekranz 138c9f3378 Update board/common/mkgns3a.sh
As @wkz says, better to use this construct if/when we add more archs.

[skip ci]

Co-authored-by: Tobias Waldekranz <tobias@waldekranz.com>
2023-10-12 11:22:55 +02:00
Joachim Wiberg 8c20bb2829 configs: enable disk image and update metadata for /etc/os-release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-12 11:22:55 +02:00
Joachim Wiberg 606b87b4b3 configs: sync aarch64 classic build with changes from cbaa599 & C:o
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-12 11:22:55 +02:00
Joachim Wiberg 230c2adae7 board/common: rename disk.img and update .gns3a
- Create per-arch unique distribution file names
 - Source .gns3a information from /etc/os-release

Instead of attempting to create unique file names by hard-coding an
'infix-' prefix and extracting the "board" or "arch" part from the
defconfig, let's use the branding information from /etc/os-release
along with $BR2_ARCH.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-12 11:22:55 +02:00
Joachim Wiberg 09d48b35ee board/common: parameterized branding using menuconfig
This makes it possible for projects using Infix as a br2-external to
override lots of OS-specific strings and contact information that
previously was hard coded.

The generated /etc/os-release now takes most of its data from .config
Worth noting is the changes in VERSION and BUILD_ID fields.  The former
will be INFIX_RELEASE, during release builds, and the latter is always
the output from `git descibe ...`, or rather GIT_VERSION.  This variable
can be overloaded as well.

See the help text and the new doc/branding.md document for details.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-12 11:22:55 +02:00
Joachim Wiberg f2e30943ee board/common: generate images/Config.in and reduce x86 ram
The default arch and disk image filename needs to be generated
to be unique per, at least, each architecture build.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-12 11:22:55 +02:00
Joachim Wiberg f852afc9c6 Enable GNS3 appliance file for all builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-12 11:22:55 +02:00
Joachim Wiberg c6d4fbf341 board/common: generate a simplified .gns3a for aarch64 builds
Due to problems with using u-boot as loader¹ we decided to start the
system by calling the kernel image directly.  The downside to that is
that, even though RAUC upgrades would work, the kernel would remain
the same.

Improvements to this are of course welcome.

________
¹) Must extract the built-in .dtb and merge with the Qemu .dtb at runtime
   to be able to boot primary (or secondry) image.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-12 11:22:55 +02:00
Joachim Wiberg b40484e262 board/common: fix load_cfg key=value extraction
Calling `load_cfg BR2_EXTERNAL_INFIX_PATH` from post-image.sh caused
warnings due to multiple hits in the .config file:

post-image.sh: 12: /tmp/tmp.5a3xhQQVc8: BR2_EXTERNAL_INFIX_PATH: not found
post-image.sh: 13: /tmp/tmp.5a3xhQQVc8: BR2_EXTERNAL_INFIX_PATH: not found

Let's grep for a "key.*=" instead of "key" to drop those warnings, while
still acting as a catch-all for partial matches.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-12 11:22:55 +02:00
Richard AlpeandJoachim Wiberg 7d8b876cc7 cli: handle missing oper-status
Use known data from .self to avoid crashing if the oper-status is
missing for a interface.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-12 10:10:30 +02:00
Jon-Olov VatnandJoachim Wiberg fdcc6d35a4 Doc: Fixing hostname in examples
Fixing hostname to state admin@example where this was missed.
And some typos.
2023-10-11 13:17:11 +02:00
Jon-Olov VatnandJoachim Wiberg 2c21943ebf Doc: Updating IP address config examples after origin fixes
Fixes to IPv6 address origin (type 'random' rather than 'other')
now reflected in documentation.
Also using 'admin' instead of 'root' user in examples.
2023-10-11 13:17:11 +02:00
Tobias WaldekranzandJoachim Wiberg 2f1c383602 board/aarch64: alder: Initial add
- Device tree
- Enable needed drivers
- Include in aarch64_defconfig
- 88X3310P Firmware
2023-10-10 14:54:50 +02:00
Tobias WaldekranzandJoachim Wiberg 5f37b8acd3 board/aarch64: Build kernel and modules with debug info
This costs nothing on target, and it means that we always have debug
symbols ready when we need them, without having to do a complete
rebuild.
2023-10-10 14:54:50 +02:00
Tobias WaldekranzandJoachim Wiberg 5891c0f2b3 board/aarch64: Build all network related drivers as modules
As we may need to load firmware to the PHYs, we can't load those
modules until we have access to the rootfs. In order for that to work,
the MDIO driver must not be built-in, as that will cause the kernel to
bind devices with missing (built-in) drivers to bind to the genphy
driver.

Therefore, build everything as modules and let udev load it during
boot.
2023-10-10 14:54:50 +02:00
Tobias WaldekranzandJoachim Wiberg 7d1580ca21 board/common: nameif: Make switch port marking more robust
Let's operate on JSON data, so that we're less vulnerable to output
changes in devlink.
2023-10-10 14:54:50 +02:00
Tobias WaldekranzandJoachim Wiberg c5eed505fe board/common: Add convenience macros 'hd' and 'llping'
'hd':
    Hexdump, in canonical format

'llping':
    Ping any IPv6 neighbors using the link-local all-nodes group

    Usage: llping <IFACE>
2023-10-10 14:54:50 +02:00
Tobias WaldekranzandJoachim Wiberg cbaa599c68 aarch64: Use DTS overlay directory
Now that buildroot supports overlay directories for DT sources, use it
in the aarch64 build.
2023-10-10 14:54:50 +02:00
Tobias WaldekranzandJoachim Wiberg a485f15468 buildroot: DTS overlay directories 2023-10-10 14:54:50 +02:00
Tobias WaldekranzandJoachim Wiberg 558c2a40ee kernel: Bump to 6.5.6 + kkit-linux-6.5.y
In order get the ONIE EEPROM support and some mv88e6xxx related fixes,
move to 6.5.6, with the intention of upgrading again, to the next
longterm kernel, as soon as one becomes available.

Also, import patches from kkit-linux-6.5.y.
2023-10-10 14:54:50 +02:00
Joachim WibergandTobias Waldekranz db1d7f41e7 confd: rename Finit sysrepo.conf -> confd.conf
Everything else is named confd, even syslog messages are logged as
confd, and we've talked about not using sysrepo-plugind one day, so
let's prepare for a world where everthing is like that.

Also, and even more importantly, fix the sysrepo-plugind condition.
We cannot use <pid/syslogd>, because it can be restarted and thus
consequently Finit will stop sysrepo-plugind.  This first caused a
bit of head scratching because it cause a lot of very odd errors in
the execution of sysrepo-plugind, transactions being abruptly aborted
for instace.

Whatt we can do, however, is use a static condition, which Finit has
support for since a few releases now.  We want to guard the start of
our sysrepo-plugind service behind YANG /usr/libexec/confd/bootstrap.
So we can use <run/bootstrap/success>.  In case the bootstrap fails,
we catch that in the row before using if:<run/bootstrap/failure> to
trigger the /usr/libexec/confd/error script (described previously).

The other run/task/services can be guarded behind <pid/confd> and now
everything suddenly makes sense.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz 787955d877 confd: add error handling in case of failed bootstrap or load
- New script 'error' that can be overridden by a br2-external
 - Call 'error' if YANG model bootstap or factory-config.gen fails
 - Call 'error' if loading startup-config or failure-config fails

The 'error' script calls syslog¹ to log the error messge:

    The device has reached an unrecoverable error, please RMA.
____
¹ to get a timestamp log message, and send remote in case a
  br2-external has somehow hard-coded network for remote syslog

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz f357b1df3b confd: log [PID] to syslog
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz ca9daef15a confd: add support for generating /cfg/failure-config.cfg
This rather huge change is a refactor of the factory-config generataion to add
support for also generating a failure-config.

The confd bootstrap script has been given an rc file.  This both eases manual
testing, when modifying the script(s), and also makes it easier to override
from a br2-external.  Infix default is router/end-device, but a br2-external
may be a switch firmware and want to default to all ports in a bridge.

The generated failure-config creates a fail-safe "do no harm" config to boot
with in case startup-config for some reason is broken or cannot be applied,
e.g., bug in confd.  Meaning, for both the router and switch use-cases the
device will start up with all interfaces isolated¹, with an IPv6 SLAAC (EUI64)
address per interface.

Services enabled in this fail-safe mode are: LLDP, mDNS/SD, SSH, and NETCONF.
All to facilitate diagnostics, troubleshooting and device recovery.

Other noteworthy changes include:

 - rename factory/failure directories again -> factory.d/failure.d.  Use
   same naming as we do on target for directories holding generated files
 - The bootstrap script no longer regenerates /cfg/factory.d on each boot
 - The bootstrap script copies all static templates to /cfg/factory.d in
   case a newer image changes the contents of them.  For troubleshooting
 - Support for overriding the 20-interfaces.json generation by br2-external
 - Support for additional 30-config.json (ovrride/extend) by br2-external
 - Expand gen-interfaces to support bridge use-case.
_____
¹ For a switch this means "no switchport", i.e., no switching between ports
  otherwise connected to a switchcore (or bridge) in startup-config.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz 3e48af6c36 confd: relocate auto-factory templates and prepare fail secure mode
The template and scripts for generating per-device factory-config have
been spread out across the repo.  This is an attempt to gather all the
pieces to a single location for better overview.

Parts of factory-config will be reused for the new fail secure mode, in
the file failure-config.  The beginnings of which are in this commit.

Other changes:
 - cfg-bootstrap and confd-bootstrap have been collapsed into one
 - let gen-hostname + gen-interfaces save to /cfg instead of /etc,
   we've moved the /etc directory to read-only storage in /usr/share
 - delay start of bootstrap and sysrepo-plugind after syslogd barrier
 - set 'norestart' when loading startup-confg and failure-config,
   no point in retrying if that fails, just go to error immediately

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz b7c4c251ca board/common: Finit dbus.conf override behind <pid/syslogd>
This ensures dbus is not started before any udevadm call has completed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz 5bad7f472f Guard system critical bootstrap services behind <pid/syslogd>
This ensures they do not start earlier than the system log daemon.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz fd366e78f6 package/skeleton-init-finit: rename condition set by sysklogd -> syslogd
The sysklogd and BusyBox syslogd can not run at the same time.  Since they
provide the same service we standardize on them providing <pid/syslogd>.

Also, ensure syslogd does not start until the fifth udevadm has completed.
This creates a barrier preventing other run/task/services from starting
too early.  Thus guaranteeing a proper boot order.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz 0103b1a491 Ensure /bin/sh is a plain POSIX shell (BusyBox /bin/ash)
This commit fixes a regression introduced in 15572e9e where /bin/bash
was unintentionally set as the defalt /bin/sh in the system. This cause
several warnings and errors when a Bash-based /bin/sh tries to sources
/etc/profile because $SHELL identifies it as /bin/bash.

The ietf-system.yang model, with the infix-system.yang extensions,
declare a per-user SHELL that allow /bin/clish, /bin/bash, /bin/sh
and /bin/false.  There should be a clear distinction between them.

This change also helps us keep bashisms away.  If a script needs
Bash features, declare: #!/usr/bin/env bash

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz 11c157116b sec: drop sulogin and disable rescue mode in Finit (NETCONF)
This commit drops sulogin from BusyBox, as well as the Finit replacement,
in the NETCONF builds.  The classic builds retain the Finit sulogin.

Furthermore, the Finit rescue mode is disabled (which uses sulogin), so
in case of trouble at boot, e.g. missing fstab or failure to fsck, the
system will no longer go to sulogin but instead log error to console and
reboot.

  NOTE: the bootloader still needs to be locked down, otherwise a user
        could just as easily change kernel cmdline to 'shell=/bin/sh'

Misc. reshuffle and defaults updated are due to make foo-update-defconfig.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz 3686401a7b configs: drop finit modprobe plugin, handled by udevd now
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz 17665dc962 package/finit: bump to v4.5-rc5
- with conditional execution support
 - fixes to udevd and udevadm calls in renamed 10-hotplug.conf
 - support for overriding internal services, e.g. dbus, keventd

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz acd33d4fa5 board/common: drop duplicate sshd.config and ssh-hostkeys
Instead, use the version from package/skeleton-init-finit, including the
ssh-hostkeys (previously ssh-genhostkeys) from the same package, because
it include extensive error handling and logging on failure.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz e85bc8223b confd: load startup-config with a new wrapper to detect errors
The new confd-load.sh script handles bootstrapping Infix using startup-config
or a failure-config (see later commits) on error.

When used with the -b (bootstrap) option, and failure to load the give file,
the script sets a Finit condition and goes to runlevel 9.  The condition can
be used to trigger loading of a failure-config to go to a Fail Secure mode.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz 8152df445b confd: save boot time by not loading startup-config twice
Only create a default startup-config from factory-config if one is missing.
Do not load an existing startup-config, that is handled by a later step in
the boot process, which needs to be monitored (and displayed) separately to
fail over to a Fail Secure mode on error.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz 17e748a129 confd: log to syslog when user is created/deleted/modifed or error
Changes to the system concerning access rights, like users, should always
be logged, in particular when creating new users or failure to create or
modify their properties.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz b46849520e libsrx: add NOTE() log macro for default log level, LOG_NOTICE
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim WibergandTobias Waldekranz d4820b598b Fix SSH hostkey generation and verification
This change addresses a problem accessing Infix over SSH.  The root cause
turned out to be the hostkeys, which live in /var/lib/ssh and not in /etc
on Infix, were corrupt.

The corruption was interesting in that they all existed, but had size 0.
This state was not caught by our ssh-genhostkeys script and that is what
this change attempts to fix.

As before this change, the script starts by calling `sshd -t` to verify
they hostkeys.  Unlike before we now check for 'invalid format' in the
output of that command.  If any file with invalid format is found, we
remove them and regenerate the hostkeys.

In this investigation it was found that the 'ssh-keygen -A' command that
generates hostkeys does not use the directories specified for the given
files in sshd_config, instead it always saves the files to /etc/ssh.

Also, since there is no panic in getting the hostkeys generated we can
allow the script to wait for syslogd to start before we run, even though
it all happens in runlevel S.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-09 10:41:46 +02:00
Joachim Wiberg 6583b1e451 .github: simplify Bob's workflow and don't move latest tag [skip ci]
We only want Bob to run when PR's have been merged to main, this means
when something is pushed to main.  (Took a while to figure this one out
actually.)  See the following community discussion for details:

https://github.com/orgs/community/discussions/26724#discussioncomment-3253102

Also, we've seen that moving the 'latest' tag messes up any push/pull/sync
operation between clones and forks, so let's skip it and see how that works.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-03 13:39:56 +02:00
Richard AlpeandRichard Alpe e11c46dc94 statd: handle IP origin for IPv6 RA
Handle IPv6 Router Advertisement (RA) based addresses.

If the last 64 bits of a link-local address is generated using the
local MAC address of the interface, i.e. a EUI-64 based address. Then
the origin is set to "link-layer".

If the addrgenmode is set to "random" instead of "eui64", then the
device will generate the interface identifier portion of the address
(the last 64 bits) randomly rather than deriving it from the MAC
address using the EUI-64 process. This will result in a "random"
origin.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-03 11:13:21 +02:00
Joachim Wiberg d8494e30d2 Add support for setting and fetching IPv4/IPv6 interface MTU
Setting the link MTU in Linux changes the sysctl IPV6 MTU, so we have to
set the IPv6 MTU on each run in case the IPv4 MTU changes.  Hence, this
also means the IPv6 MTU must be set *after* the IPv4 (link) MTU.

statd has been updated to read the sysctl setting for IPv6 MTU.

Notice how the loopback interface is unsupported for config + status.

Fixes issue #151

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-03 10:46:17 +02:00
Joachim Wiberg 1b58114891 configs: update minimal defconfig, add pwgen + python
We should really drop minimal defconfig entirely, see issue #127.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-03 10:46:17 +02:00
Richard AlpeandJoachim Wiberg 7ee49e60a5 .github: use gh result file in separate run cmd
Use the new fancy result-gh.md file which as github emojis. Also,
split result publishing to its own run command to simplify the YAML
file.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-02 11:22:47 +02:00
Richard AlpeandJoachim Wiberg ac0ef1d179 Bump 9pm submodule
> 9pm: add new result file with github emojis
> 9pm.py: expose ROOT_PATH to tests via env
> lib_tcl: improve handling of extra ssh args from test
> 9pm: fix evaluation of <base> option in nested suite
> .github: publish test result md in github
> 9pm: resolve <scratch> in suite option

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-10-02 11:22:47 +02:00
Joachim Wiberg a91f8d0e3f Update ChangeLog for v23.09 development release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-02 10:35:34 +02:00
Jon-Olov VatnandJoachim Wiberg 5976ecd163 Add deviations for MTU configuration (IPv4/IPv6) in ietf-ip.yang
MTU configuration/status not yet implemented in Infix, thus
deviations added.
2023-10-02 09:40:56 +02:00
Joachim Wiberg 784c175ba3 .github: disable force push in sync
Branch protection rules on forks may cause this action to fail. [skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-26 06:51:10 +02:00
Joachim Wiberg f58a726604 test: Bump docker container 0.6 -> 0.7, now with socat
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-25 19:16:33 +02:00
Joachim Wiberg 400788252f test: bump PyYAML 5.4.1 -> 6.0.1 to fix buid error
Collecting pyyaml==5.4.1 (from -r /root/pip-requirements.txt (line 6))
  Downloading PyYAML-5.4.1.tar.gz (175 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 175.1/175.1 kB 16.2 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [68 lines of output]
      /tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
      !!

              ********************************************************************************
              The license_file parameter is deprecated, use license_files instead.

              By 2023-Oct-30, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.

              See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
              ********************************************************************************

      !!
        parsed = self.parsers.get(option_name, lambda x: x)(value)
      running egg_info
      writing lib3/PyYAML.egg-info/PKG-INFO
      writing dependency_links to lib3/PyYAML.egg-info/dependency_links.txt
      writing top-level names to lib3/PyYAML.egg-info/top_level.txt
      Traceback (most recent call last):
        File "/root/.infix-test-venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/root/.infix-test-venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/root/.infix-test-venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 271, in <module>
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 318, in run
          self.find_sources()
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 326, in find_sources
          mm.run()
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 548, in run
          self.add_defaults()
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 586, in add_defaults
          sdist.add_defaults(self)
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/command/sdist.py", line 113, in add_defaults
          super().add_defaults()
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults
          self._add_defaults_ext()
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
          self.filelist.extend(build_ext.get_source_files())
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<string>", line 201, in get_source_files
        File "/tmp/pip-build-env-smwadpdr/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
          raise AttributeError(attr)
      AttributeError: cython_sources
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
The command '/bin/sh -c ~/init-venv.sh ~/pip-requirements.txt' returned a non-zero code: 1

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-25 19:16:33 +02:00
Joachim Wiberg 5b5ca862dd test: update Dockerfile to install socat and ssdp[cli]
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-25 19:16:29 +02:00
Joachim Wiberg d0f1885ac5 cli: do password encrypt, change default hash, md5 -> sha512
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-25 18:57:10 +02:00
Joachim Wiberg 0d311cc94f test: set 9pm LOG_PATH to create GitHub action summary from last log
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-25 17:58:09 +02:00
Richard AlpeandRichard Alpe c3c1ccc837 statd: split code into multiple files (cosmetic)
Mainly in preparation for upcoming patches for ethtool.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-25 15:27:37 +02:00
Joachim Wiberg 0506b0f364 .github: attempt to fix sync job [skip ci]
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-25 14:57:28 +02:00
Joachim Wiberg 590066f454 doc/cli: add missing command [skip ci]
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-25 13:53:59 +02:00
Richard AlpeandJoachim Wiberg 484b12611b cli: use infix interfaces types in cli-pretty
Don't use iana-if-type, use infix-if-type.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-25 12:38:33 +02:00
Joachim Wiberg 6bba38bb1c statd: add support for ietf-interfaces/interface/admin-status
Xlate IFF_UP flag to admin-status: up/down.  We do not support any
'testing' mode (yet) in Infix.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-25 10:49:57 +02:00
Jon-Olov VatnandJoachim Wiberg 4cb9f66e0f Doc: Updating IP address assignment examples
Improved "show interfaces" information is now
reflected in IP address examples
- source info added
- IPv6 addresses shown

Also added an example with IPv6 privacy for stateless autoconfig
2023-09-25 08:31:26 +02:00
Joachim Wiberg 2431089e50 Merge branch 'jovatn-jonva/user-guide'
Manually merge PR #137, with minor updates to the YANG deviations, and
complete relocation of the new user-guide.  The idea is to keep all the
documentation generic and use the docgen package later to include all
relevant parts into a PDF user guide.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-22 07:19:12 +02:00
Joachim Wiberg febf6c632d confd: simplify not-supported
- drop origin since targeted at v23.09
 - drop ipv6 temporary address deviations, fixed in #139

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-22 07:18:48 +02:00
Joachim Wiberg 999d83ba8b confd: /if:interfaces-state is deprecated in IETF
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-22 07:18:48 +02:00
Joachim Wiberg 5d664fa055 doc: relocate images to img/
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-22 07:18:48 +02:00
Joachim Wiberg d014bc4b91 doc: expand on data plane setup
- expand on data plane setup
 - adjust headings
 - replace infix-00-00-00 with exmaple

[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-22 07:18:48 +02:00
Joachim Wiberg 76341750c0 doc: relocate user-guide/* to .
Like the Developer's Guide the User's Guide should be a single file on
top-level (at least for now), where it references certain sections in
other files.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-22 07:18:48 +02:00
Jon-Olov VatnandJoachim Wiberg 7c69926211 Adding draft doc on IP address configuration (user guide)
Adding it in a dedicted directory for the user guide.
Can be changed, of course.
2023-09-22 07:18:48 +02:00
Jon-Olov VatnandJoachim Wiberg 1bf1f06a21 Updating infix-ip to clarify non-support deviations of ietf-ip
Setting deviations of non-supported parts of ietf-ip

Idea is that "pyang -f tree ietf-ip.yang infix-ip.yang" should
show what we really support (and should make tests for).
2023-09-22 07:18:48 +02:00
Joachim Wiberg 525716e88e Revert ".github: fix sync action pat naming"
This reverts commit ce95488420.
2023-09-21 19:47:56 +02:00
Joachim Wiberg 1b272e994b doc: relocate .svg to doc/img/ and mention loopback in overview
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 16:53:35 +02:00
Joachim Wiberg 933330cd87 doc: update svg
[skip actions]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 16:53:35 +02:00
Joachim Wiberg 1197b9de5c doc: proposal for how to document netoworking use-cases/capabilities
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 16:53:35 +02:00
Joachim Wiberg b0d36ca51d confd: recreate interfaces which do not have permaddr
Only physical interfaces have a permanent link address.  So in order to
restore the default MAC generated by the kernel for interfaces such as
bridges, veth pairs, VLAN interfaces, and link aggregates, we recreate
them.

This patch adds support for checking if the phys-address attribute has
been deleted from bridge, vlan, and veth interfaces.

The netdag_must_del() function has been refactorored slightly so each
interface type is responsible for returning true if its condiitions are
satisfied.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 16:34:48 +02:00
Joachim Wiberg 9a8251ec66 confd: use 'ip link' instead of ethtool to query permaddr
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 16:34:48 +02:00
Joachim Wiberg 2f045c73de confd: only warn missing outer-tag if missing from cif
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 16:34:48 +02:00
Joachim Wiberg 34a89c4909 confd: drop developer debug messages
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 16:34:48 +02:00
Joachim Wiberg f7e877ebcc test/case: add new test to suite
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 16:34:48 +02:00
Joachim Wiberg e528fe0e34 test/case: new test, verify custom mac address
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 16:34:48 +02:00
Joachim Wiberg d3ac2942bb test/infamy: refactor and add iface.get_phys_address()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 16:34:48 +02:00
Joachim Wiberg 826ea9d2a9 test/infamy: add missing <get-data> RPC to netconf-client
The netconf-client Python lib currently does not support the <get-data>
RPC.  This commit adds a local extension to the Device class which can
be upstreamed at a later time.

Also some added comments and disabling of pylint warnings.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 16:34:48 +02:00
Joachim Wiberg 15bc21c56b test/infamy: minor refactor and whitespace
- prefix local members with _
 - pylint whitespace
 - pylint unnecessary parens

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 16:34:48 +02:00
Joachim Wiberg d0bb51e433 confd: add support for setting phy-address on interfaces
- Override read-only flag in YANG model
 - Add support for setting custom MAC
 - Add support for restoring permanent/original MAC

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 16:34:48 +02:00
Joachim WibergandTobias Waldekranz d5f9f1a73e confd: fix IPv6 autoconf support
- Enable privacy feature, allows true random address instead of EUI64
 - Allow global addresses to use router prefix

Fixes #136

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-21 09:05:49 +02:00
Richard AlpeandJoachim Wiberg f2267b98b9 avahi: set proto random for ipv4 Link-Local address
Set the IP origin "random" for avahi IPv4LL addresses. The reason we
use random and not link-layer for link-local IPv4 addresses is the
fact that they are not based on link-layer info, such as IPv6 eui64
generated LL addresses.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-20 11:33:35 +02:00
Richard AlpeandJoachim Wiberg 32511c2b2b avahi: add pristine copy of avahi-autoipd.action
Add a pristine copy of the current version of avahi-autoipd.action.
This script will be modified by us in later commits.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-20 11:33:35 +02:00
Richard AlpeandJoachim Wiberg d00c062c0e cli: print ip origin in detailed interfaces view
Include ip origin when doing "show interfaces name NAME". Both IPv4
and IPv6.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-20 11:33:35 +02:00
Richard AlpeandJoachim Wiberg 411fa38c50 cli: pretty print ipv6 addresses in show interfaces
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-20 11:33:35 +02:00
Richard AlpeandJoachim Wiberg 4cfe0fa945 test: add ipv6 to bloated.json for cli-pretty
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-20 11:33:35 +02:00
Richard AlpeandJoachim Wiberg cf0c99bd78 statd: add ipv6 data to operational datastore
Modify existing IPv4 code to also add IPv6 address data to the
operational datastore. Also add support for handling link-layer IPv6
address.

IPv6 LL addresses generated with eui64 has "link-layer" origin
and random/secure generated LL addresses has "random" origin.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-20 11:33:35 +02:00
Richard AlpeandJoachim Wiberg b05d220fa4 statd: break out existing ipv4 code (cosmetic)
A preparation patch for ipv6 support. There's no functional change.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-20 11:33:35 +02:00
Richard AlpeandJoachim Wiberg f69b08ea59 test: add top level unit test suite
This currently includes cli-pretty tests. It could be executed
separately to clarify test results in github actions. This commit
includes it in the main test execution. The most important thing is
that it's executed.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:57:08 +02:00
Richard AlpeandJoachim Wiberg ebdbc1e7ad test: use sh shell in cli pretty test runner (POSIX)
Bash is apparently missing in the Alpine Docker.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:57:08 +02:00
Richard AlpeandJoachim Wiberg 2830080c0f .github: checkout submodules in regression.yml
It doesn't look like the regression suites updates the 9pm submodule,
in this commit we attempt to fix this.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:57:08 +02:00
Richard AlpeandJoachim Wiberg ed2060c2a2 Bump 9pm submodule
> 9pm: print git sha sum in banner
> 9pm: add graceful check for missing suites and tests
> ssh: Spell out the full name of node properties
> ssh: Remove username from debug messages
> Merge pull request #48 from neg/execute-cleanup

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:57:08 +02:00
Richard AlpeandJoachim Wiberg 12d4760156 test: add ip addr origin to bloated.json unit test
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:56:14 +02:00
Richard AlpeandJoachim Wiberg b4ad2fb3c4 confd: add ip proto when setting static ip
There might be more places in confd where this is needed. This works
for the most basic use case.

The proto set here is picked up by statd and converted into a YANG
origin, which is exposed to the user.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:56:14 +02:00
Richard AlpeandJoachim Wiberg 59c02bd7f3 udhcpc: flush dhcp addresses in default.script
Flush addresses during shutdown and renewal with new address.
This is kind of a hack and needs further testing.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:56:14 +02:00
Richard AlpeandJoachim Wiberg f75053c931 udhcpc: convert default.script to use ip not ifconfig
This fixes one bug in Infix, namely that dhcp removes all other
statically configured addresses. However it introduces a new one
where dhcp renewals with new ip addresses are added as "duplicates",
we fix this in a later commit in this patchset.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:56:14 +02:00
Richard AlpeandJoachim Wiberg 7f89abe1af udhcpc: add pristine copy of default.script
Add a pristine version of default.script to our local board override.
The reason for this commit is to track changes we do to it.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:56:14 +02:00
Richard AlpeandJoachim Wiberg e3a2895531 cli-pretty: print ip address origin (ip route proto)
Print the origin which is based on info from ip route proto.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:56:14 +02:00
Richard AlpeandJoachim Wiberg 6e9ba0fce5 cli-pretty: use self variables for ipv4 address
Cosmetic code cleanup.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:56:14 +02:00
Richard AlpeandJoachim Wiberg 669379818e statd: add operational ip addr origin (proto) data
Add protocol from ip route (kernel) as origin in YANG model.

Note, we control the names static and dhcp in the file rt_addrprotos.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:56:14 +02:00
Richard AlpeandJoachim Wiberg 478a15bc90 statd: break out ipv4 address creation (cosmetic)
This commit is purely cosmetic.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:56:14 +02:00
Richard AlpeandJoachim Wiberg 2c25a1f343 iproute2: add rt_addrprotos file
This file is read by iproute2 and creates valid names for ip proto.

Such as "static" in:
ip addr add dev e0 192.168.1.1/24 proto static

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-19 11:56:14 +02:00
Richard AlpeandJoachim Wiberg d61762dc7a iproute2: add upstream patch for ip protocol
Add a pristine upstream patch which includes protocol info in ip the
ip command.

More info:
https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=bdb8d85
2023-09-19 11:56:14 +02:00
Richard AlpeandJoachim Wiberg 8fc709676f Bump 9pm submodule
> 9pm: add new result markdown file
> Use unique log dir for each 9pm execution
> 9pm: parse 9pm.rc file in harness
> Add new 9pm.py harness examples
> 9pm: add space between timestamp and output
> Move tcl library code to lib_tcl subdirectory
> 9pm: fix TAP skip result when not last in test
> unit_test: allow tap.yaml to be executed from cmdline
> Merge pull request #49 from kernelkit/master

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-12 11:07:01 +02:00
Richard AlpeandJoachim Wiberg ea4a187a1a cli: don't set empty to none in show iface pretty
This allows us to show empty values easier, while not affecting the
if statements.

This allows for a greater flexibility in which values are shown and
not. For example, we want to show empty columns for data that the
user adds/removes, such as IP addresses.

...
ipv4 addresses      :
...

However, we don't want to show empty columns for information that
should never exist for a particular interface type.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-12 08:33:14 +02:00
Richard AlpeandJoachim Wiberg 3000597fbc cli: add statistics to detailed show interface view
Print in and out octets for each interface that has the information
in the operational data store.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-12 08:33:14 +02:00
Richard AlpeandJoachim Wiberg 7b1974c85f cli: print ipv4-address key even if no ip is set
Should make reading easer and make it more obvious if an interface
doesn't have an IP set.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-12 08:33:14 +02:00
Joachim Wiberg c421e14e6c doc: replace 'exec' with '/', CLI fixed as of v23.08
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-10 11:01:23 +02:00
Joachim Wiberg 9f573f6c6f Add CLI example fold-out
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-09 17:59:20 +02:00
Joachim Wiberg c9e84bffd8 Minor spellcheck and update of footnote
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-09 17:53:33 +02:00
Richard AlpeandJoachim Wiberg 3c2b901439 aarch64: add python3 on target (defconfig)
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-06 16:11:59 +02:00
Richard AlpeandJoachim Wiberg 9e48fb09f6 cli: rewrite interface pretty printer in phyton3
The old version (bash) where slow and cluttered. This version is much
faster and easier to read / maintain.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-06 16:11:59 +02:00
Richard AlpeandJoachim Wiberg 1ea658ad1d test: add new cli-pretty unit test
This test is a "unit" test, which implies that it can be executed
locally without access to a Infix target environment.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-06 16:11:59 +02:00
Richard AlpeandJoachim Wiberg 7b0bd77d16 x86_64: add python3 on target (defconfig)
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-06 16:11:59 +02:00
Richard AlpeandJoachim Wiberg 5ac24eb29e statd: add parent-interface to operational data
Add ietf-if-extensions:parent-interface which is synonymous with link
in ip-route.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-06 16:11:59 +02:00
Richard AlpeandJoachim Wiberg 48120c9144 statd: add interface bridge to operational datastore
Add bridge master into "infix-interfaces:bridge-port" -> "bridge".

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-09-06 16:11:59 +02:00
Joachim Wiberg ce95488420 .github: fix sync action pat naming
GITHUB_ prefix is reserved.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-05 07:40:17 +02:00
Joachim Wiberg 2bcf0d1f57 doc: add Development section and expand on initial requirements
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-01 16:13:47 +02:00
Joachim Wiberg 2d608f44b1 doc: fix markdown link to Buildroot manual
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-09-01 16:13:27 +02:00
Joachim Wiberg 94d93260a8 doc: add symlink for default README -> variant.md
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-31 18:02:20 +02:00
Joachim Wiberg c592818587 .github: fix missing release notes from release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-31 17:57:00 +02:00
Joachim Wiberg 8b4f10c21d doc: update ChangeLog for v23.08 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-31 13:23:15 +02:00
Joachim Wiberg 76fe75469d libsrx: fix include, core.h replaced by common.h outside confd
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-31 10:47:08 +02:00
Tobias WaldekranzandJoachim Wiberg a88391afa2 common: nameif: Drop the assumption that any eN interface is a port
The port marker is intended to be used as a hint to the
auto-factory-config generator, so that it can create a bridge for all
switch ports by default. Therefore, revert to only include ports that
devlink reports as "flavour physical".

If we want to test this functionality in QEMU, we can use Rocker, the
virtual switch, instead.
2023-08-30 12:45:51 +02:00
Tobias WaldekranzandJoachim Wiberg 93118b02fe confd: Make physical port detection compatible with Linux 6.1
The old assumption was that only virtual links would have specific
"linkinfo" data. However, somewhere between 5.19 and 6.1, DSA ports
gained the ability to report its "conduit" interface via the
"linkinfo" attribute. That's great, but unfortunately it broke our
heuristic assumptions.

The new assumption is that only physical ports will report a
"parentbus" attribute. Let's see how long that will last :)
2023-08-30 12:45:51 +02:00
Tobias WaldekranzandJoachim Wiberg 4a4733354b kernel: Use Buildroot's default kernel (6.1.y)
Our custom version has gone from being newer than Buildroot's default
to being older, so there is no reason for us override it anymore.

The kernel has become a bit more picky and will give nasty error
messages if a link's PHY connection is not explicitly defined, but
instead relies on implicit defaults. This was missing from the CPU
port of the CRB, so we supply a small patch to fix that.
2023-08-30 12:45:51 +02:00
Joachim WibergandTobias Waldekranz 04e8a87287 package: set foo_REDISTRIBUTE = NO for local packages
When running `make legal-info` Buildroot will collect source and
licenses for all packages, which generates a few warnings for our
local packages.  Local packages are skipped.

> The source code for packages that set <PKG>_REDISTRIBUTE = NO will not
> be saved.  Patches that were applied are also saved, along with a file
> named series that lists the patches in the order they were applied.

Hence, setting 'foo_REDISTRIBUTE = NO' disables the warning, which seems
like a good idea to reduce the number of unnecessary questions we might
otherwise get.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 12:44:57 +02:00
Joachim WibergandTobias Waldekranz ab88c97d45 package/statd: properly declare license and group decls.
Correct license for package is the same as confd and libsrx.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 12:44:57 +02:00
Joachim WibergandTobias Waldekranz 1baeaeddf5 src/statd: licensed under the same license as confd & libsrx
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 12:44:57 +02:00
Joachim WibergandTobias Waldekranz b6baf452bd package/confd: properly declare license and group decls.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 12:44:57 +02:00
Joachim WibergandTobias Waldekranz e3d9236927 test: disable flaky services_basic test
See issue #126 for details.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 8ce3785d26 test/case: increase test time slightly to catch per-20 sec LLDP
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz c07d3e7ec9 Relocate confd-bootstrap.sh to /usr/libexec
Bootstrap and daemon-specific helper scripts, sometimes known as foot
guns, should not be in $PATH.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 31abe00514 test/case: add LLDP to same test
This unfortunately required some restructuring, and as well as extending
the run time since we have no way of sending Ethernet frames currently
in the test framework (socat would be nice).

 - Put enable/disable of services before tcpdump start, LLDP lingers ...
 - Extend run time: 3 -> 20 sec to catch periodic LLDP messages

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 943603b636 test/case: check for both SSDP and mDNS in same test
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 3dd5810b59 test/case: new test, verify SSDP can be disabled/enabled
This test use NETCONF to enable/disable SSDP, it then verifies that the
DUT responds to, or does not respond to, SSDP discover messages.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 9075e93524 test: add SsdpClient helper class to probe for end devices
This first version reliles on netcat (nc), mostly because that's what I
could figure out how to run in a netns.  A better way would be to have a
full SsdpClient that can collect query responses properly and log all
devices found.

This, however, will do fine for verifying SSDP on/off functionality.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 9a5c619571 test: add Sniffer helper class, wrapping tcpdump
Monday fixup, audit with @wkz

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 1ff744fd04 test: minor, syntax pep-8
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 27387e5e27 package/skeleton-init-finit: rename SSDP service .conf
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz b31e2e9a74 package/skeleton-init-finit: let SSDP advertise every 30 sec, like LLDP
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz efccd7fbda Enable LLDP agent in factory-config
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 50a550b83f confd: add support for enabling LLDP agent using ieee802-dot1ab-lldp
This patch adds support for enabling LLDP using the std IEEE 802.1ab
LLDP yang model.  An infix-lldp model is as well to reduce the set of
available parameters to a bare minimum (enabled), for now.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz f6cfdfd467 cli: add "end" alias to "up", leave this node/subsection
I'm sorry, I'm just so used to this modus from the previous company.
The difference to 'exit', which is available on Cisco IOS, is that it
on the top-level config context does not exit/abort to admin-exec but
instead stops.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 44987d7045 Fix 120: rename sysrepo-bootstrap -> confd-bootstrap
The script resides with confd and sets up our system for confd, this
should make it easier to rememeber where it's located.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 757428364b patches/tcpdump: add missing drop-verbose-default-output patch
Lost in the big summer merge of 2023

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 445cf92009 patches/netcalc: add missing pipe colorization patch
Lost in the big summer merge of 2023

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz bbf9560d73 Ignore /.backup and /x-* directories
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 9e1e90e87b Enable mDNS/SD and SSDP discovery services in factory-config
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz dba737b975 confd: add support for enabling mDNS/SD and SSDP discovery services
Also, for usability, add `name:<SVC>` to each service declaration so they
can be located more easily and/or enabled/disabled using the service they
provide.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 295cc11a8d confd: flatten hierarchy now that statd has moved out
Fix #115

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz ac011e459b src: minor, add missing dist_doc_DATA incl. LICENSE file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz a38e5582ac Refactor, break out a libsrx from confd, shared with statd
Everything (!) potentially shared with other sysrepo plugins/daemons and
helper functions (not yet in libite) that can be used by other daemons
have been relocated to libsrx.

Fix #116

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Joachim WibergandTobias Waldekranz 72c8aaef0c package/skeleton-init-finit: enable fewer services by default
This patch drops auto-enable of services we want to be able to control
via NETCONF/YANG.  SSDP and mDNS/SD enable/disable configure support,
using native models, will be included in the same PR and LLDP+SNMP may
come later, using std. IEEE/IETF models, they are not critical atm.

Fix #118

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-30 10:37:43 +02:00
Tobias WaldekranzandJoachim Wiberg 2d6c872937 netconf: Ignore internal ifaces (e.g. DSA ports) in factory-config
On some system, certain interfaces are not usable by an end-user. The
canonical example of this is the ethernet MAC connected to a switch,
i.e. the DSA port.

Avoid having these be picked up in the generated factory-config, which
would be confusing to a user, by classifying them as "internal" ports
to be ignored by confd and friends.
2023-08-25 10:51:45 +02:00
Tobias WaldekranzandJoachim Wiberg 319a1bb46b cn9130-crb: Add a workaround for the MMC timeout issue in U-Boot
For some reason, the controller disables the bus power sometime after
it was enabled by the driver. The reference manual says, in Table 645,
about the SD_BUS_POWER bit:

> ... It will be cleared if one of the following occurs: the
> sd_bus_vlt and the voltage support in the Capabilities Register 1 do
> not match or if a card removal state was detected.

Further investigation will be needed to find the (electrical?)
root-cause of this issue.
2023-08-25 10:51:45 +02:00
Tobias WaldekranzandJoachim Wiberg 02ac90b35f cn9130-crb: Upgrade U-Boot to 2023.07.02 2023-08-25 10:51:45 +02:00
Tobias WaldekranzandJoachim Wiberg 06ea1dd80b uboot: Fix inconsistency in naming of the netboot mode
This is referred to "net" in all places except for this script.
2023-08-25 10:51:45 +02:00
Tobias WaldekranzandJoachim Wiberg 246b06b8d5 uboot: When booting from a block device, wait for it to show up
The kernel's mounting of the rootfs may race against the underlying
device being probed - especially for media like MMC cards and USB
sticks.

Therefore, tell the kernel to wait for the root device to show up.
2023-08-25 10:51:45 +02:00
Tobias WaldekranzandJoachim Wiberg 73f991081c post-image: Allow disk images to be built from downloaded release
This is useful when we're only building a bootloader, but we still
want to create a full disk image on the format expected by Infix.
2023-08-25 10:51:45 +02:00
Tobias WaldekranzandJoachim Wiberg c08fe9f522 post-image: Defer RAUC status file generation to disk image creation
In the future we want to build disk images from builds where we
haven't locally built Infix, we've just downloaded an existing
release. In those cases we also have to create rauc.status, even
though we're not creating a bundle.
2023-08-25 10:51:45 +02:00
Tobias WaldekranzandJoachim Wiberg cf05d46548 aarch64: Keep dtb directory structure from kernel tree in /boot
This is the layout expected by the "distro boot" effort in U-Boot.

As far as I understand, the contract is:

- U-Boot built for `fooboard` by `vendor`, will set the `fdtfile`
  variable to `vendor/fooboard.dtb` - or more precisely: matching
  whatever path the dtb is built at in the kernel tree.

- A distro (e.g. Infix) then just needs to specify the `fdtdir` in its
  syslinux config (/boot in our case), and U-Boot will be able to find
  the correct dtb.
2023-08-25 10:51:45 +02:00
Tobias WaldekranzandJoachim Wiberg 308a620b69 common: Improve "traditional FIT" image generation
Make the traditional FITs smaller by:

- Filtering out the kernel image from the rootfs, since the FIT way is
  to ship it separately.

- Gzipping the kernel in the FIT, since aarch64 uses the uncompressed
  "Image" format, and squashfs won't take care of it for us.
2023-08-25 10:51:45 +02:00
Richard AlpeandTobias Waldekranz c6513a37bb cli: add source to show interface (ietf type)
Add source, such as "ethernet" to the show ietf interfaces command.
This is translated from the somewhat obscure ietf type, such as
iana-if-type:ethernetCsmacd => ethernet

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-08-23 14:45:38 +02:00
Richard AlpeandTobias Waldekranz 1112203eb3 cli: merge ipv4 and mac in show interface output
Print both ip and mac in the PROTOCOL/ADDRESS column.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-08-23 14:45:38 +02:00
Richard AlpeandTobias Waldekranz fdf027d282 cli: change header design in show interfaces
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-08-23 14:45:38 +02:00
Richard AlpeandTobias Waldekranz 035397e87f cli: add color to state in show interfaces
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-08-23 14:45:38 +02:00
Richard AlpeandTobias Waldekranz 03f99d7252 cli: autocomplete interface names in show interfaces
And quote the "$name" variable.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-08-23 14:45:38 +02:00
Richard AlpeandTobias Waldekranz 62f0958b65 cli: replace show interfaces with new pretty printer
Replace the old "ip" output with data from the sysrepo operational
datastore. This data is piped through the new json-cfg-pretty script,
which formats the data in a nice human readable way.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-08-23 14:45:38 +02:00
Richard AlpeandTobias Waldekranz 2656f17f58 statd: add operational ipv4 address data
Add IPv4 address info from "ip addr" json to sysrepo operational
datastore.

This patch adds: MTU and ip with prefix-length.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-08-23 14:45:38 +02:00
Jon-Olov VatnandJoachim Wiberg d34908a0e5 Fixing broken urls in document docs 2023-08-22 13:41:09 +02:00
Joachim WibergandTobias Waldekranz 3f3de71a38 Fix #107: auto-sync forks every day 2:42 UTC or on dispatch
Highly experimental.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-22 13:33:19 +02:00
Joachim WibergandTobias Waldekranz fcb629f08f test: update cases to use new infix-if-types
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-22 13:32:47 +02:00
Joachim WibergandTobias Waldekranz 3a56cbe1d4 confd: minor janitoring, yang linting
The commit adds a missing description and reorders some yang statements
to meet canonical ordering according to RFC7950, section 14.

It also relocates the /interfaces/interfaces/infix-if:port augment to
its own base model that the bridge (and later lag) models reference.
Solving the bisarre ordering issues we've seen previously.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-22 13:32:47 +02:00
Joachim WibergandTobias Waldekranz 34fd50d1b8 confd: add deviation for if:type limiting it to supported types
This patch adds a new infix-interface-type, derived from the IANA base
type, allowing us to limit the list of supported native interface types.

Basing on IANA interface type ensure compatibility with other models,
e.g., standard/ieee/published/802.3/ieee802-ethernet-interface.yang,
which attaches itself to all interfaces of type ianaift:ethernetCsmacd.

Tested with yanglint and in Infix using ieee802-ethernet-interface.yang,
the 'ethernet' container was properly attached to interfaces of type
infixift:ethernet.

Tab completion in the CLI now lists only the supported types.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-22 13:32:47 +02:00
Joachim WibergandTobias Waldekranz 43dd052707 confd: in case of error from aug_save(), log error strings
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-22 13:32:47 +02:00
Joachim WibergandTobias Waldekranz 782d63e910 board/netconf: fix regex that adds /bin/clish to /etc/shells
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-22 13:32:47 +02:00
Joachim WibergandTobias Waldekranz 96a2418d19 confd: set fallback shell to /bin/false
This further locks down confd to fall back to /bin/false as login shell
in case of internal errors.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-22 13:32:47 +02:00
Joachim WibergandTobias Waldekranz 1e74f17a66 Fix #95: lock down and restrict /system/authentication/user/shell
This patch restricts the possible user shells to a subset of the list in
/etc/shells, which is generated by Buildroot.  The default is 'false' to
prevent accidental shell access for non-admin role users.

The default shell for the admin user is now /bin/clish, which can be
further locked down before Infix v24.02 LTS.

In case of internal error the default fallback shell is now set to the
customizable LOGIN_SHELL, which currently is /bin/bash.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-22 13:32:47 +02:00
Joachim WibergandTobias Waldekranz 7307439bf6 confd: drop old versions of internal yang models
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-22 13:32:47 +02:00
Joachim WibergandTobias Waldekranz 2d614d4fe1 confd: merge internal yang revisions when inside release cycle
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-22 13:32:47 +02:00
Joachim WibergandTobias Waldekranz 5f63a4d671 confd: fix lost deviations and timezone enumerations lost in merge
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-22 13:32:47 +02:00
Joachim WibergandTobias Waldekranz bc048f6313 Drop Hybrid Mode from default builds, update documentation
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-22 10:38:02 +02:00
Ahmed KaricandJoachim Wiberg 2c4b67cbbc test/case: add basic routing test 2023-08-18 14:26:58 +02:00
Joachim WibergandTobias Waldekranz 920a4481b1 .github: simplify contribution guidelines slightly
Also, the file MAINTAINERS has been removed previously.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-17 08:28:33 +02:00
Joachim WibergandTobias Waldekranz 64a6df7b71 .github: add support resource/contact for when reporting issues
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-17 08:28:33 +02:00
Joachim WibergandTobias Waldekranz cad6530949 Drop unused script, PROFINET moved to separate repo
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-17 08:28:33 +02:00
Joachim WibergandTobias Waldekranz b1720f7f77 Relocate from top level
No need to clutter up the root directory of the project.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-17 08:28:33 +02:00
Joachim WibergandTobias Waldekranz 58525325b9 Slight redisposition of content
The following changes have been made to condense and simplify the
leading text in the README.  Tested with Grip to verify that the first
paragraph flows nicely to the left to the fine new logo.  This allows
us to use the space more efficiently and the reader does not have to
scroll so long before reaching relevant content.

 - Right-align logo, and shrink it a bit, to fit text to the left
 - Move topic links to a foldout at the top
 - Move boring licensing stuff to separate docment

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-17 08:28:33 +02:00
Tobias Waldekranz 8b8090bd31 doc: Add new Logo (again)
Go for something simple - Tux trapped in an RJ45 jack.

Also, remove the old versions that we don't use any more. They're in
the log if we ever need them.
2023-08-16 13:52:04 +02:00
Joachim WibergandTobias Waldekranz 1dc1a02f0c doc: add syntax highlighting for dot segments
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-16 13:52:04 +02:00
Joachim WibergandTobias Waldekranz 361ba05d8e doc: drop unused documents
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-16 13:52:04 +02:00
Joachim WibergandTobias Waldekranz b480cd76f1 Fix #64: initial Developer's Guide
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-16 13:52:04 +02:00
Joachim WibergandTobias Waldekranz 93db790de6 Untabify
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-16 13:52:04 +02:00
Joachim WibergandTobias Waldekranz d2ccb32871 New logo and split of README in multiple pages
This is a cleanup and reorganization of the Infix documentation.
Starting with a simplification of the top-level README, splitting
it up into several pages.

Also, fixes #100 by updating the documentation on Qemu.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-16 13:52:04 +02:00
Ahmed KaricandTobias Waldekranz 7432ff10aa test/case: add bridge forwarding tests (single-DUT, dual-DUT, VLAN separation) 2023-08-16 13:51:00 +02:00
Ahmed KaricandTobias Waldekranz fc7d212696 test/infamy: add edge type to logical topology (mgmt port selection) 2023-08-16 13:51:00 +02:00
Richard AlpeandJoachim Wiberg 769338515a klish-plugin-infix: fix indentation in infix.xml
Prior to this patch the indentation was a mix of tabs and spaces.
Now use 2 spaces as indentation.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-08-14 16:49:30 +02:00
Joachim WibergandTobias Waldekranz c94733f6bd package/klish: add missing faux dependency
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-14 13:00:09 +02:00
Joachim WibergandTobias Waldekranz 83e5af33ff Fix #86: rename klinfix -> klish-plugin-infix
Also renames all klix_SYM@klinfix to SYM@infix, this is fine since we're
always calling these symbols with @infix.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-14 13:00:09 +02:00
Tobias WaldekranzandJoachim Wiberg f660f6e9c7 qemu: Homogenize network setup
- Always respect the requested model to emulate. Before this change, a
  device configured to run in TAP mode would ignore a user's requested
  model and always emulate a e1000.

  This worked on x86_64 where that driver is part of the kernel, but
  that is not true for aarch64.

- Always supply a mactab. It was very confusing that the interface
  names would change, in Infix, depending on the selected networking
  mode.

- Remove old decoy variables that were assigned but never used
  anywhere.

- Separately setup the host and target side of a nic (i.e. use a
  -netdev/-device pair instead of the -nic shortcut). This lets us
  share the host side setup across all modes.
2023-08-09 19:45:32 +02:00
Tobias WaldekranzandJoachim Wiberg 9e5904936a statd: Add missing dependencies to Config.in 2023-08-09 19:45:32 +02:00
Joachim WibergandTobias Waldekranz 15795c4b41 confd: skip lldpd and avahi hostname reload during bootstrap
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 17ff8677ee board/common: replace default editor, nano -> mg
This reverts an earlier change where nano was made the default editor in
a misguided attemt by yours truly to accomodate beginner users.

With the recent improvements of the CLI and the fact that the NETCONF
support has matured greatly, the need for a user-friendly editor have
diminished drastically.  Editing system files is now limited to devs
and the core team prefers Mg over nano and vi.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 9766bbbed5 doc/cli: update all the topics to match the refreshed CLI functions
Also, add a new `quick.md` that pops up when the user types `help`.
Very quick intro to get started.  Useful when we add a factory-default
motd: "Welcome to the CLI, type 'help' for a quick overview."

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz bfce877525 confd: ensure change_hostname() returns a sysrepo error code
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz d5298d10e8 klinfix: misc. fixes
- Sync sysrepo conf settings, lots of new settings added, one removed
 - Check if help topic exists
 - password encrypt arguments should be optional, add SWITCH
 - show datetime argument should also be optional, add SWITCH
 - Trial, output factory- and startup-config colorized
 - Switch to srp_prompt v2 for configure context

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 0c6d82cf2f package/klish-plugin-sysrepo: bump to latest + new kkit srp_prompt
The upstream help system has improved greatly.  We can now rely more on
it for generating the man-page like help texts for leaf nodes.  There
is also a new srp_prompt symbol that overrides the default klish one,
srp_prompt adds a '%x' format specifier for an inline path instead of
the default [edit foo bar] JunOS style two-liner.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 8d79235436 package/klish: bump to kkit-next, based on latest upstream
Lots of changes upstream for parsing help texts, running as different
user, etc.  Was getting too difficult to backport to tags/3.0.0, so this
resets the clock on top of (almost) the latest.  Experienced issues with
the admin user in configure mode on the latest commits (e4f65d5).

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz fdb2a5a6dc package/faux: bump to latest upstream git hash
This is needed for the bleeding edge klish + klish-plugin-sysrepo, which
the next couple of commits will add.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz e57616fe3a confd: improve DHCPv4 YANG model descriptions
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 987ec779d3 klinfix: add new commands uptime, version, and netcalc
Preparing for a "show system-information" as well, which still needs to
be discussed to determine contents.  Some data also still missing, e.g.,
article/serial/product number db.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 883d59709e klinfix: add new commands ping and tcpdump, w/ interface completion
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 10684d200f board/common: use tempfile for sysctl manip and remove when done
Mainly just cleaning up /tmp from stale files.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 032881fbf8 board/netconf: chmod 444 (read-only) generated factory-config
Prevent tampering and unintentional overwrite by users.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz b95a82207d package/klish: switch to kkit branch @kernelkit, new features
This commit switches the klish package to use the kkit branch instead of
keeping a lot of patches from the v3.0.0 release.

Most of the changes made are for dragging tinyrl into the 21st century.
It now supports most of the basic features one have come to expect from
a readline replacement: line navigation, deleting words, erasing entire
line, kill and yank of lines/words and last argument on previous line.

The history has also gotten a bit of a stern talking to.  It no longer
deletes lines matching existing old ones from the history, instead it
just checks if the previous command is repeated.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 07b057c455 board/common: import bash completion for initctl
From upstream Finit@b682a5e

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 1a2d799f82 board: drop disabling of built-in help for bash on NETCONF builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz d4b23eac75 klish: klish-plugin-sysrepo: klinfix: bump for new srp_prompt@sysrepo
This commit changes the JunOS look of the CLI to something more akin to
a standard shell.  To achieve this a %w format specifier to display the
path components is added to both klish and klish-plugin-sysrepo.

Before:
	admin@infix-12-34-56:exec> configure
	[edit]
	admin@infix-12-34-56:configure> ediit interfaces interface eth0
	[edit interfaces interface eth0]
	admin@infix-12-34-56:configure> leave
	admin@infix-12-34-56:exec>

After:
	admin@infix-12-34-56:/> configure
	admin@infix-12-34-56:/config/> edit interfaces interface eth0
	admin@infix-12-34-56:/config/interfaces/interface/eth0/> leave
	admin@infix-12-34-56:/> leave

However, due to unforseen problems with the naming of VIEWs in klish,
the admin-exec level "path" is hard-coded to "/" for now.

Future imporovement: fold in calling prompt@klish from srp_prompt, and
figure out why the "main" VIEW cannot be changed to "exec" without klish
just bailing out starting up.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 63779cfe37 configs: change default TERM from linux to xterm
Turns out one of the reasons some keys did not work as they should in
certain commnands, most notably the Home/End in 'less', was due to the
default TERM variable being set to 'linux'.  Changing to 'xterm' fixes
this issue, works with both console and ssh login, and from testing do
not seem to have any adverse effects on existing functionality.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 63aa130e9c klinfix: restore Ctrl-C to abort current line, use Ctrl-D instead
While spending the past couple of weeks actually trying to use the CLI,
I realized that it was very confusing to have a different behavior for
Ctrl-C than I was used to from regular shells (including the old clish
from $OLDJOB).

This change drops the Ctrl-C binding, restoring break/abort behavior,
and lets Ctrl-D be abort/exit.  Pressing Ctrl-D in a sub-context in
configure calls exit, when in the top-most configure context we now
do an abort and return to admin-exec.

To apply the changes the user still has to type 'commit' or 'leave',
or tap Ctrl-Z as in the Cisco CLI.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz d913ce00e6 doc/cli: relocate and extend CLI docs with intro and keybindings
This is not just for online viewing, these markdown documents are also
made available in the CLI itself from admin-exec as:

    help [introduction | keybindings | tutorial]

With this commit we also add lowdown and the real less application to
be the Infix help system.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 52301db8bd package/lowdown: new package, markdown pretty-printer for terminals
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Tobias Waldekranz 0aae72745f package/klish-plugin-sysrepo: bump and switch to KernelKit mirror
This adds support for the srp_help_text() symbol.  It allows us to
display the full description for a leaf in a YANG model.  This has
been added to the 'help [foo]' configure context command.

A separate admin-exec level 'help' command will be added in a later
commit.  It will only be an intro to the CLI, keybindings, etc.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 3a4097c741 package: switch faux and klish to KernelKit mirrors on GitHub
No need to go fishing every time we build when we have everything we
need in the pond next door.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 142f33e89e patches/klish: restore some common keybindings for line manipulation
This restores some of the original keybindings for line manipulation
that was part of the original CLISH.  They had been disabled upstream
during the UTF8 conversion and never got reimplemented.

From branch kkit on https://github.com/kernelkit/klish, the kkit branch
is based off of the 3.0.0 release.  The same patches are also available
on kkit-next, which is based on the latest upstream master.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 30a28fe874 klinfix: modify show datetime, add optional [iso] flag
By default, output human-friendly RFC2822 format rather than NETCONF:ish
ISO-8601 format.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 697a907350 klinfix: new commands show log [FILE] and follow [FILE]
With completion support.  The log command has an optional last arg,
after FILE, tail NUM, which runs tail -n NUM FILE instead of cat.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 24d9a6dfc6 klinfix: add new commands password [generate | encrypt]
An excellent example of how to define commands with optional subcommands
and optional parameters:

  password encrypt [type <md5 | sha256 | sha512>] [salt STRING] [PASSWORD]

The tricks here are two:

  1. mode="switch" in the top-level password command
  2. min="0" in the encrypt subcommands

The first turns the COMMAND element into a SWITCH element (with command
matching), and the second makes a COMMAND optional.  If an optional
command is input by the user, then the enclosed PARAM is mandatory.

Please note, due to limitations in the mkpasswd¹ utility, spaces are not
supported in PASSWORD, i.e., when read from CLI prompt.  However, spaces
are allowed when using the interactive prompt, i.e., when omitting the
PASSWORD from the CLI prompt.

¹) mkpasswd does not look for any leading ' or " in the password arg.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz a5ad52e5eb package/klish: install default type definitions for klish plugin
The documentation for klish mentions the file ptypes.xml, which defines
the ptype /STRING.  So let's use that instead of defining our own types.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz 682384875c klinfix: add new commands show bridge [fdb | mdb | vlans]
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz cd0d12c8c0 klinfix: add new commands show [ip | interfaces] [brief | detailed]
Helper commands for quickly diagnosnig the networking subsystem after
making config changes.  Should over time be replaced with operational
status from sysrepo.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Joachim WibergandTobias Waldekranz de9c255b27 klinfix: add support for libyang
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 16:35:18 +02:00
Richard AlpeandTobias Waldekranz 7e1027488f statd: add interface type to operational data
An iana or infix interface type is derived from "ip link" data.
Such as loopback -> iana-if-type:softwareLoopback.

This patch adds support for the following types:
loopback, ethernetCsmacd, veth, l2vlan and bridge.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-08-08 14:39:50 +02:00
Joachim WibergandTobias Waldekranz 2a37d903b9 board/common: enable CONFIG_FEATURE_CHECK_NAMES for usernames
This commit enables a basic sanity check of usernames in BusyBox that by
default is disabled (!).  The rules enabled by this are:

 - the user or group name should consist only of letters, digits,
   underscores, periods, and dashes¹, and not start with a dash (as
   defined by IEEE Std 1003.1-2001), or periods²

 - for compatibility with Samba machine accounts, $ is supported at the
   end of names

 - max length of user or group name is 256 chars

Changes in this commit also includes a sync with latest BusyBox 1.36,
which adds: tree, tsort, SHA hw acceleration, and a separate script
for udhcpc6.

_____
¹) The documentation actually mentions "and at-signs" as well, but that
   has been explicitly removed from the source code.
²) The documentation does not mention that leading periods are not
   allowed, though this is also explicitly mentioned in the source code.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Joachim WibergandTobias Waldekranz fe23781827 package/confd: follow-up to 259239c, drop clean-etc script
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Joachim WibergandTobias Waldekranz c100a75abe confd: refactor, reduce code duplication
Factor out a new helper function, change_get_user(), to do the bulk of
the work for the change callbacks.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Joachim WibergandTobias Waldekranz e078465d19 confd: add support for specifying login shell for ietf-system users
- Add /bin/clish (symlink) to /etc/shells, as well as the traditional
   /bin/{true,false} for completeness
 - Validate shell string, with fallback to /bin/bash and /bin/sh
 - Step infix-system revision, keeping old model in tree

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Joachim WibergandTobias Waldekranz 0585499202 confd: give local callbacks access to the current sysrepo session
Needed when searching for unchanged data, e.g., default values when
creating new users.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Joachim WibergandTobias Waldekranz 69fa434b44 confd: call lldpcl and avahi-set-host-name after system bootstrap
Services have not even started up yet, so system() calls will only
unnecessarily delay the boot.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Joachim WibergandTobias Waldekranz 4d76da309d confd: minor refactor, dry
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Joachim WibergandTobias Waldekranz 3893538e46 cli: add support for editing NACM rules
This patch bumps klish-plugin-sysrepo to get EnableNACM support.  For
this to work as expected for the admin user we also need to change the
permission for the model in sysrepo.

Note: the srp_rollback() symbol has been renamed to srp_reset() upstram.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Joachim WibergandTobias Waldekranz 11ba06fddf confd: minor cleanup
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Joachim WibergandTobias Waldekranz 528ea61302 confd: set up compat authorized_keys symlink for netopeer2-server
Apparently netopeer2-server expects public keys for users to be in the
canonical place (~/.ssh/authorized_keys).  Infix use a custom location
in /var/run, maintained by the ietf-system plugin, which OpenSSH knows
but netopeer2-server doesn't.

It seems to be possible to add some sort of "pattern" to netopeer2 to
indicate where to look for public keys.  This is added when building it
but Buildroot does not expose this as a setting.  So for now, this seem
to be the least intrusive way of handling it.  The owner is root, so a
malicious user cannot change the link or contents without some other
form of privilege escalation first.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Joachim WibergandTobias Waldekranz 94908ed33c confd: remove home directory when removing users
No point in leaving unused home directories lingering on the system,
also a potential security problem.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Joachim WibergandTobias Waldekranz 5f27f043d1 confd: create users not locked but with password login disabled
Employ the new 'adduser -d' feature where users can be created with
password login disbled instead of creating them locked by default.

This allows us to create remote users that can only access the device
using public key SSH login, which until this point was not possible.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Joachim WibergandTobias Waldekranz 7cb68b3a51 patches/busybox: add support for shadow passwords to login applet
The login applet did not know about shadow passwords, and could thus not
determine if a user accont was locked or passwordless.  This caused it
to return 'login: bad salt' instead of "Login incorrect", which is the
more secure path for handling brute force attempts.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Joachim WibergandTobias Waldekranz 7bc14cf07b patches/busybox: add support for adduser -d
The existing 'adduser -D' command adds a locked user account, similar to
the Debian adduser --disabled-login'.  This patch adds support for the
'adduser -d' command, similar to Debian 'adduser --disabled-password',
meaning login is possible but using methods other than password, e.g.,
SSH keys.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-08 14:36:35 +02:00
Richard AlpeandJoachim Wiberg f727653834 statd: add tx/rx counters to iface operational data
Add tx and rx bytes as YANG out-octets and in-octets.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-08-08 06:30:25 +02:00
Tobias WaldekranzandJoachim Wiberg 5236d81819 confd: infix-system-software: Add descriptions 2023-08-07 16:29:59 +02:00
Tobias WaldekranzandJoachim Wiberg c14d506ab1 confd: infix-system-software: Remove unsupported notification node
This would be nice to have, but it is not prioritized at the moment.

Fixes: 4fb0926 ("confd: Add a sysrepo interface to install RAUC bundles")
2023-08-07 16:29:59 +02:00
Tobias WaldekranzandJoachim Wiberg 5978edce94 confd: Explicitly set operstate to up when bringing interfaces up
This ensures that the operstate is defined for all interface
types. Without supplying this, virtual interfaces (e.g. loopback,
dummies, tunnels) will report an "UNKNOWN" operstate. For ports backed
by physical (or virtualized) hardware, this option has no effect.
2023-08-07 15:50:52 +02:00
Joachim WibergandTobias Waldekranz 1afc2adcfc confd,statd: add support for enabling DEBUG log messages at runtime
- add debug flag to trigger DEBUG() statements
 - DEBUG() macro needs 'path' argument

For statd we can add support for an optional '-d' command line option to
trigger, and SIGUSR1 to toggle, debug mode.  TBD for confd which still
remains to be refactored into the same standalone daemon as statd.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-07 00:28:04 +02:00
Joachim WibergandTobias Waldekranz f40e747fbd statd: drop extra \n, not needed
The idea is to 1) map debug/error macros to syslog(), which does not
need \n, and 2) when stdout logging is used, let the macro add a \n.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-07 00:28:04 +02:00
Joachim WibergandTobias Waldekranz db813bd623 klinfix: add CLI support for set datetime 2023-07-03T16:06:34+02:00
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-06 23:58:59 +02:00
Joachim WibergandTobias Waldekranz 6dafda072a klinfix: add klix_rpc() for poweroff and reboot CLI commands
This change allows us to verify common RPC commands from within the
CLI, starting with the poweroff and reboot commands.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-08-06 23:58:59 +02:00
Richard AlpeandJoachim Wiberg a9317901c3 statd: add support for additional operstates
Add support for yang link state "lower-layer-down" and "not-present".

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-08-02 11:11:19 +02:00
Ahmed KaricandJoachim Wiberg 2ff57f865a test/case: upgrade deprecated hash method 2023-07-13 15:41:38 +02:00
Joachim Wiberg 84fda1dd56 test/docker: update instructions on test and upload of new container
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-13 15:13:27 +02:00
Ahmed KaricandJoachim Wiberg b44932c614 "test/docker: add passlib to docker image" 2023-07-13 14:15:41 +02:00
Jon-Olov VatnandJoachim Wiberg 76c09ba3bd Timezone names as enumerated strings defined by IANA
Use timezone names defined in iana-timezones.yang, replacing
the type 'string' in standard ietf-system.yang

This enables CLI (tab complete) and NETCONF clients (dropdown)
to view available timezone strings, and the yang engine to
validate the input.
2023-07-12 08:51:27 +02:00
Jon-Olov VatnandJoachim Wiberg a43bdd94ab Limit username length and pattern in system yang model
Deviation in ietf-system.yang
'replace' username type from general string to a string
with length and pattern restrictions inline with the
BusyBox 'adduser' tool.

Note, chk_sr_user_update is more restrictive, which should
be handled.
2023-07-12 08:51:27 +02:00
Jon-Olov VatnandJoachim Wiberg 5c4982e388 Specify deviations for optional features (ietf-systems.yang)
Declaring deviations for optional features for clarity regaring
extent of support.

New revision and file of infix-systems created, as earlier version
was included in infix-2023.06 release.
Please see infix-systems@2023-04-11 for history.

Support and deviations has not been checked for the included
'sub-yang-module' infix-systems-software, thus there may be
more updates to come.
2023-07-12 08:51:27 +02:00
Ahmed KaricandJoachim Wiberg b0d3976ae0 test/case: Add interface status tests 2023-07-11 18:05:58 +02:00
Jon-Olov VatnandJoachim Wiberg a1a4491d37 Doc: Fixing hybrid-mode FRR example
two fixes
- first a typo (probably copy/paste issue)
- the sleep and 'vtysh -b' was added to make
  vtysh read the /etc/frr/frr.conf file upon start(*)
  sleep needed to make this happen after initctl reload

(*) See https://docs.frrouting.org/en/latest/vtysh.html#integrated-configuration-mode
But there ought to be a better way.
2023-07-06 16:54:22 +02:00
Ahmed KaricandJoachim Wiberg 7b99cdbd16 test/case: Add authentication/user test 2023-07-04 23:08:21 +02:00
Richard AlpeandJoachim Wiberg b3213c6228 statd: break out operational status into new daemon
This patch does two main things:
1) Breaks "statd" free from "confd".
2) Introduces netlink monitoring of interfaces for sysrepo data.

Prior to this patch, sysrepo operation status was handled by code
named "statd" inside "confd". (Where confd is a sysrepo-plugin and
not a real daemon, which its name implies)

In this patch, we break out the interface part of the operational
sysrepo status, previously "statd", into a new daemon, also called
"statd".

The main reason for doing this is to avoid sysrepo threading, which
allows the new "statd" to have control over sysrepo events in the
same event pool as netlink events from the kernel. This in turn allows
statd to subscribe and unsubscribe dynamically to interfaces that
comes and goes during runtime (such as vlans).

It also makes sense that "statd" is in fact a finit daemon.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-07-04 17:43:16 +02:00
Richard AlpeandJoachim Wiberg e26d4663d0 Increase rmem_max size
This allows an application to set a larger socket receive buffer size.
The default size is left unchanged (212992). 1MB is arbitrary chosen.

The main reason for this is to allow netlink kernel sockets to
hold more interface data while user-space is processing it. Typically
useful during main configuration changes where lots of kernel side
changes occur in short period of time, such as VLAN creation.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-07-04 17:43:16 +02:00
Joachim WibergandRichard Alpe 6befbf6a20 package: add missing LICENSE and LICENSE_FILES to packages
For some reason, the `make license-info` target complained klinfix
needed a hash file, but not the other local repos.  Issue #67 tracks
adding license-info to releases, which will need some looking into,
for now this fixes the most glaring packaging oversights.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-04 09:35:47 +02:00
Joachim WibergandRichard Alpe d2f83ef1b3 package: fix LICENSE_FILESS for klish family of packages
The packages have a misspelled license file. Sneaky

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-04 09:35:47 +02:00
Joachim WibergandRichard Alpe ff8cd981e1 .github: simplify expression guards
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-04 09:35:47 +02:00
Joachim WibergandRichard Alpe 259239ce5b package/confd: drop clean-etc script, fix #74
This script has some seriously sharp edges.  Today two devs cut their
fingers on it trying to get new functionality in place.  One when, in a
attempt at, adding an innocent status daemon, and another setting up a
client repository with a custom, enabled-by-default, daemon.  In both
instances this script happily cleaned out the deamons from enabled/.

A better alternative, as described in issue #74, is to be stricter on
what is enabled by default, and for things we feel provide value in the
Classic build, maintain a separate list of symlinks in its meta board
definitiion instead.

Also, clean out previous attempt at factory-config.  Now that we have
the auto-factory support in place we don't need this.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-04 09:35:47 +02:00
Joachim WibergandRichard Alpe 72e388458d board/common: drop sshd.conf symlink, enabled by skeleton-init-finit
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-04 09:35:47 +02:00
Joachim WibergandRichard Alpe 8ab2bdc625 package/querierd: don't enable service by default
In normal use-cases querierd needs a bridge with multicast-snooping
enabled to run.  No point in attempting to start querierd by default.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-04 09:35:47 +02:00
Joachim WibergandRichard Alpe 45466bcbc7 package/skeleton-init-finit: smcrouted default changes
- allow custom options sourced from optional /etc/default/smcrouted
 - don't enable smcrouted by default when enabled in Buildroot .config
   because normal use-cases require an /etc/smcroute.conf

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-04 09:35:47 +02:00
Joachim WibergandRichard Alpe f8666ddeb2 .github: possible fix of Bob's upload
Use same if: syntax for release/upload job as for build job.  Only thing
the upload job needs to ensure is that it does not try to upload built
artifacts from forks or from non-main builds.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-03 13:51:30 +02:00
Joachim WibergandRichard Alpe c8c0350859 .github: fix markdown link to doc/MAINTAINERS
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-03 13:51:30 +02:00
Joachim WibergandRichard Alpe d5c28bc454 package: replace TARGET_FINALIZE_HOOKS with POST_INSTALL
When calling `make foo-rebuild` one expects all the registered hooks in
the foo package to have been called by Buildroot.  The Buildroot manual
has this to say about the target-finalize hook:

> These hooks are run after all packages are built, but
> before the filesystem images are generated.  They are
> seldom used, and your package probably do not need them.

The correct hook to use for target packages is POST_INSTALL_TARGET_HOOK.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-03 13:51:30 +02:00
Joachim WibergandRichard Alpe de24d0389a package: relocate PROFINET packages to customer repo.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-03 13:51:30 +02:00
Joachim WibergandRichard Alpe 93fe939f91 Fix #72: import up-to-date Debian /etc/services (OSPF, mDNS, etc.)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-03 13:51:30 +02:00
Joachim WibergandTobias Waldekranz 77ef063185 klish: backport hotkey fixes, now Ctrl-D and Ctrl-Z work properly
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-07-01 14:39:42 +02:00
emihasandJoachim Wiberg 443b9cdf9f test/case: Add ietf_interfaces/ipv4_address.py
Verify that IPv4 addresses can be added and removed.
2023-06-30 18:38:59 +02:00
Tobias WaldekranzandJoachim Wiberg 7cf65f4c56 test/infamy: Support submitting edits containing deletions 2023-06-30 18:38:59 +02:00
Tobias WaldekranzandJoachim Wiberg 5be61a7013 test/case: Add ietf_system/upgrade
Verifies that RAUC bundles can be installed using NETCONF.

We choose to not add this to the "all" suite for now, as the qeneth
topologies do not run with full disk emulation.

To test locally, configure your "make run" instance to use the UEFI
loader, launch `make run`, and then run:

    make INFIX_TESTS=test/case/ietf_system/upgrade.py test-run
2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg 4fb09267cf confd: Add a sysrepo interface to install RAUC bundles 2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg 6ca6a4e2f8 confd: Restructure list of source files
We were now at the point where it was completely impossible to see
which files are actually built.

Bring back some order, making future diffs easier to understand.
2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg c4a1b2558d rauc: Increase maximum download size to 1 GiB
Default is 8 MiB which is, you know, not alot. Choose a very high
value and let the OS notify RAUC when the disk is full.
2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg c4b7b2aa65 rauc: Enable service
The RAUC service exports a D-Bus API that fits well with NETCONF's
notion of RPCs and notifications.
2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg f056e20558 rauc: Bundle RAUC status file in disk image
This let's us report the installed software versions, before any
updates have been made. Since the info should _not_ be erased in a
factory reset (since the installed software versions will not change),
move the status file to aux, which is the proper place for this class
of information.
2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg 1b85d0c4e0 qemu: Restore 9p host mount support
This broke in the qemu-in-images-dir refactor when the config prefix
changed.
2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg 193acaac6b qemu: Declare some missing dependencies in the configuration
- Only U-Boot can deal with the MMC disks at the moment
- Initrd's only make sense when starting QEMU with `-kernel`
2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg f572f173da qemu: Refine serial setup
- When running with full disk emulation (via GRUB on x86, or U-Boot on
  aarch64), there's no way for us to influence the commandline passed
  to the kernel, so the console is fixed to ttyS0/AMA0. Therefore,
  reintroduce an option to choose the console.

- Use a fixed `nr`s for virtconsoles, so that the gdbserver always
  listens on `hvc1`. Ideally, we should use udevs `/dev/virtio-ports/*`
  symlinks, but for some reason these point to `/dev/vportXpY` and not
  to `/dev/hvcY`. TODO: Figure out what the difference is.

- While we're here, remove the duplicated RTC setup which was
  introduced with the virtio-console work a while back.
2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg b02bba991d netboot: Consistently use /dev/ram0 as the root when ramloading
/dev/ram is accepted by the kernel during boot, but there's no actual
file with this name in /dev, so RAUC will get confused about which
slot is actually one we booted from.
2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg 1202edc990 test: Ensure that the local pip environment is setup for test-run* 2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg be7b57412e test/case: Add meta/play
Launches an interactive ipython environment, attached to Infix nodes.
This can be used as a playground for developing tests, testing out
NETCONF operations, etc.
2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg 6d6acda35d test/infamy: Patch netconf_client's logging to support IPv6
As an example, when running meta/play, a call to a device's `_debug()`
method will enable logging of all transmitted and received NETCONF
messages, which is very useful during debugging.
2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg fd939f65ce test/infamy: Add helpers to access operational state 2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg 6fc131dace test/infamy: Add helpers to call actions and regular RPCs
As with config, the call can be described with a regular python
dictionary. As an example, to reboot the device:

    target.call_dict("ietf-system", { "system-restart": {} })
2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg 60beca8820 test/infamy: Ensure that environment always has an ltop attribute
This fixes an issue where attaching to a device in an environment
without a logical topology would trigger an exception.
2023-06-30 15:33:10 +02:00
Tobias WaldekranzandJoachim Wiberg 31760e1c96 sysrepo-plugind: Require all plugins to load without error
If confd or statd fails to initialize, we want Finit to know about it.
2023-06-30 15:33:10 +02:00
Joachim WibergandTobias Waldekranz 772dbe9d64 test: add checklist for howto update the docker iamge
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 14:13:09 +02:00
Joachim WibergandTobias Waldekranz fcf3605e12 test/case: new regression test for IPv4 autoconf
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 14:13:09 +02:00
Joachim WibergandTobias Waldekranz ecdf2a1012 test: add fakeroot to the docker image
We need fakeroot for running tcpdump inside the container.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 14:13:09 +02:00
Joachim WibergandTobias Waldekranz b88348145c confd: fix regression in enabling ipv4 zeroconf address
To reproduce regression, before fix, in CLI from factory-default:

  > configure
  > set interfaces interface e0 ipv4 autoconf enable true
  > leave
  > shell
  $ ps; ip -br a

Turns out, for some reason I cannot figure out, that we cannot use the
same pattern as for ipv6 with lydx_get_descendant().  Manually fetching
the node works though.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 14:13:09 +02:00
Joachim WibergandTobias Waldekranz d6eca354b3 klish: add reboot and poweroff commands, for usability
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 14:13:09 +02:00
Joachim WibergandTobias Waldekranz ecc24d13cb confd: call avahi-set-host-name on hostname changes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 14:13:09 +02:00
Joachim WibergandTobias Waldekranz e4a1261ad8 Fix #57: unneccesary lldpd restarts on configuration change
Instead of restarting lldpd we can call lldpcli to inform lldpd of the change.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 14:13:09 +02:00
Joachim WibergandTobias Waldekranz 6410a96d6d Fix #58: trim interface factory-defaults
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 14:13:09 +02:00
Joachim WibergandTobias Waldekranz c93edfb6a2 board: relocate NETCONF factory-default scripts
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 14:13:09 +02:00
Joachim WibergandTobias Waldekranz 4925636b2a Fix #56: relocate board/common auto-factory.d to board/netconf
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 14:13:09 +02:00
Joachim WibergandTobias Waldekranz 32e8e95088 Fix #60: add replace BusyBox ping with iputils-ping
Among other things, it supports -L when detecting IPv6 neighbors:

    ping -6 -L ff02::1%eth0

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 14:13:09 +02:00
Joachim WibergandTobias Waldekranz b2c77a2457 test/infamy: use factory-default rpc between tests
Instead of relying on startup-config == factory-config we can now set
running-config to factory-config using the factory-default rpc when
we prepare for a new test.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 13:37:12 +02:00
Joachim WibergandTobias Waldekranz 123317ce35 confd: add support for factory-default rpc
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 13:37:12 +02:00
Joachim WibergandTobias Waldekranz 8302ad9735 confd: fix missing RPC OK from system-restart et al
Use new APIs runbg() and run_status() to call 'reboot' or 'poweroff' in
the background.  This allows sysrepo + netopeer to reply to remote RPCs
before networking goes down.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 13:37:12 +02:00
Joachim WibergandTobias Waldekranz 2d453d0025 Fix #46: 'make run-menuconfig' needs buildroot-config/mconf
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 13:37:12 +02:00
Joachim WibergandTobias Waldekranz 0a40014d1b package/finit: backport fix to indefinite stall at reboot/shutdown
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-30 13:35:36 +02:00
Richard AlpeandJoachim Wiberg 9d63aeed61 confd: fix memory leak in lydx_new_path()
Prior to this patch, every new call to lydx_new_path() where "first"
was set to 1 resulted in a memory leak of 72 bytes. Typically at least
once for each sysrepo query.

The memory was allocated deep down in the lyd library, but as the
parent node wasn't set (NULL) it wasn't found by sysrepo when
cleaning up.

In this patch we mitigate this by simply removing the "first" concept,
as it doesn't appear to be needed.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-06-29 14:47:36 +02:00
Joachim Wiberg 6d536e1b3f Further clarify how to use containers in Infix
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-28 08:57:42 +02:00
Joachim Wiberg 15843f4325 doc/container.md: add Real Example and update Hybrid Mode
Add a real example where we create a writable layer for container based
on a simple image.

To be able to properly start/stop and monitor containers using Finit, we
need to add the options `--systemd=false` and `--conmon-pidfile=...`.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-27 11:55:40 +02:00
Joachim Wiberg a8f14b949c doc/container.md: use correct interface in cni host interface
We usually put the vethNb interfaces in the bridge and the vethNa end in
the appliance/container.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-25 22:47:06 +02:00
Joachim Wiberg 44983a4bd5 doc/cli.md: add diff to veth and bridge sections
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-25 15:27:48 +02:00
Joachim Wiberg cfa220a043 package/podman: log any console output from podman to syslog
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-25 13:11:46 +02:00
Joachim Wiberg 01455a08f8 doc/container.md: use unused host port 222 for container port 22
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-25 13:05:54 +02:00
Joachim Wiberg cc1845d62b doc/container.md: add section on debugging
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-25 12:53:37 +02:00
Joachim Wiberg 43c68de6f1 doc/container.md: update Multiple Networks and Hybrid Mode example
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-25 12:06:45 +02:00
Joachim Wiberg d99445c489 Fix Frr Hybrid Mode example and link to doc/container.md
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-25 12:06:17 +02:00
Joachim Wiberg eed5c2f206 doc/cli.md: update with a toc and help on veth pairs and bridging
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-25 11:56:42 +02:00
Joachim Wiberg 593a0626d1 doc: always lead with an example, put caveats last
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-24 18:42:42 +02:00
Joachim Wiberg 81f2e78984 Minor, spellcheck Buildroot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-24 18:42:24 +02:00
668 changed files with 56927 additions and 13566 deletions
+7 -9
View File
@@ -2,16 +2,15 @@ Contributing to Infix
=====================
We welcome any and all help in the form of bug reports, fixes, patches
to add new features -- *preferably as GitHub pull requests*. Other
methods are of course also possible: emailing the [maintainers][] a
patch or even a raw file, a feature request or an alert of a problem.
to add new features -- *preferably as GitHub pull requests*.
If you are unsure of what to do, or how to implement an idea or bugfix,
open an issue with `"[RFC: Unsure if this is a bug ... ?"`, or use the
GitHub discussions forum, so we can discuss it. Talking about the code
first is the best way to get started before submitting a pull request.
If you are unsure of what to do, or how to implement an idea or bug fix,
open an issue with `"[RFC]: Unsure if this is a bug ... ?"`, or use the
[GitHub discussions forum](https://github.com/orgs/kernelkit/discussions).
Talking about code and problems first is often the best way to get started
before submitting a pull request.
Either way, when sending an email, patch, or pull request, start by
When submitting a bug report, patch, or pull request, please start by
stating the version the change is made against, what it does, and why.
Please take care to ensure you follow the project coding style and the
@@ -72,7 +71,6 @@ The *"maintainers have the right and responsibility to remove, edit,
or reject comments, commits, code, wiki edits, issues, and other
contributions that are not aligned to this Code of Conduct."*
[1]: ../doc/MAINTAINERS
[KNF]: https://en.wikipedia.org/wiki/Kernel_Normal_Form
[gitbook]: https://git-scm.com/book/ch5-2.html
[conduct]: CODE-OF-CONDUCT.md
+1
View File
@@ -0,0 +1 @@
Paid support and development provided by Addiva Elektronik <https://addiva.se>
+37
View File
@@ -0,0 +1,37 @@
<!--- **Summarize** your changes in the title above -->
## Description
<!--
-- A description of changes, detailing *why* changes are made.
-- Remember: assign a reviewer, or use @mentions if org. member.
-->
## Other information
<!-- Other relevant info, e.g., before/after screenshots -->
## Checklist
Tick relevant boxes, this PR is-a or has-a:
- [ ] Bugfix
- [ ] Regression tests
- [ ] ChangeLog updates (for next release)
- [ ] Feature
- [ ] YANG model change => revision updated?
- [ ] Regression tests added?
- [ ] ChangeLog updates (for next release)
- [ ] Documentation added?
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (please detail in commit messages)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):
## References
<!-- Please list references to related issue(s) -->
+41 -22
View File
@@ -1,16 +1,13 @@
name: Bob the Builder
on:
pull_request:
push:
branches:
- main
types:
- closed
workflow_dispatch:
jobs:
build:
if: ${{github.ref == 'refs/heads/main' && github.event_name == 'push'}} || github.event_name == 'workflow_dispatch'
name: Build ${{ matrix.platform }} ${{ matrix.variant }}
runs-on: ubuntu-latest
strategy:
@@ -19,7 +16,12 @@ jobs:
variant: [netconf, classic]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Maintenance
run: |
docker image prune -af
docker volume prune -f
docker container prune -f
- uses: actions/checkout@v4
- name: Set Build Variables
id: vars
run: |
@@ -30,22 +32,25 @@ jobs:
fi
echo "dir=infix-$target" >> $GITHUB_OUTPUT
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
if [ "$target" = x86_64 ]; then
echo "out=$PWD/output" >> $GITHUB_OUTPUT
else
echo "out=/mnt/x-$target" >> $GITHUB_OUTPUT
fi
- name: Restore Cache of dl/
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: dl/
key: dl-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
key: dl-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
restore-keys: |
dl-${{ matrix.platform }}-${{ matrix.variant }}-
dl-${{ matrix.platform }}-
dl-${{ matrix.variant }}-
dl-
- name: Restore Cache of .ccache/
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .ccache/
key: ccache-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
key: ccache-${{ matrix.platform }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
restore-keys: |
ccache-${{ matrix.platform }}-${{ matrix.variant }}-
ccache-${{ matrix.platform }}-
ccache-
- name: Configure & Build
@@ -55,35 +60,49 @@ jobs:
else
target=${{ matrix.platform }}_${{ matrix.variant }}_defconfig
fi
echo "Buildring $target ..."
echo "Building $target ..."
sudo mkdir ${{ steps.vars.outputs.out }}
sudo chown $(id -un):$(id -gn) ${{ steps.vars.outputs.out }}
export O=${{ steps.vars.outputs.out }}
make $target
make
- name: Prepare Artifact
run: |
cd output
cd ${{ steps.vars.outputs.out }}
mv images ${{ steps.vars.outputs.dir }}
ln -s ${{ steps.vars.outputs.dir }} images
tar chfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
- name: Test
if: matrix.platform == 'x86_64' && matrix.variant == 'netconf'
run: |
export O=${{ steps.vars.outputs.out }}
make test-qeneth
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: output/${{ steps.vars.outputs.tgz }}
path: ${{ steps.vars.outputs.out }}/${{ steps.vars.outputs.tgz }}
name: artifact-${{ matrix.variant }}-${{ matrix.platform }}
release:
if: github.repository == 'kernelkit/infix' && github.ref == 'refs/heads/main'
if: ${{github.repository_owner == 'kernelkit' && github.ref_name == 'main'}}
name: Upload Latest Build
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v3
- uses: pyTooling/Actions/releaser@main
- uses: actions/download-artifact@v4
with:
tag: latest
rm: true
pattern: "artifact-*"
merge-multiple: true
- uses: ncipollo/release-action@v1
with:
allowUpdates: true
omitName: true
omitBody: true
omitBodyDuringUpdate: true
prerelease: true
tag: "latest"
token: ${{ secrets.GITHUB_TOKEN }}
files: artifact/*
artifacts: "*.tar.gz"
- name: Summary
run: |
cat <<EOF >> $GITHUB_STEP_SUMMARY
+85
View File
@@ -0,0 +1,85 @@
name: Coverity Scan
on:
schedule:
- cron: '5 0 * * *'
workflow_dispatch:
env:
PROJECT_NAME: Infix
CONTACT_EMAIL: troglobit@gmail.com
jobs:
coverity:
if: ${{github.repository_owner == 'kernelkit'}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch latest Coverity Scan MD5
id: var
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
run: |
wget -q https://scan.coverity.com/download/cxx/linux64 \
--post-data "token=$TOKEN&project=${PROJECT_NAME}&md5=1" \
-O coverity-latest.tar.gz.md5
echo "md5=$(cat coverity-latest.tar.gz.md5)" | tee -a $GITHUB_OUTPUT
- uses: actions/cache@v4
id: cache
with:
path: coverity-latest.tar.gz
key: ${{ runner.os }}-coverity-${{ steps.var.outputs.md5 }}
restore-keys: |
${{ runner.os }}-coverity-${{ steps.var.outputs.md5 }}
${{ runner.os }}-coverity-
${{ runner.os }}-coverity
- name: Download Coverity Scan
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
run: |
if [ ! -f coverity-latest.tar.gz ]; then
wget -q https://scan.coverity.com/download/cxx/linux64 \
--post-data "token=$TOKEN&project=${PROJECT_NAME}" \
-O coverity-latest.tar.gz
else
echo "Latest Coverity Scan available from cache :-)"
md5sum coverity-latest.tar.gz
fi
mkdir coverity
tar xzf coverity-latest.tar.gz --strip 1 -C coverity
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install pkg-config libjansson-dev libev-dev \
libaugeas-dev libglib2.0-dev libpcre2-dev \
libuev-dev libite-dev
- name: Build dependencies
run: |
git clone https://github.com/CESNET/libyang.git
mkdir libyang/build
(cd libyang/build && cmake .. && make all && sudo make install)
git clone https://github.com/sysrepo/sysrepo.git
mkdir sysrepo/build
(cd sysrepo/build && cmake .. && make all && sudo make install)
make dep
- name: Check applications
run: |
export PATH=`pwd`/coverity/bin:$PATH
cov-build --dir cov-int make check
- name: Submit results to Coverity Scan
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
run: |
tar czvf ${PROJECT_NAME}.tgz cov-int
curl \
--form token=$TOKEN \
--form email=${CONTACT_EMAIL} \
--form file=@${PROJECT_NAME}.tgz \
--form version=$(git rev-parse HEAD) \
--form description="${PROJECT_NAME} $(git rev-parse HEAD)" \
https://scan.coverity.com/builds?project=${PROJECT_NAME}
- name: Upload build.log
uses: actions/upload-artifact@v4
with:
name: coverity-build.log
path: cov-int/build-log.txt
+100
View File
@@ -0,0 +1,100 @@
name: Manny the Manager
on:
workflow_dispatch:
inputs:
checkout:
required: true
type: boolean
cleanup:
required: true
type: boolean
peek:
required: true
type: boolean
jobs:
inventory:
runs-on: ubuntu-latest
steps:
- name: Disk usage ...
run: |
cd
du -hs .[^.]*
- name: Disk inventory (1/2) ...
run: |
echo "df -h ========================================================================="
df -h
echo "mounts ========================================================================"
mount
- name: File inventory (1/2) ...
run: |
echo "Current directory: $(pwd)"
echo "Files in $HOME ================================================================"
ls $HOME
echo "Find $HOME ===================================================================="
find $HOME
- name: Container inventory ...
run: |
echo "Available container images: ==================================================="
docker images
echo "Available containers: ========================================================="
docker ps -a
checkout:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Restore Cache of dl/
uses: actions/cache@v4
with:
path: dl/
key: dl-netconf-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
restore-keys: |
dl-netconf-
dl-
- name: Restore Cache of .ccache/
uses: actions/cache@v4
with:
path: .ccache/
key: ccache-x86_64-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
restore-keys: |
ccache-x86_64-
ccache-
- name: Disk inventory (2/2) ...
run: |
echo "df -h ========================================================================="
df -h
echo "mounts ========================================================================"
mount
- name: File inventory (2/2) ...
run: |
echo "Current directory: $(pwd)"
echo "Files in $HOME ================================================================"
ls $HOME
echo "Find $HOME ===================================================================="
find $HOME
peeky:
if: ${{ inputs.peek }}
runs-on: ubuntu-latest
steps:
- name: Peek & Poke ...
run: |
whoami
ls -l /mnt/
cat /mnt/DATALOSS_WARNING_README.txt
sudo mkdir /mnt/x-aarch64
sudo chown $(id -un):$(id -gn) /mnt/x-aarch64
ls -l /mnt/
cleanup:
if: ${{ inputs.cleanup }}
needs: [inventory, peeky]
runs-on: ubuntu-latest
steps:
- name: Cleaning up cruft ...
run: |
docker image prune -af
docker volume prune -f
docker container prune -f
+24 -14
View File
@@ -17,35 +17,40 @@ jobs:
build:
name: Regression Testing
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Set Build Variables
id: vars
run: |
target=x86_64-minimal
target=x86_64
echo "dir=infix-$target" >> $GITHUB_OUTPUT
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
- name: Restore Cache of dl/
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: dl/
key: dl-x86_64-netconf-${{ hashFiles('.git/modules/buildroot/refs/heads/master', 'package/*/*.hash') }}
key: dl-netconf-${{ hashFiles('.git/modules/buildroot/refs/heads/master', 'package/*/*.hash') }}
restore-keys: |
dl-x86_64-netconf-
dl-x86_64-
dl-netconf-
dl-
- name: Restore Cache of .ccache/
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .ccache/
key: ccache-x86_64-netconf-${{ hashFiles('.git/modules/buildroot/refs/head/master', 'package/*/*.hash') }}
key: ccache-x86_64-${{ hashFiles('.git/modules/buildroot/refs/head/master', 'package/*/*.hash') }}
restore-keys: |
ccache-x86_64-netconf-
ccache-x86_64-
ccache-
- name: Configure Minimal NETCONF
- name: Configure NETCONF
run: |
make x86_64_minimal_defconfig
make x86_64_defconfig
- name: Unit Test
run: make test-unit
- name: Build
run: |
make
@@ -56,9 +61,14 @@ jobs:
ln -s ${{ steps.vars.outputs.dir }} images
tar cfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: output/${{ steps.vars.outputs.tgz }}
- name: Regression Test
run: |
make test-qeneth
run: make test-qeneth
- name: Publish Test Result
# Ensure this runs even if Regression Test fails
if: always()
run: cat test/.log/last/result-gh.md >> $GITHUB_STEP_SUMMARY
+82 -29
View File
@@ -1,9 +1,21 @@
# This job can be started by a git tag or using the workflow dispatch.
#
# The version string *must* be of the format: vYY.MM(-alphaN|-betaN|-rcN)
#
# In /etc/os-release this string is used for VERSION, VERSION_ID, and
# IMAGE_VERSION, with the 'v' prefix. In release artifact filenames,
# and zip file directory names, the 'v' is dropped per convention.
name: Release General
on:
push:
tags:
- 'v[0-9]*.*'
workflow_dispatch:
inputs:
version:
required: false
type: string
jobs:
build:
@@ -16,80 +28,121 @@ jobs:
variant: [netconf, classic]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set Release Variables
id: build
- name: Maintenance
run: |
ver=${GITHUB_REF#refs/tags/v}
echo "ver=${ver}" >> $GITHUB_OUTPUT
if echo $ver | grep -qE '[0-9.]+(-alpha|-beta|-rc)[0-9]*'; then
echo "pre=true" >> $GITHUB_OUTPUT
docker image prune -af
docker volume prune -f
docker container prune -f
- uses: actions/checkout@v4
- name: Set Release Variables
id: vars
run: |
if [ -n "${{ inputs.version }}" ]; then
ver=${{ inputs.version }}
else
echo "pre=false" >> $GITHUB_OUTPUT
ver=${GITHUB_REF#refs/tags/}
fi
echo "ver=${ver}" >> $GITHUB_OUTPUT
fver=${ver#v}
if [ "${{ matrix.variant }}" = "netconf" ]; then
target=${{ matrix.platform }}-${ver}
target=${{ matrix.platform }}-${fver}
else
target=${{ matrix.platform }}-${{ matrix.variant }}-${ver}
target=${{ matrix.platform }}-${{ matrix.variant }}-${fver}
fi
echo "dir=infix-$target" >> $GITHUB_OUTPUT
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
echo "out=/mnt/x-$target" >> $GITHUB_OUTPUT
- name: Restore Cache of dl/
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: dl/
key: dl-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
key: dl-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
restore-keys: |
dl-${{ matrix.platform }}-${{ matrix.variant }}-
dl-${{ matrix.platform }}-
dl-${{ matrix.variant }}-
dl-
- name: Restore Cache of .ccache/
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .ccache/
key: ccache-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
key: ccache-${{ matrix.platform }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
restore-keys: |
ccache-${{ matrix.platform }}-${{ matrix.variant }}-
ccache-${{ matrix.platform }}-
ccache-
- name: Configure & Build
env:
INFIX_RELEASE: ${{ steps.build.outputs.ver }}
INFIX_RELEASE: ${{ steps.vars.outputs.ver }}
run: |
if [ "${{ matrix.variant }}" = "netconf" ]; then
target=${{ matrix.platform }}_defconfig
else
target=${{ matrix.platform }}_${{ matrix.variant }}_defconfig
fi
echo "Buildring $target ..."
echo "Building $target ..."
sudo mkdir ${{ steps.vars.outputs.out }}
sudo chown $(id -un):$(id -gn) ${{ steps.vars.outputs.out }}
export O=${{ steps.vars.outputs.out }}
make $target
make
- name: Prepare Artifact
run: |
cd output
mv images ${{ steps.build.outputs.dir }}
ln -s ${{ steps.build.outputs.dir }} images
tar chfz ${{ steps.build.outputs.tgz }} ${{ steps.build.outputs.dir }}
- uses: actions/upload-artifact@v3
cd ${{ steps.vars.outputs.out }}
mv images ${{ steps.vars.outputs.dir }}
ln -s ${{ steps.vars.outputs.dir }} images
tar chfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
- uses: actions/upload-artifact@v4
with:
path: output/${{ steps.build.outputs.tgz }}
path: ${{ steps.vars.outputs.out }}/${{ steps.vars.outputs.tgz }}
name: artifact-${{ matrix.variant }}-${{ matrix.platform }}
release:
name: Release Infix ${{ github.ref_name }}
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v3
- uses: actions/checkout@v4
- name: Set Release Variables
id: rel
run: |
if [ -n "${{ inputs.version }}" ]; then
ver=${{ inputs.version }}
else
ver=${GITHUB_REF#refs/tags/}
fi
echo "ver=${ver}" >> $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
else
echo "pre=false" >> $GITHUB_OUTPUT
echo "latest=false" >> $GITHUB_OUTPUT
fi
echo "pre=${{ steps.rel.outputs.pre }}"
echo "latest=${{ steps.rel.outputs.latest }}"
- uses: actions/download-artifact@v4
with:
pattern: "artifact-*"
merge-multiple: true
- name: Create checksums ...
run: |
for file in *.tar.gz; do
sha256sum $file > $file.sha256
done
- name: Extract ChangeLog entry ...
run: |
awk '/-----*/{if (x == 1) exit; x=1;next}x' ChangeLog.md \
awk '/^-----*$/{if (x == 1) exit; x=1;next}x' doc/ChangeLog.md \
|head -n -1 > release.md
cat release.md
- uses: ncipollo/release-action@v1
with:
name: Infix ${{ github.ref_name }}
prerelease: ${{ needs.build.outputs.pre }}
prerelease: ${{ steps.rel.outputs.pre }}
makeLatest: ${{ steps.rel.outputs.latest }}
bodyFile: release.md
artifacts: artifact/*
artifacts: "*.tar.gz*"
- name: Summary
run: |
cat <<EOF >> $GITHUB_STEP_SUMMARY
+28
View File
@@ -0,0 +1,28 @@
# To enable automatic sync of your Infix fork every day, or on dispatch,
# set the repoistory or organisation variable (not secret):
#
# SYNC_FORK = true
#
# You also need a GH_SYNC_REPO token allowed to update workflows. For
# more information on variables and secrets, see the GitHub docs.
# See https://docs.github.com/en/actions/learn-github-actions/variables
name: Synchronize your fork of Infix with upstream
on:
schedule:
- cron: 42 2 * * *
workflow_dispatch:
jobs:
sync_fork:
if: ${{github.repository_owner != 'kernelkit' && vars.SYNC_FORK == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: TobKed/github-forks-sync-action@master
with:
github_token: ${{ secrets.GH_SYNC_REPO }}
upstream_repository: KernelKit/infix
upstream_branch: main
target_branch: main
force: false
tags: true
+3
View File
@@ -1,7 +1,10 @@
*~
.gdb_history
/.backup
/.ccache
/dl
/output*
/x-*
/test/.venv
/test/.log
/local.mk
+2 -2
View File
@@ -2,8 +2,8 @@
path = buildroot
url = ../buildroot.git
[submodule "9pm"]
path = 9pm
path = test/9pm
url = ../9pm
[submodule "qeneth"]
path = qeneth
path = test/qeneth
url = ../qeneth.git
Submodule 9pm deleted from d8a9f678f2
-58
View File
@@ -1,58 +0,0 @@
Change Log
==========
All notable changes to the project are documented in this file.
[v23.06.0][] - 2023-06-23
-------------------------
Midsummer release. The first official Infix release, based on [Buildroot
2023.02.2][br2023.02.2], with NETCONF support using the [sysrepo][] and
[netopeer2][].
Supported YANG models in addition to those used by sysrepo and netopeer:
- [ietf-system][]
- Everything except radius authentication and timezone-utc-offset
- Augmented with MotD (Message of the Day), Infix YANG model
- [ietf-interfaces][]
- [ietf-ip][] augmented with IPv4LL similar to standardized IPv6LL
- [ietf-if-vlan-encapsulation][], Linux VLAN interfaces, e.g. `eth0.10`
- Linux bridge interfaces with native VLAN support, Infix YANG model
- Linux VETH pairs, Infix YANG model
> **DISCLAIMER:** the [Infix YANG models for Linux][yang23.06], are
> still under heavy development. New revisions are expected which may
> not be backwards compatible. When upgrading to a new release, test on
> a GNS3 staging environment first, or start over from a factory reset.
[br2023.02.2]: https://git.busybox.net/buildroot/tag/?h=2023.02.2
[ietf-system]: https://www.rfc-editor.org/rfc/rfc7317.html
[ietf-interfaces]: https://www.rfc-editor.org/rfc/rfc7223.html
[ietf-ip]: https://www.rfc-editor.org/rfc/rfc8344.html
[ietf-if-vlan-encapsulation]: https://www.ietf.org/id/draft-ietf-netmod-sub-intf-vlan-model-08.html
[yang23.06]: https://github.com/kernelkit/infix/blob/aea74842e0475441d8df834f2dcd8cbc21fa253d/src/confd/yang/infix-interfaces%402023-06-05.yang
### Changes
- Bump sysrepo to v2.2.73
- Backport support for initializing factory-default data store with
default config data also for sysrepo internal modules.
- Add support for `sysrepocfg -Cfactory -d running`, for testing
- Bump netopeer2 to v2.1.62
- Bump libyang to v2.1.80
- Add klish, a CLI for sysrepo
- Add podman for container support, backported from upstream Buildroot
- Add conmon for container support, backported from upstream Buildroot
- Backport cni-plugins support for host-local and static plugins
### Fixes
- N/A
[buildroot]: https://buildroot.org/
[UNRELEASED]: https://github.com/kernelkit/infix/compare/v23.06.0...HEAD
[v23.06.0]: https://github.com/kernelkit/infix/compare/BASE...v23.06.0
[sysrepo]: https://www.sysrepo.org/
[netopeer2]: https://github.com/CESNET/netopeer2
+105
View File
@@ -1,3 +1,108 @@
menu "Branding"
config INFIX_VENDOR
string "Vendor name"
default "KernelKit"
help
The name of the operating system vendor. This is the name of the
organization or company which produces the OS.
This name is intended to be exposed in "About this system" UIs or
software update UIs when needed to distinguish the OS vendor from
the OS itself. It is intended to be human readable.
Used for VENDOR_NAME in /etc/os-release and GNS3 appliance files.
config INFIX_VENDOR_HOME
string "Vendor URL"
help
The homepage of the OS vendor. The value should be in RFC3986
format, and should be "http:" or "https:" URLs. Only one URL shall
be listed in the setting.
Optional, used for VENDOR_HOME in /etc/os-release
config INFIX_NAME
string "Operating system name"
default "Infix"
help
Mandatory. Used for identifying the OS as NAME in /etc/os-release
and product_name in GNS3 appliance files.
config INFIX_ID
string "Operating system identifier"
default "infix"
help
A lower-case string (no spaces or other characters outside of 09,
az, '.', '_' and '-') identifying the operating system, excluding
any version information and suitable for processing by scripts or
usage in generated filenames.
Mandatory. Used for identifying the OS as ID in /etc/os-release and
in the generated image name: ID-ARCH-VERSION.img
config INFIX_IMAGE_ID
string "Operating system image name"
default "${INFIX_ID}-${BR2_ARCH}"
help
A lower-case string (no spaces or other characters outside of 09,
az, ".", "_" and "-"), for naming critical image files, directories
and archives containting the operating system.
Mandatory. When INFIX_RELEASE is set, this string is appended to
the IMAGE_ID with a '-' separator.
config INFIX_TAGLINE
string "Operating system tagline"
default "Infix -- a Network Operating System"
help
Mandatory. Used for identifying the OS, e.g. as PRETTY_NAME in
/etc/os-release and description in the GNS3 appliance.
This is also show at boot when the system init process starts.
config INFIX_DESC
string "Operating system description"
help
Optional. Used for long description texts about the OS. E.g.,
the GNS3 appliance file description field. Saved in the file
/etc/os-release as INFIX_DESC.
config INFIX_HOME
string "Operating system URL"
help
Used for identifying the OS, e.g. as HOME_URL in /etc/os-release
config INFIX_DOC
string "Operating system docs"
help
Optional. Main documentation URL, will be shown in /etc/os-release
as DOCUMENTATION_URL.
config INFIX_SUPPORT
string "Operating system support"
help
Main support page for the operating system, if there is any. This
is primarily intended for operating systems which vendors provide
support for. May be a http:, https:, or mailto: URI.
Optional. Shown, e.g., as SUPPORT_URL in /etc/os-release or
maintainer_email in .gns3a.
config INFIX_OEM_PATH
string "Path to OEM br2-external"
help
A br2-external using Infix will likely want to version the branded
OS using their own GIT tags. Set this variable to point to the base
directory (absolute path) and the Infix post-build.sh will call `git
describe -C $INFIX_OEM_PATH`.
Note: for release builds the global variable INFIX_RELEASE overrides
the version information derived from `git describe`. However, the
GIT version is always saved as the BUILD_ID in /etc/os-releases.
endmenu
# For /etc/os-release, uses CondtionArchitechture= from systemd.unit(5)
config INFIX_ARCH
string
+9 -2
View File
@@ -11,6 +11,10 @@ bmake = $(MAKE) -C buildroot O=$(O) $1
all: $(config) buildroot/Makefile
@+$(call bmake,$@)
check dep:
@echo "Starting local check, stage $@ ..."
@make -C src $@
$(config):
@+$(call bmake,list-defconfigs)
@echo "\e[7mERROR: No configuration selected.\e[0m"
@@ -18,11 +22,14 @@ $(config):
@echo "'make <board>_defconfig' before building an image."
@exit 1
%: | buildroot/Makefile
@+$(call bmake,$@)
# Workaround, see board/x86_64/board.mk
test:
@+$(call bmake,$@)
buildroot/Makefile:
@git submodule update --init
.PHONY: all
.PHONY: all check test
+127 -206
View File
@@ -1,217 +1,138 @@
<img align="right" src="doc/text3134.png" alt="Infix Linux Networking Made Easy">
[![License Badge][]][License] [![Coverity Status][]][Coverity Scan] [![Discord][discord-badge]][discord-url]
* [Introduction](#introduction)
* [NETCONF Mode](#netconf-mode)
* [NETCONF Mode](#netconf-mode)
* [Classic Mode](#classic-mode)
* [Hybrid Mode](#hybrid-mode)
* [Hardware](#hardware)
* [Qemu](#qemu)
* [GNS3](#gns3)
* [Building](#building)
* [Origin & Licensing](origin--licensing)
<img align="right" src="doc/logo.png" alt="Infix - Linux <3 NETCONF" width=480 border=10>
<details><summary><b>Documentation</b></summary>
- **Infix In-Depth**
- [Infix Variants](doc/variant.md)
- [Boot Procedure](doc/boot.md)
- [Containers in Infix](doc/container.md)
- [Developer's Guide](doc/developers-guide.md)
- [Discover Your Device](doc/discovery.md)
- [Virtual Environments](doc/virtual.md)
- [Origin & Licensing](doc/license.md)
- **CLI Topics**
- [Introduction to the CLI](doc/cli/introduction.md)
- [CLI User's Guide](doc/cli/tutorial.md)
- [Quick Overview](doc/cli/quick.md)
Introduction
------------
</details>
Infix is an embedded Linux Network Operating System (NOS) based on
[Buildroot][1], [Finit][2], [ifupdown-ng][3], and [sysrepo][6].
Providing an easy-to-maintain and easy-to-port Open Source base for
networked equipment.
Infix is a free, Linux based, immutable Network Operating System (NOS)
built on [Buildroot][1], and [sysrepo][2]. A powerful mix that ease
porting to different platforms, simplify long-term maintenance, and
provide made-easy management using NETCONF[^1] or the built-in [command
line interface (CLI)][3] from a console or SSH login. *Click the
foldout (▶ Example CLI Session) below for an example.*
Although primarily focused on switches and routers, the core values
may be appealing for other use-cases as well:
- Runs from a squashfs image on a read-only partition
- Single configuration file on a separate partition
- Built around YANG with standard IETF models
- Linux switchdev provides open switch APIs
- Atomic upgrades to secondary partition
- Highly security focused
An immutable[^2] operating system enhances security and inherently makes
it maintenance-free. Configuration and data, e.g, containers, is stored
on separate partitions to ensure complete separation from system files
and allow for seamless backup, restore, and provisioning.
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.
The simple design of Infix provides complete control over both system
and data, minimal cognitive burden, and makes it incredibly easy to get
started.
<details><summary><b>Example CLI Session</b></summary>
The CLI configure context is automatically generated from the loaded
YANG models and their corresponding [sysrepo][2] plugins. The following
is brief example of how to set the IP address of an interface:
```
admin@infix-12-34-56:/> configure
admin@infix-12-34-56:/config/> edit interface eth0
admin@infix-12-34-56:/config/interface/eth0/> set ipv4 <TAB>
address autoconf bind-ni-name enabled
forwarding mtu neighbor
admin@infix-12-34-56:/config/interface/eth0/> set ipv4 address 192.168.2.200 prefix-length 24
admin@infix-12-34-56:/config/interface/eth0/> show
type ethernet;
ipv4 {
address 192.168.2.200 {
prefix-length 24;
}
}
ipv6
admin@infix-12-34-56:/config/interface/eth0/> diff
interfaces {
interface eth0 {
+ ipv4 {
+ address 192.168.2.200 {
+ prefix-length 24;
+ }
+ }
}
}
admin@infix-12-34-56:/config/interface/eth0/> leave
admin@infix-12-34-56:/> show interfaces
INTERFACE PROTOCOL STATE DATA
eth0 ethernet UP 52:54:00:12:34:56
ipv4 192.168.2.200/24 (static)
ipv6 fe80::5054:ff:fe12:3456/64 (link-layer)
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
admin@infix-12-34-56:/> copy running-config startup-config
```
[Click here][3] for more details.
</details>
Infix can run on many different types of architectures and boards, much
thanks to Linux and Buildroot. Currently the focus is on 64-bit ARM
devices, optionally with switching fabric supported by Linux switchdev.
The [following boards](board/aarch64/README.md) are fully supported:
- Marvell CN9130 CRB
- Marvell EspressoBIN
- Microchip SparX-5i PCB135 (eMMC)
- NanoPi R2S
An x86_64 build is also available, primarily intended for development
and testing, but can also be used for evaluation and demo purposes. For
more information, see: [Infix in Virtual Environments](doc/virtual.md).
> See the [GitHub Releases](https://github.com/kernelkit/infix/releases)
> page for out pre-built images. The *Latest Build* has the bleeding edge
> images, if possible we recommend using a versioned release.
> page for our pre-built images. The *Latest Build* has the bleeding
> edge images, if possible we recommend using a versioned release.
>
> For customer specific builds of Infix, see your respective repository.
> For *customer specific builds* of Infix, see your product repository.
Infix has two main *flavors*, or defconfigs:
[^1]: NETCONF or RESTCONF, <https://datatracker.ietf.org/doc/html/rfc8040>,
for more information, see [Infix Variants](doc/variant.md).
- **NETCONF:** the default, managed using, e.g., the `cli` tool
- **Classic:** built from `$ARCH_classic_defconfig`, more below
[^2]: An immutable operating system is one with read-only file systems,
atomic updates, rollbacks, declarative configuration, and workload
isolation. All to improve reliability, scalability, and security.
For more information, see <https://ceur-ws.org/Vol-3386/paper9.pdf>
and <https://www.zdnet.com/article/what-is-immutable-linux-heres-why-youd-run-an-immutable-linux-distro/>.
Both flavors have an `admin` user, which is allowed to log in from
remote, password `admin` on standard builds. It is the recommended
account to use for managing Infix. (The `root` account is currently
also available, but will soon become a non-login account used only for
running system services.)
### NETCONF Mode
NETCONF is the primary reason Infix exists. Configuration of an Infix
device can be done either remotely, using tools like [netconf-client][]
or [netopeer2-cli][], or locally using the [`cli` tool](doc/cli.md).
Infix use [sysrepo][6] as the data store for NETCONF. A set of plugins
configure the network, using iproute2, generate configuration files in
`/etc`, and control the system daemons, e.g., enable DHCP client on an
interface.
### Classic Mode
Here it is up to the administrator to modify configuration files in
`/etc` and control the system daemons using the `initctl` tool.
See the online `help` command for an introduction to the system.
### Hybrid Mode
Since Infix is under heavy development, it does not yet have all bells
and whistles in place, in particular in the default build. To that end
it is possible to manually manage certain services that are not yet
possible to configure using NETCONF.
At bootstrap Finit can start user scripts from a [run-parts(8)][] like
directory: `/cfg/start.d`. For example, the following starts OSPF:
```sh
root@infix:~$ mkdir /cfg/start.d
root@infix:~$ cd /cfg/start.d
root@infix:/cfg/start.d$ cat <<EOF >10-enable-ospf.sh
#!/bin/sh
# Use vtysh to modify the OSPF configuration
rm /etc/frr/frr.conf
ln -s /cfg/frr/frr.conf /etc/frr/
initctl enable zebra
initctl enable ospfd
initctl enable bfdd
exit 0
EOF
root@infix:/cfg/start.d$ chmod +x 10-enable-ospf.sh
```
> **Note:** Neither [Frr](https://frrouting.org) (Zebra/OSPF/BFD) or
> [podman](https://podman.io) are enabled in default Infix builds.
> Please use customer specific builds, or enable it yourself in Infix by
> using `make menuconfig` followed by rebuilding the image.
This is also the way to start containers (provided the images have been
downloaded with `podman pull` first):
```
root@infix:/cfg/start.d$ cat <<EOF >20-enable-container.sh
#!/bin/sh
podman-service -e -d "Nginx container" -p "-p 80:80" nginx:alpine
exit 0
EOF
root@infix:/cfg/start.d$ chmod +x 20-enable-container.sh
```
Reboot to activate the changes. To activate the changes without
rebooting, run the script and call `initctl reload`.
Hardware
--------
### aarch64
By default, Infix builds with support for the following boards (you
may enable additional boards in the config, of course):
- Marvell CN9130 CRB
- Marvell EspressoBIN
- Microchip SparX-5i PCB135 (eMMC)
See the aarch64 specific [documentation](board/aarch64/README.md) for more
information.
### x86_64
Primarily intended to be run under [QEMU][] for development & test as
well as evaluation, demo and [training][] purposes, e.g. using [GNS3][]
or [Qeneth][7].
QEMU
----
A virtualized instance can easily be launched from a Linux system, with
Qemu installed, by issuing `make run`.
Some settings, e.g. networking, can be configured via `make menuconfig`
under `External options -> QEMU virtualization`.
GNS3
----
Download the [latest build][0] of the `x86_64`, or `x86_64_classic`
flavor. Unpack in a dedicated directory and use ["Import Appliance"][9]
to install the `.gns3a` file into GNS3. Infix (`x86_64`) is in the
"Router" category, it has 10 interfaces available by default for use as
switch ports or routing. The *classic* build only has one interface by
default, geared more towards acting as an end device.
Building
--------
Buildroot is almost stand-alone, but need a few locally installed tools
to bootstrap itself. For details, see the [excellent manual][manual].
Briefly, to build an Infix image; select the target and then make:
make x86_64_defconfig
make
Online help is available:
make help
To see available defconfigs for supported targets, use:
make list-defconfigs
> **Note:** build dependencies (Debian/Ubuntu): <kbd>sudo apt install make libssl-dev</kbd>
Origin & Licensing
------------------
Infix is entirely built on Open Source components (packages). Most of
them, as well as the build system with its helper scripts and tools, is
from [Buiildroot][1], which is distributed under the terms of the GNU
General Public License (GPL). See the file COPYING for details.
Some files in Buildroot contain a different license statement. Those
files are licensed under the license contained in the file itself.
Buildroot and Infix also bundle patch files, which are applied to the
sources of the various packages. Those patches are not covered by the
license of Buildroot or Infix. Instead, they are covered by the license
of the software to which the patches are applied. When said software is
available under multiple licenses, the patches are only provided under
the publicly accessible licenses.
Infix releases include the license information covering all Open Source
packages. This is extracted automatically at build time using the tool
`make legal-info`. Any proprietary software built on top of Infix, or
Buildroot, would need separate auditing to ensure it does not link with
any GPL[^1] licensed library.
[^1]: Infix image builds use GNU libc (GLIBC) which is covered by the
[LGPL][4]. The LGPL *does allow* proprietary software, as long as
said software is linking dynamically, [not statically][5], to GLIBC.
[0]: https://github.com/kernelkit/infix/releases/tag/latest
[1]: https://buildroot.org/
[2]: https://github.com/troglobit/finit
[3]: https://github.com/ifupdown-ng/ifupdown-ng
[4]: https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License
[5]: https://lwn.net/Articles/117972/
[6]: https://www.sysrepo.org/
[7]: https://github.com/wkz/qeneth
[8]: https://addiva-elektronik.github.io/2023/05/12/using-netconf-client-and-server-to-update-switch-configuration/
[9]: https://docs.gns3.com/docs/using-gns3/beginners/import-gns3-appliance/
[QEMU]: https://www.qemu.org/
[GNS3]: https://gns3.com/
[training]: https://addiva-elektronik.github.io/
[manual]: https://buildroot.org/downloads/manual/manual.html
[run-parts(8)]: https://manpages.ubuntu.com/manpages/trusty/man8/run-parts.8.html
[netconf-client]: https://pypi.org/project/netconf-client/
[netopeer2-cli]: https://github.com/CESNET/netopeer2
[2]: https://www.sysrepo.org/
[3]: doc/cli/introduction.md
[License]: https://en.wikipedia.org/wiki/GPL_license
[License Badge]: https://img.shields.io/badge/License-GPL%20v2-blue.svg
[Coverity Scan]: https://scan.coverity.com/projects/29393
[Coverity Status]: https://scan.coverity.com/projects/29393/badge.svg
[discord-badge]: https://img.shields.io/discord/1182652155618918411.svg?logo=discord
[discord-url]: https://discord.gg/6bHJWQNVxN
@@ -0,0 +1,51 @@
/ {
config {
environment {
/* After the MMC driver has enabled bus power,
* the controller seems to sometimes detect a
* card removal state , which causes it to
* disable power again. This hack re-enables the
* bus power in those cases.
*/
bootcmd = "
setexpr.b pwrctl *0xf2780029
setexpr pwrctl ${pwrctl} \"|\" 1
mw.b 0xf2780029 ${pwrctl}
run ixboot
";
boot_targets = "mmc1";
ethprime = "eth1";
/* Uncomment this if you're debugging U-Boot
*
* This will allow you to break out of the
* normal boot flow and into the interactive
* console.
*
* To upgrade U-Boot itself, simply set the
* `bootfile` variable to the path of
* `flash-image.bin` on your TFTP server, then
* issue `run ixupgradeboot`.
*/
/* bootdelay = "2"; */
/* ixupgradeboot = " */
/* dhcp */
/* setexpr fileblks ${filesize} + 0x1ff */
/* setexpr fileblks ${fileblks} / 0x200 */
/* mmc dev 1 */
/* part start mmc 1 boot bootstart */
/* part size mmc 1 boot bootsize */
/* mmc erase ${bootstart} ${bootsize} */
/* mmc write ${fileaddr} ${bootstart} ${fileblks} */
/* "; */
};
};
};
/* &cp0_eth0 { */
/* phy-mode = "10gbase-r"; */
/* }; */
@@ -0,0 +1,4 @@
CONFIG_DEVICE_TREE_INCLUDES="infix-env.dtsi infix-key.dtsi cn9130-crb-env.dtsi"
CONFIG_ENV_IS_NOWHERE=y
# CONFIG_ENV_IS_IN_MMC is not set
+76
View File
@@ -0,0 +1,76 @@
#ifndef _ALDER_MPP_H
#define _ALDER_MPP_H
#define CP_SMI_MDIO(X) X( "mpp0", none, 0, 0)
#define CP_SMI_MDC(X) X( "mpp1", none, 0, 0)
#define CP_XSMI_MDIO(X) X( "mpp2", none, 0, 0)
#define CP_XSMI_MDC(X) X( "mpp3", none, 0, 0)
/* mpp4: Unused */
/* mpp5: Unused */
/* mpp6: Unused */
#define SFP9_TX_FAULT(X) X( "mpp7", cp0_gpio1, 7, GPIO_ACTIVE_HIGH)
#define SFP9_TX_DISABLE(X) X( "mpp8", cp0_gpio1, 8, GPIO_ACTIVE_HIGH)
#define SFP9_MOD_ABS(X) X( "mpp9", cp0_gpio1, 9, GPIO_ACTIVE_LOW)
#define SW_RESETn(X) X("mpp10", cp0_gpio1, 10, GPIO_ACTIVE_LOW)
#define SFP9_RS0(X) X("mpp11", cp0_gpio1, 11, GPIO_ACTIVE_HIGH)
/* mpp12: Unused */
#define CP_SPI1_MISO(X) X("mpp13", none, 0, 0)
#define CP_SPI1_CS0(X) X("mpp14", none, 0, 0)
#define CP_SPI1_MOSI(X) X("mpp15", none, 0, 0)
#define CP_SPI1_SCK(X) X("mpp16", none, 0, 0)
#define WDT_TICKLE(X) X("mpp17", cp0_gpio1, 17, GPIO_ACTIVE_HIGH)
/* mpp18: Unused */
/* mpp19: Unused */
/* mpp20: Unused */
/* mpp21: Unused */
/* mpp22: Unused */
/* mpp23: Unused */
#define DDR_TEN(X) X("mpp24", cp0_gpio1, 24, GPIO_ACTIVE_HIGH)
#define ETH9_RESETn(X) X("mpp25", cp0_gpio1, 25, GPIO_ACTIVE_LOW)
#define SW_INTn(X) X("mpp26", cp0_gpio1, 26, IRQ_TYPE_LEVEL_LOW)
#define SFP9_RS1(X) X("mpp27", cp0_gpio1, 27, GPIO_ACTIVE_HIGH)
#define SFP10_TX_FAULT(X) X("mpp28", cp0_gpio1, 28, GPIO_ACTIVE_HIGH)
#define CP_UA0_RXD(X) X("mpp29", none, 0, 0)
#define CP_UA0_TXD(X) X("mpp30", none, 0, 0)
#define SFP10_TX_DISABLE(X) X("mpp31", cp0_gpio1, 31, GPIO_ACTIVE_HIGH)
#define SFP10_MOD_ABS(X) X("mpp32", cp0_gpio2, 0, GPIO_ACTIVE_LOW)
#define I2C_IRQ(X) X("mpp33", cp0_gpio2, 1, IRQ_TYPE_LEVEL_LOW)
#define SFP10_RS0(X) X("mpp34", cp0_gpio2, 2, GPIO_ACTIVE_HIGH)
#define CP_I2C1_SDA(X) X("mpp35", none, 0, 0)
#define CP_I2C1_SCK(X) X("mpp36", none, 0, 0)
#define CP_I2C0_SCK(X) X("mpp37", none, 0, 0)
#define CP_I2C0_SDA(X) X("mpp38", none, 0, 0)
#define SFP10_RX_LOS(X) X("mpp39", cp0_gpio2, 7, GPIO_ACTIVE_HIGH)
#define SFP10_RS1(X) X("mpp40", cp0_gpio2, 8, GPIO_ACTIVE_HIGH)
#define CP_SD_CRD_PWR_OFF(X) X("mpp41", none, 0, 0)
#define CP_SD_HST_18_EN(X) X("mpp42", none, 0, 0)
#define CP_SD_CRD_DT(X) X("mpp43", none, 0, 0)
#define ETH9_INTn(X) X("mpp44", cp0_gpio2, 12, GPIO_ACTIVE_LOW)
/* mpp45: Unused */
#define ETH10_RESETn(X) X("mpp46", cp0_gpio2, 14, GPIO_ACTIVE_LOW)
#define I2C_RESETn(X) X("mpp47", cp0_gpio2, 15, GPIO_ACTIVE_LOW)
#define ETH10_INTn(X) X("mpp48", cp0_gpio2, 16, GPIO_ACTIVE_LOW)
#define DEV_MODEn(X) X("mpp49", cp0_gpio2, 17, GPIO_ACTIVE_LOW)
#define USB1_VBUS_ENABLE(X) X("mpp50", cp0_gpio2, 18, GPIO_ACTIVE_HIGH)
#define USB1_VBUS_ERROR_OC(X) X("mpp51", cp0_gpio2, 19, GPIO_ACTIVE_HIGH)
/* mpp52: Unused */
#define SFP9_RX_LOS(X) X("mpp53", cp0_gpio2, 21, GPIO_ACTIVE_HIGH)
/* mpp54: Unused */
#define CP_SD_LED(X) X("mpp55", none, 0, 0)
#define CP_SD_CLK(X) X("mpp56", none, 0, 0)
#define CP_SD_CMD(X) X("mpp57", none, 0, 0)
#define CP_SD_D0(X) X("mpp58", none, 0, 0)
#define CP_SD_D1(X) X("mpp59", none, 0, 0)
#define CP_SD_D2(X) X("mpp60", none, 0, 0)
#define CP_SD_D3(X) X("mpp61", none, 0, 0)
/* mpp62: Unused */
/* Macros to extract MPP info in different formats */
#define MPP_ID(_mpp, _chip, _no, _flags) _mpp
#define MPP_GPIO_CHIP(_mpp, _chip, _no, _flags) _chip
#define MPP_GPIO_REF(_mpp, _chip, _no, _flags) <&_chip _no _flags>
#define MPP_GPIO_REF_NO_CHIP(_mpp, _chip, _no, _flags) <_no _flags>
#define MPP_IRQ_REF(_mpp, _chip, _no, _flags) <&_chip _no _flags>
#endif /* _ALDER_MPP_H */
+9
View File
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Copyright (C) 2021 Marvell International Ltd.
* Copyright (C) 2023 Addiva Elektronik AB
*
* Device tree for Alder board
*/
#include "alder.dtsi"
+718
View File
@@ -0,0 +1,718 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Copyright (C) 2021 Marvell International Ltd.
* Copyright (C) 2023 Addiva Elektronik AB
*
* Device tree for Alder board
*/
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
#include "../marvell/cn9130-patched.dtsi"
#include "alder-mpp.h"
/ {
model = "Alder";
compatible = "alder,alder",
"marvell,armada-ap807-quad",
"marvell,armada-ap807";
chosen {
stdout-path = "serial0:115200n8";
infix {
vpds = <&vpd_cpu &vpd_product &vpd_power>;
usb-ports = <&cp0_usb3_1>;
usb-port-names = "USB";
};
};
memory@0 {
device_type = "memory";
reg = <0x0 0x0 0x0 0x80000000>;
};
};
/* UART0 (Console) */
&cp0_pinctrl {
cp0_uart0_pins: cp0-uart0-pins {
marvell,pins = CP_UA0_RXD(MPP_ID), CP_UA0_TXD(MPP_ID);
marvell,function = "uart0";
};
};
&uart0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&cp0_uart0_pins>;
};
/* GPIO */
&cp0_gpio1 {
status = "okay";
};
&cp0_gpio2 {
status = "okay";
};
/* I2C0 (EEPROM) */
&cp0_pinctrl {
cp0_i2c0_pins: cp0-i2c0-pins {
marvell,pins = CP_I2C0_SCK(MPP_ID), CP_I2C0_SDA(MPP_ID);
marvell,function = "i2c0";
};
};
&cp0_i2c0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&cp0_i2c0_pins>;
vpd_cpu: eeprom@50 {
// AT24C256C-MAHL-T
compatible = "atmel,24c256";
reg = <0x50>;
infix,board = "cpu";
infix,trusted;
};
};
/* I2C1 (Mux) */
&cp0_pinctrl {
cp0_i2c1_pins: cp0-i2c1-pins {
marvell,pins = CP_I2C1_SCK(MPP_ID), CP_I2C1_SDA(MPP_ID);
marvell,function = "i2c1";
};
};
&cp0_i2c1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&cp0_i2c1_pins>;
i2cmux@70 {
compatible = "nxp,pca9548";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x70>;
reset-gpios = I2C_RESETn(MPP_GPIO_REF);
i2c_sysmgmt: i2c@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
};
i2c_pwr: i2c@1 {
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
};
i2c_sw: i2c@2 {
#address-cells = <1>;
#size-cells = <0>;
reg = <2>;
};
i2c_sfp9: i2c@3 {
#address-cells = <1>;
#size-cells = <0>;
reg = <3>;
};
i2c_sfpa: i2c@4 {
#address-cells = <1>;
#size-cells = <0>;
reg = <4>;
};
i2c@5 {
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
reg = <5>;
};
i2c@6 {
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
reg = <6>;
};
i2c@7 {
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
reg = <7>;
};
};
};
/* System Management */
&i2c_sysmgmt {
vpd_product: eeprom@b {
label = "vpd";
reg = <0x0b>;
compatible = "atmel,24c02";
infix,board = "product";
nvmem-layout {
compatible = "onie,tlv-layout";
base_mac: mac-address {
#nvmem-cell-cells = <1>;
};
};
};
};
/* AP SDHCI (eMMC) */
&ap_sdhci0 {
status = "okay";
pinctrl-names = "default";
/* pinctrl-0 = <&ap_emmc_pins>; No pinctrl in Linux? */
bus-width = <8>;
mmc-ddr-1_8v;
mmc-hs400-1_8v;
};
/* SPI1 (Boot FLASH) */
&cp0_pinctrl {
cp0_spi1_pins: cp0-spi-pins-0 {
marvell,pins = \
CP_SPI1_MISO(MPP_ID), CP_SPI1_CS0(MPP_ID), \
CP_SPI1_MOSI(MPP_ID), CP_SPI1_SCK(MPP_ID);
marvell,function = "spi1";
};
};
&cp0_spi1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&cp0_spi1_pins>;
/* Boot flash */
spi-flash@0 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "jedec,spi-nor", "spi-flash";
reg = <0x0>;
/* On-board MUX does not allow higher frequencies */
spi-max-frequency = <40000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot0@0 {
label = "boot0";
reg = <0x0 0x200000>;
};
boot1@200000 {
label = "boot1";
reg = <0x200000 0x200000>;
};
};
};
};
/* USB1 */
/ {
cp0_usb3_0_phy1: cp0_usb3_phy {
compatible = "usb-nop-xceiv";
vcc-supply = <&reg_cp0_usb3_vbus1>;
};
reg_cp0_usb3_vbus1: reg_cp0_usb3_vbus1 {
compatible = "regulator-fixed";
regulator-name = "cp0-xhci1-vbus";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
enable-active-high;
gpio = USB1_VBUS_ENABLE(MPP_GPIO_REF);
};
};
&cp0_utmi {
status = "okay";
};
&cp0_utmi1 {
status = "okay";
dr_mode = "host";
};
&cp0_usb3_1 {
status = "okay";
usb-phy = <&cp0_usb3_0_phy1>;
phys = <&cp0_utmi1>, <&cp0_comphy3 1>;
phy-names = "usb", "usb3";
dr_mode = "host";
};
/* ETH0 (DSA connection to switch) */
&cp0_crypto {
status = "okay";
};
&cp0_ethernet {
status = "okay";
};
&cp0_eth0 {
status = "okay";
phy-mode = "10gbase-r";
phys = <&cp0_comphy4 0>;
managed = "in-band-status";
nvmem-cells = <&base_mac 0>;
nvmem-cell-names = "mac-address";
};
/* MDIO (Switch) */
&cp0_pinctrl {
cp0_mdio_pins: cp0-mdio-pins-0 {
marvell,pins = CP_SMI_MDIO(MPP_ID), CP_SMI_MDC(MPP_ID);
marvell,function = "ge";
};
};
&cp0_mdio {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&cp0_mdio_pins>;
sw: switch@0 {
compatible = "marvell,mv88e6190";
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
reset-gpios = SW_RESETn(MPP_GPIO_REF);
interrupts-extended = SW_INTn(MPP_IRQ_REF);
interrupt-controller;
dsa,member = <0 0>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0x0>;
label = "cpu";
ethernet = <&cp0_eth0>;
phy-mode = "10gbase-r";
fixed-link {
speed = <10000>;
full-duplex;
};
};
#define SWP_COMMON(_n, _label, _mac_offs, _phymode, _phy) \
reg = <0x ## _n>; \
label = _label; \
phy-mode = _phymode; \
phy-handle = <&_phy>; \
\
nvmem-cells = <&base_mac _mac_offs>; \
nvmem-cell-names = "mac-address"
#define XSWP(_n, _label, _mac_offs, _phy) \
port@_n { \
SWP_COMMON(_n, _label, _mac_offs, "usxgmii", _phy); \
}
#define GSWP(_n, _label, _mac_offs, _phy) \
port@_n { \
SWP_COMMON(_n, _label, _mac_offs, "gmii", _phy); \
\
leds { \
#address-cells = <1>; \
#size-cells = <0>; \
\
led@0 { \
reg = <0>; \
function = "tp"; \
color = <LED_COLOR_ID_GREEN>; \
default-state = "keep"; \
}; \
led@1 { \
reg = <1>; \
function = "tp"; \
color = <LED_COLOR_ID_YELLOW>; \
default-state = "off"; \
}; \
}; \
}
XSWP(9, "x1", 1, xphy9);
XSWP(a, "x2", 2, xphya);
GSWP(8, "x3", 3, swphy8);
GSWP(7, "x4", 4, swphy7);
GSWP(6, "x5", 5, swphy6);
GSWP(5, "x6", 6, swphy5);
GSWP(4, "x7", 7, swphy4);
GSWP(3, "x8", 8, swphy3);
GSWP(2, "x9", 9, swphy2);
GSWP(1, "x10", 10, swphy1);
#undef GSWP
#undef XSWP
#undef SWP_COMMON
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
#define SWPHY(_n) \
ethernet-phy@_n { \
compatible = "ethernet-phy-ieee802.3-c22"; \
reg = <_n>; \
eee-broken-100tx; \
eee-broken-1000t; \
}
swphy1: SWPHY(1);
swphy2: SWPHY(2);
swphy3: SWPHY(3);
swphy4: SWPHY(4);
swphy5: SWPHY(5);
swphy6: SWPHY(6);
swphy7: SWPHY(7);
swphy8: SWPHY(8);
#undef SWPHY
};
};
};
/* XMDIO (88X3310P 10G PHYs) */
&cp0_pinctrl {
cp0_xmdio_pins: cp0-xmdio-pins-0 {
marvell,pins = CP_XSMI_MDIO(MPP_ID), CP_XSMI_MDC(MPP_ID);
marvell,function = "xg";
};
};
&ETH9_RESETn(MPP_GPIO_CHIP) {
xphy9-reset-hog {
gpio-hog;
gpios = ETH9_RESETn(MPP_GPIO_REF_NO_CHIP);
output-low;
line-name = "x1-phy-reset";
};
};
&ETH10_RESETn(MPP_GPIO_CHIP) {
xphya-reset-hog {
gpio-hog;
gpios = ETH10_RESETn(MPP_GPIO_REF_NO_CHIP);
output-low;
line-name = "x2-phy-reset";
};
};
&cp0_xmdio {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&cp0_xmdio_pins>;
/* 88X3310 specifices 35ns minimum MDC period (28.57 MHz). */
clock-frequency = <28571428>;
#define XPHY(_n, _sfp) \
ethernet-phy@_n { \
compatible = "ethernet-phy-ieee802.3-c45"; \
reg = <_n>; \
sfp = <&_sfp>; \
\
leds { \
#address-cells = <1>; \
#size-cells = <0>; \
\
led@0 { \
reg = <0>; \
function = "tp"; \
color = <LED_COLOR_ID_YELLOW>; \
default-state = "off"; \
\
marvell,media = "copper"; \
marvell,polarity = "active-high"; \
}; \
led@1 { \
reg = <1>; \
function = "tp"; \
color = <LED_COLOR_ID_GREEN>; \
default-state = "keep"; \
\
marvell,media = "copper"; \
marvell,polarity = "active-high"; \
}; \
\
led@2 { \
reg = <2>; \
function = "sfp"; \
color = <LED_COLOR_ID_YELLOW>; \
default-state = "off"; \
\
marvell,media = "fiber"; \
marvell,polarity = "active-high"; \
}; \
led@3 { \
reg = <3>; \
function = "sfp"; \
color = <LED_COLOR_ID_GREEN>; \
default-state = "keep"; \
\
marvell,media = "fiber"; \
marvell,polarity = "active-high"; \
}; \
}; \
}
xphy9: XPHY(4, sfp9);
xphya: XPHY(5, sfpa);
#undef XPHY
};
/ {
sfp9: sfp@9 {
compatible = "sff,sfp";
i2c-bus = <&i2c_sfp9>;
mod-def0-gpios = SFP9_MOD_ABS(MPP_GPIO_REF);
los-gpios = SFP9_RX_LOS(MPP_GPIO_REF);
tx-disable-gpios = SFP9_TX_DISABLE(MPP_GPIO_REF);
tx-fault-gpios = SFP9_TX_FAULT(MPP_GPIO_REF);
rate-select0-gpios = SFP9_RS0(MPP_GPIO_REF);
rate-select1-gpios = SFP9_RS1(MPP_GPIO_REF);
maximum-power-milliwatt = <3000>;
};
sfpa: sfp@a {
compatible = "sff,sfp";
i2c-bus = <&i2c_sfpa>;
mod-def0-gpios = SFP10_MOD_ABS(MPP_GPIO_REF);
los-gpios = SFP10_RX_LOS(MPP_GPIO_REF);
tx-disable-gpios = SFP10_TX_DISABLE(MPP_GPIO_REF);
tx-fault-gpios = SFP10_TX_FAULT(MPP_GPIO_REF);
rate-select0-gpios = SFP10_RS0(MPP_GPIO_REF);
rate-select1-gpios = SFP10_RS1(MPP_GPIO_REF);
maximum-power-milliwatt = <3000>;
};
};
/* Power Board */
&cp0_pinctrl {
cp0_pwr_gpio_pins: cp0-pwr-gpio-0 {
marvell,pins = I2C_IRQ(MPP_ID);
marvell,function = "gpio";
};
};
&i2c_pwr {
// Shared IRQ on I2C_IRQ
pinctrl-names = "default";
pinctrl-0 = <&cp0_pwr_gpio_pins>;
// 0x26 U13 PCF8574 GPIO I/O
gpio_pwr1: gpio@26 {
compatible = "nxp,pcf8574a";
#gpio-cells = <2>;
gpio-controller;
#interrupt-cells = <2>;
interrupt-controller;
interrupts-extended = I2C_IRQ(MPP_IRQ_REF);
reg = <0x26>;
#define GPIO_PWR1_UNUSED0 gpio_pwr1 0 GPIO_ACTIVE_HIGH
#define GPIO_PWR1_UNUSED1 gpio_pwr1 1 GPIO_ACTIVE_HIGH
#define GPIO_POE_PGOOD gpio_pwr1 2 GPIO_ACTIVE_HIGH
#define GPIO_RESET_BUTTON gpio_pwr1 3 GPIO_ACTIVE_LOW
#define GPIO_VIN1_PGOOD gpio_pwr1 4 GPIO_ACTIVE_LOW
#define GPIO_LED_VIN2_ALERT gpio_pwr1 5 GPIO_ACTIVE_LOW
#define GPIO_VIN2_PGOOD gpio_pwr1 6 GPIO_ACTIVE_LOW
#define GPIO_LED_VIN1_ALERT gpio_pwr1 7 GPIO_ACTIVE_LOW
};
//0x27 U3 PCF8574 GPIO LED
gpio_pwr2: gpio@27 {
compatible = "nxp,pcf8574a";
#gpio-cells = <2>;
gpio-controller;
#interrupt-cells = <2>;
interrupt-controller;
interrupts-extended = I2C_IRQ(MPP_IRQ_REF);
reg = <0x27>;
#define GPIO_LED2G gpio_pwr2 0 GPIO_ACTIVE_LOW
#define GPIO_LED2R gpio_pwr2 1 GPIO_ACTIVE_LOW
#define GPIO_LED1G gpio_pwr2 2 GPIO_ACTIVE_LOW
#define GPIO_LED1R gpio_pwr2 3 GPIO_ACTIVE_LOW
#define GPIO_LED4G gpio_pwr2 4 GPIO_ACTIVE_LOW
#define GPIO_LED4R gpio_pwr2 5 GPIO_ACTIVE_LOW
#define GPIO_LED3G gpio_pwr2 6 GPIO_ACTIVE_LOW
#define GPIO_LED3R gpio_pwr2 7 GPIO_ACTIVE_LOW
};
//0x28* U5 TPS23861PWR PoE Controller
//0x30 U5 TPS23861PWR PoE Controller broadcast
//0x50 U15 AT24C256C EEPROM
vpd_power: eeprom@50 {
// AT24C256C-MAHL-T
compatible = "atmel,24c256";
reg = <0x50>;
infix,board = "power";
};
};
/* Reset button */
/ {
gpio-keys {
compatible = "gpio-keys";
up {
label = "factory-reset";
linux,code = <KEY_RESTART>;
gpios = <&GPIO_RESET_BUTTON>;
};
};
};
/* System LEDs */
/ {
power-a {
compatible = "gpio-charger";
charger-type = "mains";
gpios = <&GPIO_VIN1_PGOOD>;
};
power-b {
compatible = "gpio-charger";
charger-type = "mains";
gpios = <&GPIO_VIN2_PGOOD>;
};
leds: leds {
compatible = "gpio-leds";
led-statg {
function = LED_FUNCTION_STATUS;
color = <LED_COLOR_ID_GREEN>;
gpios = <&GPIO_LED1G>;
};
led-statr {
function = LED_FUNCTION_STATUS;
color = <LED_COLOR_ID_RED>;
gpios = <&GPIO_LED1R>;
};
led-faultg {
function = LED_FUNCTION_FAULT;
color = <LED_COLOR_ID_GREEN>;
gpios = <&GPIO_LED2G>;
};
led-faultr {
function = LED_FUNCTION_FAULT;
color = <LED_COLOR_ID_RED>;
gpios = <&GPIO_LED2R>;
};
led-lang {
function = LED_FUNCTION_LAN;
color = <LED_COLOR_ID_GREEN>;
gpios = <&GPIO_LED3G>;
};
led-lanr {
function = LED_FUNCTION_LAN;
color = <LED_COLOR_ID_RED>;
gpios = <&GPIO_LED3R>;
};
led-bootg {
function = LED_FUNCTION_BOOT;
color = <LED_COLOR_ID_GREEN>;
gpios = <&GPIO_LED4G>;
};
led-bootr {
function = LED_FUNCTION_BOOT;
color = <LED_COLOR_ID_RED>;
gpios = <&GPIO_LED4R>;
default-state = "on";
linux,default-trigger = "timer";
};
led-vin1-alert {
function = "power-a";
color = <LED_COLOR_ID_RED>;
gpios = <&GPIO_LED_VIN1_ALERT>;
};
led-vin2-alert {
function = "power-b";
color = <LED_COLOR_ID_RED>;
gpios = <&GPIO_LED_VIN2_ALERT>;
};
};
};
/* Watchdog */
&cp0_pinctrl {
watchdog_pins: watchdog-pins {
marvell,pins = WDT_TICKLE(MPP_ID);
marvell,function = "gpio";
};
};
/ {
sysmgmt-watchdog {
pinctrl-names = "default";
pinctrl-0 = <&watchdog_pins>;
compatible = "linux,wdt-gpio";
gpios = WDT_TICKLE(MPP_GPIO_REF);
always-running;
hw_algo = "toggle";
hw_margin_ms = <20000>; /* toggle period must be below 1 minute */
};
};
@@ -0,0 +1,8 @@
#include "cn9130.dtsi"
&cp0_syscon0 {
cp0_pinctrl: pinctrl {
/* For some reason, this is missing from cn9130.dtsi */
compatible = "marvell,cp115-standalone-pinctrl";
};
};
@@ -5,7 +5,7 @@
*/
/dts-v1/;
#include "microchip/sparx5_pcb135_emmc.dts"
#include "sparx5_pcb135_emmc.dts"
&cpu0 {
enable-method = "spin-table";
+37 -40
View File
@@ -21,7 +21,6 @@ CONFIG_CFS_BANDWIDTH=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_HUGETLB=y
CONFIG_CPUSETS=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
@@ -32,7 +31,6 @@ CONFIG_SCHED_AUTOGROUP=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_KALLSYMS_ALL=y
CONFIG_PROFILING=y
CONFIG_SMP=y
CONFIG_ARCH_SPARX5=y
CONFIG_ARCH_MVEBU=y
CONFIG_ARCH_VEXPRESS=y
@@ -49,12 +47,6 @@ CONFIG_CPUFREQ_DT=y
CONFIG_ARM_ARMADA_37XX_CPUFREQ=y
CONFIG_ARM_ARMADA_8K_CPUFREQ=y
CONFIG_ACPI=y
CONFIG_ARM64_CRYPTO=y
CONFIG_CRYPTO_SHA1_ARM64_CE=y
CONFIG_CRYPTO_SHA2_ARM64_CE=y
CONFIG_CRYPTO_GHASH_ARM64_CE=y
CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
CONFIG_KPROBES=y
CONFIG_JUMP_LABEL=y
# CONFIG_GCC_PLUGINS is not set
@@ -67,10 +59,8 @@ CONFIG_TRANSPARENT_HUGEPAGE=y
CONFIG_CMA=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_XDP_SOCKETS=y
CONFIG_XDP_SOCKETS_DIAG=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
@@ -112,7 +102,6 @@ CONFIG_NFT_MASQ=m
CONFIG_NFT_REDIR=m
CONFIG_NFT_NAT=m
CONFIG_NFT_TUNNEL=m
CONFIG_NFT_OBJREF=m
CONFIG_NFT_QUEUE=m
CONFIG_NFT_REJECT=m
CONFIG_NFT_COMPAT=m
@@ -186,9 +175,7 @@ CONFIG_VLAN_8021Q=y
CONFIG_VLAN_8021Q_GVRP=y
CONFIG_VLAN_8021Q_MVRP=y
CONFIG_NET_SCHED=y
CONFIG_NET_SCH_CBQ=y
CONFIG_NET_CLS_BASIC=y
CONFIG_NET_CLS_TCINDEX=y
CONFIG_NET_CLS_BPF=y
CONFIG_NET_CLS_FLOWER=y
CONFIG_NETLINK_DIAG=y
@@ -236,7 +223,6 @@ CONFIG_ATA=y
CONFIG_SATA_AHCI=y
CONFIG_SATA_AHCI_PLATFORM=y
CONFIG_AHCI_MVEBU=y
CONFIG_PATA_PLATFORM=y
CONFIG_PATA_OF_PLATFORM=y
CONFIG_MD=y
CONFIG_BLK_DEV_DM=y
@@ -262,7 +248,7 @@ CONFIG_VETH=m
CONFIG_VIRTIO_NET=y
CONFIG_NLMON=y
CONFIG_NET_VRF=y
CONFIG_NET_DSA_MV88E6XXX=y
CONFIG_NET_DSA_MV88E6XXX=m
CONFIG_NET_DSA_MV88E6XXX_PTP=y
# CONFIG_NET_VENDOR_3COM is not set
# CONFIG_NET_VENDOR_ADAPTEC is not set
@@ -287,8 +273,8 @@ CONFIG_NET_DSA_MV88E6XXX_PTP=y
# CONFIG_NET_VENDOR_GOOGLE is not set
# CONFIG_NET_VENDOR_HISILICON is not set
# CONFIG_NET_VENDOR_HUAWEI is not set
CONFIG_MVNETA=y
CONFIG_MVPP2=y
CONFIG_MVNETA=m
CONFIG_MVPP2=m
# CONFIG_NET_VENDOR_MELLANOX is not set
# CONFIG_NET_VENDOR_MICREL is not set
CONFIG_SPARX5_SWITCH=y
@@ -325,18 +311,20 @@ CONFIG_8139CP=y
# CONFIG_NET_VENDOR_WIZNET is not set
# CONFIG_NET_VENDOR_XILINX is not set
CONFIG_SFP=y
CONFIG_AX88796B_PHY=y
CONFIG_MARVELL_PHY=y
CONFIG_MARVELL_10G_PHY=y
CONFIG_MARVELL_10G_PHY=m
CONFIG_MICREL_PHY=y
CONFIG_MICROCHIP_PHY=y
CONFIG_MICROCHIP_T1_PHY=y
CONFIG_MICROSEMI_PHY=y
CONFIG_MICROSEMI_PHY=m
CONFIG_MDIO_BITBANG=y
CONFIG_MDIO_MVUSB=y
CONFIG_MDIO_MVUSB=m
CONFIG_MDIO_MSCC_MIIM=y
CONFIG_MDIO_BUS_MUX_MMIOREG=y
CONFIG_USB_USBNET=y
CONFIG_USB_NET_CDC_EEM=y
CONFIG_USB_RTL8152=m
CONFIG_USB_USBNET=m
CONFIG_USB_NET_CDC_EEM=m
# CONFIG_USB_NET_CDC_NCM is not set
# CONFIG_USB_NET_NET1080 is not set
# CONFIG_USB_NET_CDC_SUBSET is not set
@@ -370,7 +358,7 @@ CONFIG_I2C_MV64XXX=y
CONFIG_I2C_SLAVE=y
CONFIG_SPI=y
CONFIG_SPI_ARMADA_3700=y
CONFIG_SPI_NXP_FLEXSPI=y
CONFIG_SPI_ORION=y
CONFIG_SPI_PL022=y
CONFIG_SPI_MUX=y
CONFIG_SPI_SPIDEV=m
@@ -382,6 +370,7 @@ CONFIG_GPIO_PL061=y
CONFIG_GPIO_XGENE=y
CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCA953X_IRQ=y
CONFIG_GPIO_PCF857X=y
CONFIG_GPIO_MAX77620=y
CONFIG_POWER_RESET_GPIO_RESTART=y
CONFIG_POWER_RESET_XGENE=y
@@ -398,6 +387,7 @@ CONFIG_ARMADA_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_SYSFS=y
CONFIG_SOFT_WATCHDOG=y
CONFIG_GPIO_WATCHDOG=y
CONFIG_ARMADA_37XX_WATCHDOG=y
CONFIG_I6300ESB_WDT=y
CONFIG_MFD_MAX77620=y
@@ -423,30 +413,31 @@ CONFIG_REGULATOR_S2MPS11=y
# CONFIG_HID_LOGITECH is not set
# CONFIG_HID_MICROSOFT is not set
# CONFIG_HID_MONTEREY is not set
CONFIG_USB=y
CONFIG_USB_ULPI_BUS=y
CONFIG_USB=m
CONFIG_USB_OTG=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_MVEBU=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PLATFORM=y
CONFIG_USB_STORAGE=y
CONFIG_USB_XHCI_HCD=m
CONFIG_USB_XHCI_MVEBU=m
CONFIG_USB_EHCI_HCD=m
CONFIG_USB_EHCI_HCD_PLATFORM=m
CONFIG_USB_OHCI_HCD=m
CONFIG_USB_OHCI_HCD_PLATFORM=m
CONFIG_USB_STORAGE=m
CONFIG_USB_DWC3=y
CONFIG_USB_DWC2=y
CONFIG_USB_CHIPIDEA=y
CONFIG_USB_CHIPIDEA=m
CONFIG_USB_CHIPIDEA_UDC=y
CONFIG_USB_CHIPIDEA_HOST=y
CONFIG_USB_ISP1760=y
CONFIG_USB_HSIC_USB3503=y
CONFIG_USB_HSIC_USB3503=m
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_ULPI=y
CONFIG_USB_GADGET=y
CONFIG_USB_SNP_UDC_PLAT=y
CONFIG_TYPEC=y
CONFIG_TYPEC_TCPM=y
CONFIG_TYPEC_TCPCI=y
CONFIG_TYPEC_RT1711H=y
CONFIG_TYPEC_TCPM=m
CONFIG_TYPEC_TCPCI=m
CONFIG_TYPEC_RT1711H=m
CONFIG_MMC=y
CONFIG_MMC_BLOCK_MINORS=32
CONFIG_MMC_ARMMMCI=y
@@ -466,8 +457,10 @@ CONFIG_LEDS_CLASS=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_SYSCON=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_CPU=y
CONFIG_LEDS_TRIGGER_NETDEV=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_MAX77686=y
CONFIG_RTC_DRV_PCF8523=y
@@ -496,20 +489,19 @@ CONFIG_EXTCON_USB_GPIO=y
CONFIG_IIO=y
CONFIG_TI_ADC081C=y
CONFIG_PWM=y
CONFIG_PHY_XGENE=y
CONFIG_PHY_MVEBU_CP110_COMPHY=y
CONFIG_PHY_MVEBU_CP110_UTMI=y
CONFIG_PHY_SAMSUNG_USB2=y
CONFIG_NVMEM_LAYOUT_ONIE_TLV=y
CONFIG_MUX_MMIO=y
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS=y
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
CONFIG_FANOTIFY=y
CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
CONFIG_QUOTA=y
CONFIG_AUTOFS4_FS=y
CONFIG_FUSE_FS=y
CONFIG_VIRTIO_FS=y
CONFIG_OVERLAY_FS=y
@@ -527,16 +519,21 @@ CONFIG_SECURITY=y
CONFIG_CRYPTO_CCM=m
CONFIG_CRYPTO_ECHAINIV=y
CONFIG_CRYPTO_ANSI_CPRNG=y
CONFIG_CRYPTO_GHASH_ARM64_CE=y
CONFIG_CRYPTO_SHA1_ARM64_CE=y
CONFIG_CRYPTO_SHA2_ARM64_CE=y
CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
CONFIG_DMA_CMA=y
CONFIG_CMA_SIZE_MBYTES=0
CONFIG_IRQ_POLL=y
CONFIG_PRINTK_TIME=y
CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_FS=y
CONFIG_DETECT_HUNG_TASK=y
# CONFIG_SCHED_DEBUG is not set
# CONFIG_DEBUG_PREEMPT is not set
# CONFIG_RCU_TRACE is not set
CONFIG_FUNCTION_TRACER=y
# CONFIG_STRICT_DEVMEM is not set
+4
View File
@@ -0,0 +1,4 @@
label Infix on NanoPi R2S
kernel /boot/Image
devicetree /boot/rk3328-nanopi-r2s.dtb
append root=/dev/mmcblk0p1 rw rootwait bonding.max_bonds=0 dummy.numdummies=0 fb_tunnels=none quiet
+38
View File
@@ -0,0 +1,38 @@
image cfg.ext4 {
ext4 {
label = "cfg"
}
empty = true
size = 16M
}
image sdcard.img {
hdimage {
}
partition u-boot-tpl-spl-dtb {
in-partition-table = "no"
image = "idbloader.img"
offset = 32K
}
partition u-boot-dtb {
in-partition-table = "no"
image = "u-boot.itb"
offset = 8M
}
partition rootfs {
partition-type = 0x83
offset = 16M
image = "rootfs.ext4"
}
partition cfg {
partition-type = 0x83
image = "cfg.ext4"
}
}
# Silence genimage warnings
config {}
+654
View File
@@ -0,0 +1,654 @@
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_AUDIT=y
CONFIG_NO_HZ_IDLE=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_BPF_JIT=y
CONFIG_PREEMPT=y
CONFIG_IRQ_TIME_ACCOUNTING=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_NUMA_BALANCING=y
CONFIG_MEMCG=y
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_HUGETLB=y
CONFIG_CPUSETS=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_PERF=y
CONFIG_NAMESPACES=y
CONFIG_USER_NS=y
CONFIG_SCHED_AUTOGROUP=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_EXPERT=y
CONFIG_KALLSYMS_ALL=y
CONFIG_PROFILING=y
CONFIG_KEXEC_FILE=y
CONFIG_CRASH_DUMP=y
CONFIG_ARCH_ACTIONS=y
CONFIG_ARCH_ROCKCHIP=y
CONFIG_ARCH_VEXPRESS=y
CONFIG_ARM64_VA_BITS_48=y
CONFIG_SCHED_MC=y
CONFIG_SCHED_SMT=y
CONFIG_NUMA=y
CONFIG_COMPAT=y
CONFIG_RANDOMIZE_BASE=y
CONFIG_HIBERNATION=y
CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y
CONFIG_ENERGY_MODEL=y
CONFIG_ARM_PSCI_CPUIDLE=y
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
CONFIG_CPUFREQ_DT=y
CONFIG_ACPI_CPPC_CPUFREQ=m
CONFIG_ARM_SCMI_CPUFREQ=y
CONFIG_ACPI=y
CONFIG_ACPI_APEI=y
CONFIG_ACPI_APEI_GHES=y
CONFIG_ACPI_APEI_MEMORY_FAILURE=y
CONFIG_ACPI_APEI_EINJ=y
CONFIG_VIRTUALIZATION=y
CONFIG_KVM=y
CONFIG_JUMP_LABEL=y
# CONFIG_GCC_PLUGINS is not set
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
# CONFIG_COMPAT_BRK is not set
CONFIG_KSM=y
CONFIG_MEMORY_FAILURE=y
CONFIG_TRANSPARENT_HUGEPAGE=y
CONFIG_CMA=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_NET_IPIP=y
CONFIG_NET_IPGRE_DEMUX=y
CONFIG_NET_IPGRE=m
CONFIG_NET_IPGRE_BROADCAST=y
CONFIG_IP_MROUTE=y
CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
CONFIG_IPV6=m
CONFIG_NETFILTER=y
CONFIG_NF_CONNTRACK=m
CONFIG_NF_CONNTRACK_EVENTS=y
CONFIG_NF_TABLES=y
CONFIG_NF_TABLES_INET=y
CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
CONFIG_NETFILTER_XT_TARGET_LOG=m
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
CONFIG_IP_NF_IPTABLES=m
CONFIG_IP_NF_FILTER=m
CONFIG_IP_NF_TARGET_REJECT=m
CONFIG_IP_NF_NAT=m
CONFIG_IP_NF_TARGET_MASQUERADE=m
CONFIG_IP_NF_MANGLE=m
CONFIG_IP6_NF_IPTABLES=m
CONFIG_IP6_NF_FILTER=m
CONFIG_IP6_NF_TARGET_REJECT=m
CONFIG_IP6_NF_MANGLE=m
CONFIG_IP6_NF_NAT=m
CONFIG_IP6_NF_TARGET_MASQUERADE=m
CONFIG_BRIDGE=m
CONFIG_BRIDGE_VLAN_FILTERING=y
CONFIG_NET_DSA=m
CONFIG_NET_DSA_TAG_OCELOT=m
CONFIG_NET_DSA_TAG_OCELOT_8021Q=m
CONFIG_VLAN_8021Q=m
CONFIG_VLAN_8021Q_GVRP=y
CONFIG_VLAN_8021Q_MVRP=y
CONFIG_NET_SCHED=y
CONFIG_NET_SCH_CBS=m
CONFIG_NET_SCH_ETF=m
CONFIG_NET_SCH_TAPRIO=m
CONFIG_NET_SCH_MQPRIO=m
CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_CLS_BASIC=m
CONFIG_NET_CLS_FLOWER=m
CONFIG_NET_CLS_ACT=y
CONFIG_NET_ACT_GACT=m
CONFIG_NET_ACT_MIRRED=m
CONFIG_NET_ACT_GATE=m
CONFIG_BT=m
CONFIG_BT_HIDP=m
# CONFIG_BT_LE is not set
CONFIG_BT_LEDS=y
# CONFIG_BT_DEBUGFS is not set
CONFIG_BT_HCIBTUSB=m
CONFIG_BT_HCIUART=m
CONFIG_BT_HCIUART_LL=y
CONFIG_BT_HCIUART_BCM=y
CONFIG_BT_HCIUART_QCA=y
CONFIG_CFG80211=y
CONFIG_MAC80211=y
CONFIG_MAC80211_LEDS=y
CONFIG_RFKILL=y
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_PCI=y
CONFIG_PCIEPORTBUS=y
CONFIG_PCI_IOV=y
CONFIG_PCI_PASID=y
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_ACPI=y
CONFIG_PCI_HOST_GENERIC=y
CONFIG_PCIE_ROCKCHIP_HOST=m
CONFIG_PCIE_ROCKCHIP_DW_HOST=y
CONFIG_PCI_ENDPOINT=y
CONFIG_PCI_ENDPOINT_CONFIGFS=y
CONFIG_PCI_EPF_TEST=m
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_FW_LOADER_USER_HELPER=y
CONFIG_ARM_SCMI_PROTOCOL=y
CONFIG_ARM_SCPI_PROTOCOL=y
CONFIG_EFI_CAPSULE_LOADER=y
CONFIG_MTD=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_CFI=y
CONFIG_MTD_CFI_ADV_OPTIONS=y
CONFIG_MTD_CFI_INTELEXT=y
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_CFI_STAA=y
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_OF=y
CONFIG_MTD_DATAFLASH=y
CONFIG_MTD_SST25L=y
CONFIG_MTD_RAW_NAND=y
CONFIG_MTD_NAND_DENALI_DT=y
CONFIG_MTD_SPI_NOR=y
CONFIG_OF_OVERLAY=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_NBD=m
CONFIG_VIRTIO_BLK=y
CONFIG_BLK_DEV_NVME=m
CONFIG_SRAM=y
CONFIG_PCI_ENDPOINT_TEST=m
CONFIG_EEPROM_AT24=m
CONFIG_EEPROM_AT25=m
CONFIG_UACCE=m
# CONFIG_SCSI_PROC_FS is not set
CONFIG_BLK_DEV_SD=y
CONFIG_SCSI_SAS_ATA=y
CONFIG_SCSI_HISI_SAS=y
CONFIG_SCSI_HISI_SAS_PCI=y
CONFIG_MEGARAID_SAS=y
CONFIG_SCSI_MPT3SAS=m
CONFIG_ATA=y
CONFIG_SATA_AHCI=y
CONFIG_SATA_AHCI_PLATFORM=y
CONFIG_AHCI_CEVA=y
CONFIG_SATA_SIL24=y
CONFIG_PATA_OF_PLATFORM=y
CONFIG_MD=y
CONFIG_BLK_DEV_MD=m
CONFIG_BLK_DEV_DM=m
CONFIG_DM_MIRROR=m
CONFIG_DM_ZERO=m
CONFIG_NETDEVICES=y
CONFIG_BONDING=m
CONFIG_DUMMY=y
CONFIG_WIREGUARD=m
CONFIG_MACVLAN=m
CONFIG_MACVTAP=m
CONFIG_VXLAN=y
CONFIG_GENEVE=m
CONFIG_BAREUDP=m
CONFIG_TUN=y
CONFIG_VETH=m
CONFIG_VIRTIO_NET=m
# CONFIG_NET_VENDOR_3COM is not set
# CONFIG_NET_VENDOR_ACTIONS is not set
# CONFIG_NET_VENDOR_ADAPTEC is not set
# CONFIG_NET_VENDOR_AGERE is not set
# CONFIG_NET_VENDOR_ALACRITECH is not set
# CONFIG_NET_VENDOR_ALTEON is not set
# CONFIG_NET_VENDOR_AMAZON is not set
# CONFIG_NET_VENDOR_AMD is not set
# CONFIG_NET_VENDOR_AQUANTIA is not set
# CONFIG_NET_VENDOR_ARC is not set
# CONFIG_NET_VENDOR_ASIX is not set
CONFIG_ATL2=m
CONFIG_ALX=m
# CONFIG_NET_VENDOR_BROADCOM is not set
# CONFIG_NET_VENDOR_CADENCE is not set
# CONFIG_NET_VENDOR_CAVIUM is not set
# CONFIG_NET_VENDOR_CHELSIO is not set
# CONFIG_NET_VENDOR_CISCO is not set
# CONFIG_NET_VENDOR_CORTINA is not set
# CONFIG_NET_VENDOR_DEC is not set
# CONFIG_NET_VENDOR_DLINK is not set
# CONFIG_NET_VENDOR_EMULEX is not set
# CONFIG_NET_VENDOR_EZCHIP is not set
# CONFIG_NET_VENDOR_GOOGLE is not set
# CONFIG_NET_VENDOR_HISILICON is not set
# CONFIG_NET_VENDOR_HUAWEI is not set
# CONFIG_NET_VENDOR_INTEL is not set
# CONFIG_NET_VENDOR_LITEX is not set
# CONFIG_NET_VENDOR_MARVELL is not set
# CONFIG_NET_VENDOR_MELLANOX is not set
# CONFIG_NET_VENDOR_MICREL is not set
# CONFIG_NET_VENDOR_MICROCHIP is not set
# CONFIG_NET_VENDOR_MICROSEMI is not set
# CONFIG_NET_VENDOR_MICROSOFT is not set
# CONFIG_NET_VENDOR_MYRI is not set
# CONFIG_NET_VENDOR_NI is not set
# CONFIG_NET_VENDOR_NATSEMI is not set
# CONFIG_NET_VENDOR_NETERION is not set
# CONFIG_NET_VENDOR_NETRONOME is not set
# CONFIG_NET_VENDOR_NVIDIA is not set
# CONFIG_NET_VENDOR_OKI is not set
# CONFIG_NET_VENDOR_PACKET_ENGINES is not set
# CONFIG_NET_VENDOR_PENSANDO is not set
# CONFIG_NET_VENDOR_QLOGIC is not set
# CONFIG_NET_VENDOR_BROCADE is not set
# CONFIG_NET_VENDOR_QUALCOMM is not set
# CONFIG_NET_VENDOR_RDC is not set
CONFIG_8139CP=m
CONFIG_8139TOO=m
# CONFIG_8139TOO_PIO is not set
CONFIG_R8169=m
# CONFIG_NET_VENDOR_RENESAS is not set
# CONFIG_NET_VENDOR_ROCKER is not set
# CONFIG_NET_VENDOR_SAMSUNG is not set
# CONFIG_NET_VENDOR_SEEQ is not set
# CONFIG_NET_VENDOR_SILAN is not set
# CONFIG_NET_VENDOR_SIS is not set
# CONFIG_NET_VENDOR_SOLARFLARE is not set
# CONFIG_NET_VENDOR_SMSC is not set
# CONFIG_NET_VENDOR_SOCIONEXT is not set
CONFIG_STMMAC_ETH=y
# CONFIG_DWMAC_GENERIC is not set
# CONFIG_NET_VENDOR_SUN is not set
# CONFIG_NET_VENDOR_SYNOPSYS is not set
# CONFIG_NET_VENDOR_TEHUTI is not set
# CONFIG_NET_VENDOR_TI is not set
# CONFIG_NET_VENDOR_VIA is not set
# CONFIG_NET_VENDOR_WIZNET is not set
# CONFIG_NET_VENDOR_XILINX is not set
CONFIG_AX88796B_PHY=y
CONFIG_MICREL_PHY=y
CONFIG_MICROSEMI_PHY=y
CONFIG_AT803X_PHY=m
CONFIG_REALTEK_PHY=y
CONFIG_ROCKCHIP_PHY=y
CONFIG_MDIO_BITBANG=y
CONFIG_MDIO_BCM_UNIMAC=m
CONFIG_MDIO_THUNDER=y
CONFIG_MDIO_BUS_MUX_MULTIPLEXER=y
CONFIG_MDIO_BUS_MUX_MMIOREG=y
CONFIG_USB_RTL8150=m
CONFIG_USB_RTL8152=m
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=m
CONFIG_USB_NET_AX88179_178A=m
CONFIG_USB_NET_DM9601=m
CONFIG_USB_NET_SMSC75XX=m
CONFIG_USB_NET_SMSC95XX=m
CONFIG_USB_NET_NET1080=m
CONFIG_USB_NET_PLUSB=m
CONFIG_USB_NET_MCS7830=m
CONFIG_USB_NET_CDC_SUBSET=m
CONFIG_USB_NET_ZAURUS=m
CONFIG_ATH10K=m
CONFIG_ATH10K_PCI=m
CONFIG_WCN36XX=m
# CONFIG_WLAN_VENDOR_ATMEL is not set
# CONFIG_WLAN_VENDOR_BROADCOM is not set
# CONFIG_WLAN_VENDOR_CISCO is not set
# CONFIG_WLAN_VENDOR_INTEL is not set
# CONFIG_WLAN_VENDOR_INTERSIL is not set
# CONFIG_WLAN_VENDOR_MARVELL is not set
# CONFIG_WLAN_VENDOR_MEDIATEK is not set
CONFIG_RTL8180=m
CONFIG_RTL8187=m
CONFIG_RTL_CARDS=m
CONFIG_RTL8192CE=m
CONFIG_RTL8192SE=m
CONFIG_RTL8192DE=m
CONFIG_RTL8723AE=m
CONFIG_RTL8723BE=m
CONFIG_RTL8188EE=m
CONFIG_RTL8192EE=m
CONFIG_RTL8821AE=m
CONFIG_RTL8192CU=m
CONFIG_RTL8XXXU=m
CONFIG_RTL8XXXU_UNTESTED=y
CONFIG_RTW88=m
CONFIG_RTW88_8822BE=m
CONFIG_RTW88_8822BS=m
CONFIG_RTW88_8822BU=m
CONFIG_RTW88_8822CE=m
CONFIG_RTW88_8822CS=m
CONFIG_RTW88_8822CU=m
CONFIG_RTW88_8723DE=m
CONFIG_RTW88_8723DS=m
CONFIG_RTW88_8723DU=m
CONFIG_RTW88_8821CE=m
CONFIG_RTW88_8821CS=m
CONFIG_RTW88_8821CU=m
CONFIG_RTW88_DEBUG=y
CONFIG_RTW89=m
CONFIG_RTW89_8851BE=m
CONFIG_RTW89_8852AE=m
CONFIG_RTW89_8852BE=m
CONFIG_RTW89_8852CE=m
CONFIG_RTW89_DEBUGMSG=y
# CONFIG_WLAN_VENDOR_RSI is not set
# CONFIG_WLAN_VENDOR_TI is not set
# CONFIG_WLAN_VENDOR_ZYDAS is not set
# CONFIG_WLAN_VENDOR_QUANTENNA is not set
CONFIG_NET_FAILOVER=y
CONFIG_INPUT_FF_MEMLESS=y
# CONFIG_INPUT_KEYBOARD is not set
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_MISC=y
CONFIG_INPUT_RK805_PWRKEY=y
# CONFIG_SERIO_SERPORT is not set
CONFIG_SERIO_AMBAKMI=y
CONFIG_VT_HW_CONSOLE_BINDING=y
CONFIG_LEGACY_PTY_COUNT=16
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_SHARE_IRQ=y
CONFIG_SERIAL_8250_DW=y
CONFIG_SERIAL_8250_RT288X=y
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_SERIAL_AMBA_PL010=y
CONFIG_SERIAL_AMBA_PL010_CONSOLE=y
CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SERIAL_DEV_BUS=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_HW_RANDOM_VIRTIO=m
CONFIG_TCG_TPM=y
CONFIG_TCG_TIS_I2C_INFINEON=y
CONFIG_I2C=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX=y
CONFIG_I2C_MUX_PCA954x=y
CONFIG_I2C_DESIGNWARE_PLATFORM=y
CONFIG_I2C_GPIO=m
CONFIG_I2C_RK3X=y
CONFIG_I2C_SLAVE=y
CONFIG_SPI=y
CONFIG_SPI_BITBANG=m
CONFIG_SPI_CADENCE_QUADSPI=y
CONFIG_SPI_DESIGNWARE=m
CONFIG_SPI_DW_DMA=y
CONFIG_SPI_DW_MMIO=m
CONFIG_SPI_PL022=y
CONFIG_SPI_ROCKCHIP=y
CONFIG_SPI_SPIDEV=m
CONFIG_SPMI=y
CONFIG_PPS=y
# CONFIG_PTP_1588_CLOCK is not set
CONFIG_DEBUG_PINCTRL=y
CONFIG_PINCTRL_RK805=y
CONFIG_PINCTRL_SINGLE=y
CONFIG_GPIO_ALTERA=m
CONFIG_GPIO_DWAPB=y
CONFIG_GPIO_MB86S7X=y
CONFIG_GPIO_PL061=y
CONFIG_GPIO_XGENE=y
CONFIG_GPIO_MAX732X=y
CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCA953X_IRQ=y
CONFIG_POWER_RESET_XGENE=y
CONFIG_POWER_RESET_SYSCON=y
CONFIG_SYSCON_REBOOT_MODE=y
CONFIG_BATTERY_SBS=m
CONFIG_BATTERY_BQ27XXX=y
CONFIG_BATTERY_MAX17042=m
CONFIG_CHARGER_BQ25890=m
CONFIG_CHARGER_BQ25980=m
CONFIG_SENSORS_ARM_SCMI=y
CONFIG_SENSORS_ARM_SCPI=y
CONFIG_SENSORS_LM90=m
CONFIG_SENSORS_PWM_FAN=m
CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y
CONFIG_CPU_THERMAL=y
CONFIG_THERMAL_EMULATION=y
CONFIG_ROCKCHIP_THERMAL=m
CONFIG_WATCHDOG=y
CONFIG_ARM_SP805_WATCHDOG=y
CONFIG_ARM_SBSA_WATCHDOG=y
CONFIG_DW_WATCHDOG=y
CONFIG_ARM_SMC_WATCHDOG=y
CONFIG_MFD_RK8XX_I2C=y
CONFIG_MFD_RK8XX_SPI=y
CONFIG_MFD_STMFX=y
CONFIG_REGULATOR_DEBUG=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_REGULATOR_GPIO=y
CONFIG_REGULATOR_PWM=y
CONFIG_REGULATOR_RK808=y
CONFIG_REGULATOR_VCTRL=y
CONFIG_REGULATOR_VEXPRESS=m
# CONFIG_HID_GENERIC is not set
# CONFIG_USB_HID is not set
CONFIG_USB_CONN_GPIO=y
CONFIG_USB=y
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
CONFIG_USB_DYNAMIC_MINORS=y
CONFIG_USB_OTG=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PLATFORM=y
CONFIG_USB_ACM=m
CONFIG_USB_STORAGE=y
CONFIG_USB_MUSB_HDRC=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC2=y
CONFIG_USB_CHIPIDEA=y
CONFIG_USB_CHIPIDEA_UDC=y
CONFIG_USB_CHIPIDEA_HOST=y
CONFIG_USB_ISP1760=y
CONFIG_USB_SERIAL=m
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_SIMPLE=m
CONFIG_USB_SERIAL_CP210X=m
CONFIG_USB_SERIAL_FTDI_SIO=m
CONFIG_USB_SERIAL_PL2303=m
CONFIG_USB_SERIAL_OPTION=m
CONFIG_USB_HSIC_USB3503=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_ULPI=y
CONFIG_USB_GADGET=y
CONFIG_USB_SNP_UDC_PLAT=y
CONFIG_USB_BDC_UDC=y
CONFIG_USB_CONFIGFS=m
CONFIG_USB_CONFIGFS_SERIAL=y
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_CONFIGFS_OBEX=y
CONFIG_USB_CONFIGFS_NCM=y
CONFIG_USB_CONFIGFS_ECM=y
CONFIG_USB_CONFIGFS_ECM_SUBSET=y
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_EEM=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_TYPEC=m
CONFIG_TYPEC_TCPM=m
CONFIG_TYPEC_TCPCI=m
CONFIG_TYPEC_FUSB302=m
CONFIG_TYPEC_TPS6598X=m
CONFIG_TYPEC_HD3SS3220=m
CONFIG_MMC=y
CONFIG_MMC_BLOCK_MINORS=32
CONFIG_MMC_ARMMMCI=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_ACPI=y
CONFIG_MMC_SDHCI_PLTFM=y
CONFIG_MMC_SDHCI_OF_ARASAN=y
CONFIG_MMC_SDHCI_CADENCE=y
CONFIG_MMC_SDHCI_F_SDH30=y
CONFIG_MMC_SPI=y
CONFIG_MMC_DW=y
CONFIG_MMC_DW_EXYNOS=y
CONFIG_MMC_DW_HI3798CV200=y
CONFIG_MMC_DW_K3=y
CONFIG_MMC_DW_ROCKCHIP=y
CONFIG_MMC_MTK=y
CONFIG_MMC_SDHCI_XENON=y
CONFIG_MMC_SDHCI_AM654=y
CONFIG_SCSI_UFSHCD=y
CONFIG_SCSI_UFSHCD_PLATFORM=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_CLASS_FLASH=y
CONFIG_LEDS_CLASS_MULTICOLOR=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_PWM=y
CONFIG_LEDS_SYSCON=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_DISK=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_CPU=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_LEDS_TRIGGER_PANIC=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_RK808=y
CONFIG_RTC_DRV_EFI=y
CONFIG_RTC_DRV_PL030=y
CONFIG_RTC_DRV_PL031=y
CONFIG_DMADEVICES=y
CONFIG_PL330_DMA=y
CONFIG_SYNC_FILE=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_INPUT=y
CONFIG_VIRTIO_MMIO=y
# CONFIG_VHOST_MENU is not set
CONFIG_STAGING=y
CONFIG_PRISM2_USB=m
CONFIG_RTLLIB=m
CONFIG_RTL8192E=m
CONFIG_RTL8723BS=m
CONFIG_R8712U=m
CONFIG_RTS5208=m
# CONFIG_SURFACE_PLATFORMS is not set
CONFIG_COMMON_CLK_SCMI=y
CONFIG_COMMON_CLK_SCPI=y
CONFIG_COMMON_CLK_PWM=y
CONFIG_HWSPINLOCK=y
# CONFIG_FSL_ERRATUM_A008585 is not set
# CONFIG_HISILICON_ERRATUM_161010101 is not set
# CONFIG_ARM64_ERRATUM_858921 is not set
CONFIG_ARM_MHU=y
CONFIG_PLATFORM_MHU=y
CONFIG_IOMMU_IO_PGTABLE_ARMV7S=y
CONFIG_ROCKCHIP_IOMMU=y
CONFIG_ARM_SMMU=y
CONFIG_ARM_SMMU_V3=y
CONFIG_ROCKCHIP_IODOMAIN=y
CONFIG_ROCKCHIP_DTPM=m
CONFIG_ROCKCHIP_PM_DOMAINS=y
CONFIG_DEVFREQ_GOV_USERSPACE=m
CONFIG_EXTCON_PTN5150=m
CONFIG_EXTCON_USB_GPIO=y
CONFIG_MEMORY=y
CONFIG_IIO=y
CONFIG_MAX9611=m
CONFIG_ROCKCHIP_SARADC=m
CONFIG_IIO_ST_LSM6DSX=m
CONFIG_SENSORS_ISL29018=m
CONFIG_VCNL4000=m
CONFIG_IIO_ST_MAGN_3AXIS=m
CONFIG_MPL3115=m
CONFIG_PWM=y
CONFIG_PWM_ROCKCHIP=y
CONFIG_PHY_ROCKCHIP_DPHY_RX0=m
CONFIG_PHY_ROCKCHIP_EMMC=y
CONFIG_PHY_ROCKCHIP_INNO_HDMI=m
CONFIG_PHY_ROCKCHIP_INNO_USB2=y
CONFIG_PHY_ROCKCHIP_INNO_CSIDPHY=m
CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY=m
CONFIG_PHY_ROCKCHIP_PCIE=m
CONFIG_PHY_ROCKCHIP_TYPEC=y
CONFIG_PHY_ROCKCHIP_USB=m
CONFIG_POWERCAP=y
CONFIG_ARM_SCMI_POWERCAP=y
CONFIG_DTPM=y
CONFIG_DTPM_CPU=y
CONFIG_DTPM_DEVFREQ=y
CONFIG_ARM_SMMU_V3_PMU=m
CONFIG_NVMEM_RMEM=m
CONFIG_NVMEM_ROCKCHIP_EFUSE=m
CONFIG_NVMEM_ROCKCHIP_OTP=m
CONFIG_TEE=y
CONFIG_OPTEE=y
CONFIG_MUX_MMIO=y
CONFIG_INTERCONNECT=y
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_FANOTIFY=y
CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
CONFIG_QUOTA=y
CONFIG_OVERLAY_FS=m
CONFIG_VFAT_FS=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_HUGETLBFS=y
CONFIG_EFIVAR_FS=y
CONFIG_SQUASHFS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V4=y
CONFIG_NFS_V4_1=y
CONFIG_NFS_V4_2=y
CONFIG_ROOT_NFS=y
CONFIG_9P_FS=y
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_SECURITY=y
CONFIG_CRYPTO_DH=m
CONFIG_CRYPTO_CURVE25519=m
CONFIG_CRYPTO_ECHAINIV=y
CONFIG_CRYPTO_BLAKE2B=m
CONFIG_CRYPTO_XXHASH=m
CONFIG_CRYPTO_ANSI_CPRNG=y
CONFIG_CRYPTO_USER_API_RNG=m
CONFIG_CRYPTO_GHASH_ARM64_CE=y
CONFIG_CRYPTO_SHA1_ARM64_CE=y
CONFIG_CRYPTO_SHA2_ARM64_CE=y
CONFIG_CRYPTO_SHA512_ARM64_CE=m
CONFIG_CRYPTO_SHA3_ARM64=m
CONFIG_CRYPTO_SM3_ARM64_CE=m
CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
CONFIG_CRYPTO_AES_ARM64_BS=m
CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
CONFIG_CRYPTO_CRCT10DIF_ARM64_CE=m
CONFIG_CRYPTO_DEV_ROCKCHIP=y
CONFIG_CRYPTO_DEV_CCREE=m
CONFIG_INDIRECT_PIO=y
CONFIG_CRC_CCITT=m
CONFIG_CRC8=y
CONFIG_DMA_CMA=y
CONFIG_CMA_SIZE_MBYTES=32
CONFIG_PRINTK_TIME=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_FS=y
# CONFIG_SCHED_DEBUG is not set
# CONFIG_FTRACE is not set
CONFIG_MEMTEST=y
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
BOARD_DIR="$(dirname $0)"
install -m 0644 -D $BOARD_DIR/extlinux.conf $TARGET_DIR/boot/extlinux/extlinux.conf
@@ -0,0 +1,14 @@
--- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts 2023-11-08 14:09:07.000000000 +0100
+++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts 2024-01-22 07:31:14.949550828 +0100
@@ -20,6 +20,11 @@
chosen {
stdout-path = "serial2:1500000n8";
+
+ infix {
+ /* Default admin user password: 'admin' */
+ factory-password-hash = "$5$mI/zpOAqZYKLC2WU$i7iPzZiIjOjrBF3NyftS9CCq8dfYwHwrmUK097Jca9A";
+ };
};
gmac_clk: gmac-clock {
@@ -1,3 +1,4 @@
label Infix (aarch64)
kernel /boot/Image
append ${bootargs_root} ${bootargs_rauc} ${bootargs_log}
fdtdir /boot
append ${bootargs_root} ${bootargs_log} -- ${bootargs_user}
+3 -2
View File
@@ -1,9 +1,10 @@
[system]
compatible=infix-aarch64
bootloader=uboot
statusfile=/var/lib/rauc/status
statusfile=/mnt/aux/rauc.status
mountprefix=/var/lib/rauc/mnt
bundle-formats=-plain
max-bundle-download-size=1073741824
[keyring]
directory=/etc/rauc/keys
@@ -17,5 +18,5 @@ device=/dev/disk/by-partlabel/secondary
bootname=secondary
[slot.net.0]
device=/dev/ram
device=/dev/ram0
bootname=net
+1
View File
@@ -0,0 +1 @@
x33x0fw_0_3_11_0_11832.hdr
+5
View File
@@ -6,3 +6,8 @@ if [ -L "$TARGET_DIR/etc/dropbear" ]; then
rm "$TARGET_DIR/etc/dropbear"
mkdir "$TARGET_DIR/etc/dropbear"
fi
# Classic builds don't have D-Bus
if [ -f "$TARGET_DIR/etc/dnsmasq.conf" ]; then
sed -i '/enable-dbus/d' "$TARGET_DIR/etc/dnsmasq.conf"
fi
+5 -11
View File
@@ -415,17 +415,11 @@ a printer can publish IPP records with meta data on the printer type and model
or donwload URL for drivers. Switches and routers usually publish how they
can be reached: HTTP/HTTPS and SSH.
Note: there are other mechanisms for device discovery. Microsoft have been
slow to adopt mDNS, having relied on their own SSDP protocol. For the
full experince Apple's "Bonjour" can be installed in Windows.
mDNS is supported in this product and should be enabled by default. To
verify it works, open the Windows File Explorer (Win+E) and scroll to
Network in the left-hand menu. An icon with a matching hostname can be
found there which, when clicked, opens up the device's Web Interface.
macOS users have mDNS fully integrated by default. Linux users can use
'mdns-scan' or Avahi, as shown above. The latter two can also just set
their web browsers to https://hostname-01-02-03.local
mDNS is supported in this product and should be enabled by default. To
verify that it works, in Windows, macOS, or Linux, open your web browser
and point it to <https://hostname-01-02-03.local>. This is the hostname
and three last octets of the device's base MAC address. You can also use
mDNS browsers or command line tools like mdns-scan
$(h2 "VLAN Interfaces")
+18
View File
@@ -0,0 +1,18 @@
# System-wide .bashrc file for interactive bash(1) shells.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# Reevaluate for each line, in case hostname changes
function prompt_command
{
PS1="\u@$(hostname):\w\$ "
}
export PROMPT_COMMAND=prompt_command
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# Disble built-ins
enable -n help
@@ -1 +1 @@
run [S] /lib/infix/swup --
run [S] /libexec/infix/swup --
+5 -5
View File
@@ -47,18 +47,18 @@ ram([0-9]*) root:disk 660 >rd/%1
loop([0-9]+) root:disk 660 >loop/%1
sr[0-9]* root:cdrom 660 @ln -sf $MDEV cdrom
fd[0-9]* root:floppy 660
#SUBSYSTEM=block;.* root:disk 660 */lib/infix/storage-device
#SUBSYSTEM=block;.* root:disk 660 */libexec/infix/storage-device
# Run settle-nics every time new NIC appear.
# If you don't want to auto-populate /etc/mactab with NICs,
# run 'settle-nis' without '--write-mactab' param.
#-SUBSYSTEM=net;DEVPATH=.*/net/.*;.* root:root 600 @/lib/infix/settle-nics --write-mactab
#-SUBSYSTEM=net;DEVPATH=.*/net/.*;.* root:root 600 @/libexec/infix/settle-nics --write-mactab
net/tun[0-9]* root:netdev 660
net/tap[0-9]* root:root 600
# alsa sound devices and audio stuff
#SUBSYSTEM=sound;.* root:audio 660 @/lib/infix/sound-control
#SUBSYSTEM=sound;.* root:audio 660 @/libexec/infix/sound-control
adsp root:audio 660 >sound/
audio root:audio 660 >sound/
@@ -106,7 +106,7 @@ cpu([0-9]+) root:root 600 =cpu/%1/cpuid
msr([0-9]+) root:root 600 =cpu/%1/msr
# Populate /dev/bus/usb.
#SUBSYSTEM=usb;DEVTYPE=usb_device;.* root:root 660 */lib/infix/dev-bus-usb
#SUBSYSTEM=usb;DEVTYPE=usb_device;.* root:root 660 */libexec/infix/dev-bus-usb
# Catch-all other devices, Right now useful only for debuging.
#.* root:root 660 */lib/infix/catch-all
#.* root:root 660 */libexec/infix/catch-all
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
# Probe for various types of harware features
if dmesg |grep -q QEMU || test -d /sys/module/qemu_fw_cfg; then
initctl -nbq cond set qemu
fi
+56 -3
View File
@@ -23,7 +23,7 @@ config SIGN_KEY
menuconfig DISK_IMAGE
bool "Disk image"
help
Compose a full disk image with redundant firmware partitions,
Compose a full disk image with redundant Linux OS partitions,
configuration partition, etc.
This is useful when:
@@ -31,7 +31,7 @@ menuconfig DISK_IMAGE
- Creating a GNS3 appliance
- Developing/debugging issues in the boot process in QEMU
config DISK_IMAGE_SIZE
menuconfig DISK_IMAGE_SIZE
string "Image size"
depends on DISK_IMAGE
default "512M"
@@ -44,10 +44,63 @@ config DISK_IMAGE_SIZE
Minimum supported size is 512M.
choice
prompt "Bootloader"
depends on DISK_IMAGE
default DISK_IMAGE_BOOT_EFI if BR2_x86_64
default DISK_IMAGE_BOOT_NONE
config DISK_IMAGE_BOOT_NONE
bool "None"
help
Do not create any bootloader partition in the disk image.
config DISK_IMAGE_BOOT_EFI
bool "EFI"
help
Create a boot partition from a directory containing an EFI
boot application, e.g. GRUB.
config DISK_IMAGE_BOOT_BIN
bool "Binary"
help
Create a boot partition from a raw image containing the boot
application, e.g. U-Boot.
endchoice
config DISK_IMAGE_BOOT_DATA
string "Bootloader data"
depends on DISK_IMAGE
depends on DISK_IMAGE_BOOT_EFI || DISK_IMAGE_BOOT_BIN
default "${BINARIES_DIR}/efi-part/EFI" if BR2_x86_64
help
Path to the directory or file holding the bootloader data.
config DISK_IMAGE_BOOT_OFFSET
hex "Bootloader offset"
depends on DISK_IMAGE
depends on DISK_IMAGE_BOOT_EFI || DISK_IMAGE_BOOT_BIN
default 0x8000
help
Offset at which the bootloader partition is placed. Remember
to make sure that the GPT still fits at the start of the
image.
config DISK_IMAGE_RELEASE_URL
string "Infix URL"
depends on DISK_IMAGE
depends on !BR2_TARGET_ROOTFS_SQUASHFS
default "https://github.com/kernelkit/infix/releases/download/latest/infix-${BR2_ARCH}.tar.gz"
help
In situations where Infix itself is not being built, but a
disk image is, i.e. when building a bootloader: place this
Infix release in the primary and secondary partitions.
menuconfig GNS3_APPLIANCE
bool "GNS3 Appliance"
select DISK_IMAGE
default y if BR2_x86_64
default y
help
Create a GNS3 appliance description that, together with the
disk image, can be imported into GNS3.
+19 -8
View File
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Busybox version: 1.35.0
# Mon Dec 12 13:47:01 2022
# Busybox version: 1.36.0
# Thu Feb 8 08:22:32 2024
#
CONFIG_HAVE_DOT_CONFIG=y
@@ -93,6 +93,9 @@ CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
CONFIG_PASSWORD_MINLEN=6
CONFIG_MD5_SMALL=1
CONFIG_SHA1_SMALL=3
CONFIG_SHA1_HWACCEL=y
CONFIG_SHA256_HWACCEL=y
CONFIG_SHA3_SMALL=1
CONFIG_FEATURE_NON_POSIX_CP=y
# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
@@ -123,6 +126,9 @@ CONFIG_LAST_SUPPORTED_WCHAR=0
# CONFIG_UNICODE_BIDI_SUPPORT is not set
# CONFIG_UNICODE_NEUTRAL_TABLE is not set
# CONFIG_UNICODE_PRESERVE_BROKEN is not set
# CONFIG_LOOP_CONFIGURE is not set
# CONFIG_NO_LOOP_CONFIGURE is not set
CONFIG_TRY_LOOP_CONFIGURE=y
#
# Applets
@@ -338,6 +344,7 @@ CONFIG_FEATURE_TR_CLASSES=y
CONFIG_FEATURE_TR_EQUIV=y
CONFIG_TRUE=y
CONFIG_TRUNCATE=y
CONFIG_TSORT=y
CONFIG_TTY=y
CONFIG_UNAME=y
CONFIG_UNAME_OSNAME="GNU/Linux"
@@ -526,13 +533,13 @@ CONFIG_USE_BB_CRYPT_SHA=y
CONFIG_ADDGROUP=y
CONFIG_FEATURE_ADDUSER_TO_GROUP=y
CONFIG_ADDUSER=y
# CONFIG_FEATURE_CHECK_NAMES is not set
CONFIG_FEATURE_CHECK_NAMES=y
CONFIG_LAST_ID=60000
CONFIG_FIRST_SYSTEM_ID=100
CONFIG_LAST_SYSTEM_ID=999
# CONFIG_CHPASSWD is not set
CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="md5"
# CONFIG_CRYPTPW is not set
CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="sha512"
CONFIG_CRYPTPW=y
CONFIG_MKPASSWD=y
CONFIG_DELUSER=y
CONFIG_DELGROUP=y
@@ -549,7 +556,7 @@ CONFIG_SU=y
CONFIG_FEATURE_SU_SYSLOG=y
CONFIG_FEATURE_SU_CHECKS_SHELLS=y
# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set
CONFIG_SULOGIN=y
# CONFIG_SULOGIN is not set
CONFIG_VLOCK=y
#
@@ -831,10 +838,12 @@ CONFIG_READAHEAD=y
CONFIG_RFKILL=y
CONFIG_RUNLEVEL=y
CONFIG_RX=y
CONFIG_SEEDRNG=y
CONFIG_SETFATTR=y
CONFIG_SETSERIAL=y
CONFIG_STRINGS=y
CONFIG_TIME=y
CONFIG_TREE=y
CONFIG_TS=y
CONFIG_TTYSIZE=y
CONFIG_UBIATTACH=y
@@ -1007,6 +1016,7 @@ CONFIG_UDHCPC=y
CONFIG_FEATURE_UDHCPC_ARPING=y
CONFIG_FEATURE_UDHCPC_SANITIZEOPT=y
CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
CONFIG_UDHCPC6_DEFAULT_SCRIPT="/usr/share/udhcpc/default6.script"
CONFIG_UDHCPC6=y
CONFIG_FEATURE_UDHCPC6_RFC3646=y
CONFIG_FEATURE_UDHCPC6_RFC4704=y
@@ -1122,9 +1132,9 @@ CONFIG_SV_DEFAULT_SERVICE_DIR=""
CONFIG_SH_IS_ASH=y
# CONFIG_SH_IS_HUSH is not set
# CONFIG_SH_IS_NONE is not set
CONFIG_BASH_IS_ASH=y
# CONFIG_BASH_IS_ASH is not set
# CONFIG_BASH_IS_HUSH is not set
# CONFIG_BASH_IS_NONE is not set
CONFIG_BASH_IS_NONE=y
CONFIG_SHELL_ASH=y
CONFIG_ASH=y
CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
@@ -1141,6 +1151,7 @@ CONFIG_ASH_IDLE_TIMEOUT=y
CONFIG_ASH_ECHO=y
CONFIG_ASH_PRINTF=y
CONFIG_ASH_TEST=y
CONFIG_ASH_SLEEP=y
CONFIG_ASH_HELP=y
CONFIG_ASH_GETOPTS=y
CONFIG_ASH_CMDCMD=y
+2
View File
@@ -1,3 +1,4 @@
ifeq ($(SIGN_ENABLED),y)
include $(BR2_EXTERNAL_INFIX_PATH)/board/common/uboot/uboot.mk
define RAUC_POST_BUILD_INSTALL_CERT
@@ -7,3 +8,4 @@ define RAUC_POST_BUILD_INSTALL_CERT
cp $(crt) $(TARGET_DIR)/etc/rauc/keys/$(shell openssl x509 -hash -noout <$(crt)).0;)
endef
RAUC_POST_BUILD_HOOKS += RAUC_POST_BUILD_INSTALL_CERT
endif
-65
View File
@@ -1,65 +0,0 @@
image aux.ext4 {
mountpoint = "/aux"
temporary = true
size = 2M
ext4 {
label = "aux"
}
}
image cfg.ext4 {
empty = true
temporary = true
size = 16M
ext4 {
label = "cfg"
}
}
image var.ext4 {
empty = true
temporary = true
# 44M - 24k (GPT backup)
size = 45032k
ext4 {
label = "var"
}
}
image mmc.img {
size = 512M
hdimage {
partition-table-type = "gpt"
}
partition aux {
offset = 2M
image = "aux.ext4"
}
partition primary {
image = "rootfs.squashfs"
size = 224M
}
partition secondary {
bootable = true
image = "rootfs.squashfs"
size = 224M
}
partition cfg {
image = "cfg.ext4"
}
partition var {
image = "var.ext4"
}
}
# Silence genimage warnings
config {}
+4 -1
View File
@@ -7,6 +7,7 @@ image aux.ext4 {
ext4 {
label = "aux"
use-mke2fs = true
}
}
@@ -17,6 +18,7 @@ image cfg.ext4 {
ext4 {
label = "cfg"
use-mke2fs = true
}
}
@@ -27,10 +29,11 @@ image var.ext4 {
ext4 {
label = "var"
use-mke2fs = true
}
}
image disk.img {
image @DISKIMG@ {
size = @TOTALSIZE@
hdimage {
partition-table-type = "gpt"
+13 -4
View File
@@ -9,11 +9,20 @@ die()
exit 1
}
# Find all matching key=value assignments in output/.config
# E.g., load_cfg DISK_IMAGE sets the following variables:
#
# DISK_IMAGE=y
# DISK_IMAGE_SIZE="512"
# etc.
#
# shellcheck disable=SC1090
load_cfg()
{
local tmp=$(mktemp -p /tmp)
tmp=$(mktemp -p /tmp)
grep "$1" $BR2_CONFIG >$tmp
. $tmp
rm $tmp
grep -E "${1}.*=" "$BR2_CONFIG" >"$tmp"
. "$tmp"
rm "$tmp"
}
+32 -8
View File
@@ -30,14 +30,14 @@ dimension()
cfgsize=$((256 << M))
# var is at least ~1.75G
elif [ $total -ge $((1 << G)) ]; then
bootsize=$(( 4 << M))
auxsize=$(( 4 << M))
bootsize=$(( 8 << M))
auxsize=$(( 8 << M))
imgsize=$((256 << M))
cfgsize=$(( 64 << M))
# var is at least ~0.5G
elif [ $total -ge $((512 << M)) ]; then
bootsize=$(( 4 << M))
auxsize=$(( 4 << M))
bootsize=$(( 8 << M))
auxsize=$(( 8 << M))
imgsize=$((192 << M))
cfgsize=$(( 16 << M))
# var is at least ~100M
@@ -80,7 +80,7 @@ probeboot()
genboot()
{
if [ -d $BINARIES_DIR/efi-part/EFI ]; then
if [ -d "$bootdata" ]; then
bootimg=$(cat <<EOF
image efi-part.vfat {
size = $bootsize
@@ -102,6 +102,17 @@ EOF
EOF
)
elif [ -f "$bootdata" ]; then
bootpart=$(cat <<EOF
partition boot {
offset = $bootoffs
partition-type-uuid = U
bootable = true
image = $bootdata
size = $bootsize
}
EOF
)
fi
}
@@ -110,15 +121,26 @@ root=$BUILD_DIR/genimage.root
tmp=$BUILD_DIR/genimage.tmp
total=$((512 << M))
bootoffs=
bootoffs=$((32 << K))
bootdata=
diskimg=disk.img
bootimg=
bootpart=
while getopts "a:s:" opt; do
while getopts "a:b:B:n:s:" opt; do
case ${opt} in
a)
arch=$OPTARG
;;
b)
bootdata=$OPTARG
;;
B)
bootoffs=$(($OPTARG))
;;
n)
diskimg=${OPTARG}
;;
s)
total=$(size2int $OPTARG)
;;
@@ -140,6 +162,7 @@ awk \
-vimgsize=$imgsize \
-vcfgsize=$cfgsize \
-vvarsize=$varsize \
-vdiskimg=$diskimg \
-vbootimg="$bootimg" -vbootpart="$bootpart" \
'{
sub(/@TOTALSIZE@/, total);
@@ -148,7 +171,7 @@ awk \
sub(/@IMGSIZE@/, imgsize);
sub(/@CFGSIZE@/, cfgsize);
sub(/@VARSIZE@/, varsize);
sub(/@DISKIMG@/, diskimg);
sub(/@BOOTIMG@/, bootimg);
sub(/@BOOTPART@/, bootpart);
}1' \
@@ -157,6 +180,7 @@ awk \
mkdir -p $root/aux
cp -f $BINARIES_DIR/rootfs.itbh $root/aux/primary.itbh
cp -f $BINARIES_DIR/rootfs.itbh $root/aux/secondary.itbh
cp -f $BINARIES_DIR/rauc.status $root/aux/rauc.status
case "$arch" in
aarch64)
+12 -2
View File
@@ -18,12 +18,22 @@ load_cfg()
load_cfg
[ "$FIT_IMAGE" = "y" ] || exit 0
work=$(pwd)/build/fit-image-local
work=$BUILD_DIR/fit-image-local
dtbs=$(find $BINARIES_DIR -name '*.dtb')
kernel=$(find $BINARIES_DIR -name '*Image' | head -n1)
squash=$BINARIES_DIR/rootfs.squashfs
mkdir -p $work
gzip <$kernel >$work/Image.gz
kernel=$work/Image.gz
rm -rf $work/rootfs
unsquashfs -f -d $work/rootfs $squash
rm -f $work/rootfs/boot/*Image
squash=$work/rootfs-no-kernel.squashfs
rm -f $squash
mksquashfs $work/rootfs $squash
# mkimage will only align images to 4 bytes, but U-Boot will leave
# both DTB and ramdisk in place when starting the kernel. So we pad
@@ -79,7 +89,7 @@ cat <<EOF >$work/infix.its
arch = "$FIT_ARCH";
os = "linux";
$(cat $work/kernel-load.itsi)
compression = "none";
compression = "gzip";
data = /incbin/("$kernel");
};
+63 -20
View File
@@ -1,26 +1,66 @@
#!/bin/sh
# shellcheck disable=SC1091
. "$TARGET_DIR/etc/os-release"
if [ -n "$INFIX_RELEASE" ]; then
rel="-${INFIX_RELEASE}"
fi
NM="${1:-custom}${rel}"
RAM=${2:-512}
IFNUM=${3:-1}
ARCH=$1
NM="${2:-custom}${rel}"
DISK=$3
RAM=${4:-512}
IFNUM=${5:-1}
# The aarch64 build currently has no "loader" but instead starts Linux
# directly, so we need to add a basic cmdline.
loader_args()
{
if [ "$ARCH" = "aarch64" ]; then
cat <<EOF
"kernel_command_line": "console=ttyAMA0 root=PARTLABEL=primary quiet",
EOF
fi
}
loader_img()
{
if [ "$ARCH" = "x86_64" ]; then
cat <<EOF
"bios_image": "$loader",
EOF
else
cat <<EOF
"kernel_image": "$loader",
EOF
fi
}
if [ "$ARCH" = "x86_64" ]; then
loader=OVMF.fd
accel=allow
opts=
else
loader=Image
accel=disable
opts="-M virt -cpu cortex-a72"
fi
echo ">> Disk image MD5: $(md5sum "$BINARIES_DIR/$DISK" | awk '{print $1}')"
cat <<EOF >"$BINARIES_DIR/${NM}.gns3a"
{
"name": "$NM",
"category": "router",
"description": "Infix is a Network Operating System based on Linux. It can be set up both as a switch, with offloading using switchdev, and a router with firewalling.",
"vendor_name": "KernelKit",
"vendor_url": "https://github.com/kernelkit/",
"product_name": "Infix",
"description": "$INFIX_DESC",
"vendor_name": "$VENDOR_NAME",
"vendor_url": "$VENDOR_HOME",
"product_name": "$NAME",
"registry_version": 6,
"status": "stable",
"maintainer": "KernelKit",
"maintainer_email": "kernelkit@googlegroups.com",
"usage": "Default console login is 'root', no password. For remote login, default user/pass: admin/admin also works.\n\nType 'help' for an overview of commands and relevant configuration files.\n\nThe /etc directory is writable, use the passwd tool after login as part of your set up.\nFor networking, classify interfaces as switchports with /etc/mactab, syntax: 'MAC-address eN', where N is the port number (1-MAX).\nTo set up bridging and management interfaces, use /etc/network/interfaces, and /etc/network/interfaces.d/",
"maintainer": "$VENDOR_NAME",
"maintainer_email": "${SUPPORT_URL#mailto:}",
"usage": "Default login, user/pass: admin/admin\n\nType 'help' for an overview of commands and relevant configuration files.\n\nFor Classic builds the following applies: the /etc directory is writable, use the passwd tool after login as part of your set up.\nFor networking, classify interfaces as switchports with /etc/mactab, syntax: 'MAC-address eN', where N is the port number (1-MAX).\nTo set up bridging and management interfaces, use /etc/network/interfaces, and /etc/network/interfaces.d/",
"port_name_format": "eth{0}",
"linked_clone": true,
"qemu": {
@@ -29,21 +69,24 @@ cat <<EOF >"$BINARIES_DIR/${NM}.gns3a"
"ram": ${RAM},
"cpus": 1,
"hda_disk_interface": "virtio",
"arch": "x86_64",
"arch": "$ARCH",
"console_type": "telnet",
"kvm": "allow"
$(loader_img)
$(loader_args)
"kvm": "$accel",
"options": "$opts"
},
"images": [
{
"filename": "OVMF.fd",
"filesize": $(stat --printf='%s' "$BINARIES_DIR/OVMF.fd"),
"md5sum": "$(md5sum "$BINARIES_DIR/OVMF.fd" | awk '{print $1}')",
"filename": "$loader",
"filesize": $(stat --printf='%s' "$BINARIES_DIR/$loader"),
"md5sum": "$(md5sum "$BINARIES_DIR/$loader" | awk '{print $1}')",
"version": "0.0"
},
{
"filename": "disk.img",
"filesize": $(stat --printf='%s' "$BINARIES_DIR/disk.img"),
"md5sum": "$(md5sum "$BINARIES_DIR/disk.img" | awk '{print $1}')",
"filename": "$DISK",
"filesize": $(stat --printf='%s' "$BINARIES_DIR/$DISK"),
"md5sum": "$(md5sum "$BINARIES_DIR/$DISK" | awk '{print $1}')",
"version": "0.0"
}
],
@@ -51,8 +94,8 @@ cat <<EOF >"$BINARIES_DIR/${NM}.gns3a"
{
"name": "0.0",
"images": {
"bios_image": "OVMF.fd",
"hda_disk_image": "disk.img"
$(loader_img)
"hda_disk_image": "$DISK"
}
}
]
+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
set -e
# Bootstrap a RAUC status file showing the newly created image
# installed to both the primary and secondary slots. This then bundled
# in the aux partition in mkdisk.sh, so that RAUC (on the target) can
# always report the installed versions.
rauc info --no-verify --output-format=shell $1 >/tmp/rauc-$$.info
. /tmp/rauc-$$.info
rm /tmp/rauc-$$.info
tstamp=$(date -u +%FT%TZ)
cat <<EOF
[slot.rootfs.0]
bundle.compatible=$RAUC_MF_COMPATIBLE
bundle.version=$RAUC_MF_VERSION
status=ok
sha256=$RAUC_IMAGE_DIGEST_0
size=$RAUC_IMAGE_SIZE_0
installed.timestamp=$tstamp
installed.count=1
activated.timestamp=$tstamp
activated.count=1
[slot.rootfs.1]
bundle.compatible=$RAUC_MF_COMPATIBLE
bundle.version=$RAUC_MF_VERSION
status=ok
sha256=$RAUC_IMAGE_DIGEST_0
size=$RAUC_IMAGE_SIZE_0
installed.timestamp=$tstamp
installed.count=1
activated.timestamp=$tstamp
activated.count=1
EOF
+1 -4
View File
@@ -3,11 +3,8 @@
set -e
GIT_VERSION=$(git -C $BR2_EXTERNAL_INFIX_PATH describe --always --dirty --tags)
if [ -n "$INFIX_RELEASE" ]; then
rel="-${INFIX_RELEASE}"
fi
name=$1${rel}
name=$1
arch=$2
sign=$3
+52 -23
View File
@@ -7,19 +7,39 @@ if [ -n "${ID_LIKE}" ]; then
ID="${ID} ${ID_LIKE}"
fi
GIT_VERSION=$(git -C "$BR2_EXTERNAL_INFIX_PATH" describe --always --dirty --tags)
if [ -z "$GIT_VERSION" ]; then
infix_path="$BR2_EXTERNAL_INFIX_PATH"
if [ -n "$INFIX_OEM_PATH" ]; then
# Use version from br2-external OEM:ing Infix
infix_path="$INFIX_OEM_PATH"
fi
GIT_VERSION=$(git -C "$infix_path" describe --always --dirty --tags)
fi
# Override VERSION in /etc/os-release and filenames for release builds
if [ -n "$INFIX_RELEASE" ]; then
VERSION="$INFIX_RELEASE"
else
VERSION=$GIT_VERSION
fi
# This is a symlink to /usr/lib/os-release, so we remove this to keep
# original Buildroot information.
rm -f "$TARGET_DIR/etc/os-release"
{
echo "NAME=\"Infix\""
echo "VERSION=${GIT_VERSION}"
echo "ID=infix"
echo "NAME=\"$INFIX_NAME\""
echo "ID=$INFIX_ID"
echo "PRETTY_NAME=\"$INFIX_TAGLINE $VERSION\""
echo "ID_LIKE=\"${ID}\""
echo "VERSION_ID=${GIT_VERSION}"
echo "BUILD_ID=\"${NAME} ${VERSION}\""
echo "PRETTY_NAME=\"Infix by KernelKit\""
echo "VERSION=\"${VERSION}\""
echo "VERSION_ID=${VERSION}"
echo "BUILD_ID=\"${GIT_VERSION}\""
if [ -n "$INFIX_IMAGE_ID" ]; then
echo "IMAGE_ID=\"$INFIX_IMAGE_ID\""
fi
if [ -n "$INFIX_RELEASE" ]; then
echo "IMAGE_VERSION=\"$INFIX_RELEASE\""
fi
if [ "$INFIX_VARIANT_NETCONF" = "y" ]; then
echo "VARIANT=\"Managed NETCONF\""
echo "VARIANT_ID=netconf"
@@ -28,26 +48,35 @@ rm -f "$TARGET_DIR/etc/os-release"
echo "VARIANT_ID=classic"
fi
echo "ARCHITECTURE=\"${INFIX_ARCH}\""
echo "HOME_URL=https://github.com/KernelKit"
echo "HOME_URL=$INFIX_HOME"
if [ -n "$INFIX_VENDOR" ]; then
echo "VENDOR_NAME=\"$INFIX_VENDOR\""
fi
if [ -n "$INFIX_VENDOR_HOME" ]; then
echo "VENDOR_HOME=\"$INFIX_VENDOR_HOME\""
fi
if [ -n "$INFIX_DOC" ]; then
echo "DOCUMENTATION_URL=\"$INFIX_DOC\""
fi
if [ -n "$INFIX_SUPPORT" ]; then
echo "SUPPORT_URL=\"$INFIX_SUPPORT\""
fi
if [ -n "$INFIX_DESC" ]; then
echo "INFIX_DESC=\"$INFIX_DESC\""
fi
} > "$TARGET_DIR/etc/os-release"
echo "$INFIX_TAGLINE $VERSION -- $(date +"%b %e %H:%M %Z %Y")" > "$TARGET_DIR/etc/version"
echo "Infix by KernelKit $GIT_VERSION -- $(date +"%b %e %H:%M %Z %Y")" > "$TARGET_DIR/etc/version"
# Allow pdmenu (setup) and bash to be a login shells, bash
# is added automatically when selected in menuyconfig, but
# not when BusyBox provides a symlink (for ash).
# Allow pdmenu (setup) and bash to be login shells, bash is added
# automatically when selected in menuyconfig, but not when BusyBox
# provides a symlink (for ash). The /bin/{true,false} are old UNIX
# beart means of disabling a user.
grep -qsE '^/usr/bin/pdmenu$$' "$TARGET_DIR/etc/shells" \
|| echo "/usr/bin/pdmenu" >> "$TARGET_DIR/etc/shells"
grep -qsE '^/bin/bash$$' "$TARGET_DIR/etc/shells" \
|| echo "/bin/bash" >> "$TARGET_DIR/etc/shells"
# Menuconfig support for modifying Qemu args in release tarballs
cp "$BR2_EXTERNAL_INFIX_PATH/board/common/qemu/qemu.sh" "$BINARIES_DIR/"
sed "s/default QEMU_aarch64/default QEMU_$BR2_ARCH/" \
< "$BR2_EXTERNAL_INFIX_PATH/board/common/qemu/Config.in" \
> "$BINARIES_DIR/Config.in"
rm -f "$BINARIES_DIR/qemu.cfg"
CONFIG_="CONFIG_" BR2_CONFIG="$BINARIES_DIR/qemu.cfg" \
"$O/build/buildroot-config/conf" --olddefconfig "$BINARIES_DIR/Config.in"
rm -f "$BINARIES_DIR/qemu.cfg.old" "$BINARIES_DIR/.config.old"
grep -qsE '^/bin/true$$' "$TARGET_DIR/etc/shells" \
|| echo "/bin/true" >> "$TARGET_DIR/etc/shells"
grep -qsE '^/bin/false$$' "$TARGET_DIR/etc/shells" \
|| echo "/bin/false" >> "$TARGET_DIR/etc/shells"
+52 -17
View File
@@ -1,15 +1,28 @@
#!/bin/sh
common=$(dirname "$(readlink -f "$0")")
. $common/lib.sh
# shellcheck disable=SC2086
common=$(dirname "$(readlink -f "$0")")
. "$common/lib.sh"
# shellcheck disable=SC1091
. "$TARGET_DIR/etc/os-release"
load_cfg INFIX_ID
load_cfg BR2_ARCH
load_cfg BR2_DEFCONFIG
load_cfg BR2_EXTERNAL_INFIX_PATH
NAME=infix-$(basename "$BR2_DEFCONFIG" _defconfig | tr _ - | sed 's/x86-64/x86_64/')
load_cfg BR2_TARGET_ROOTFS
if [ -n "$IMAGE_ID" ]; then
NAME="$IMAGE_ID"
else
NAME="$INFIX_ID"-$(echo "$BR2_ARCH" | tr _ - | sed 's/x86-64/x86_64/')
fi
diskimg=disk.img
ver()
{
if [ -n "$INFIX_RELEASE" ]; then
printf -- "-%s" "$INFIX_RELEASE"
printf -- "-%s" "${INFIX_RELEASE#v}"
return
fi
}
@@ -23,22 +36,34 @@ if [ "$SIGN_ENABLED" = "y" ]; then
$common/sign.sh $BR2_ARCH $SIGN_KEY
ixmsg "Creating RAUC Update Bundle"
$common/mkrauc.sh $NAME $BR2_ARCH $SIGN_KEY
$common/mkrauc.sh "$NAME$(ver)" $BR2_ARCH $SIGN_KEY
fi
load_cfg DISK_IMAGE
load_cfg DISK_IMAGE_SIZE
if [ "$DISK_IMAGE" = "y" ]; then
ixmsg "Creating Disk Image"
$common/mkdisk.sh -a $BR2_ARCH -s $DISK_IMAGE_SIZE
diskimg="${NAME}-disk$(ver).img"
bootcfg=
if [ "$DISK_IMAGE_BOOT_DATA" ]; then
bootcfg="-b $DISK_IMAGE_BOOT_DATA -B $DISK_IMAGE_BOOT_OFFSET"
fi
if [ "$BR2_TARGET_ROOTFS_SQUASHFS" != "y" ] && \
[ ! -f "$BINARIES_DIR/rootfs.squashfs" ]; then
ixmsg " Injecting $DISK_IMAGE_RELEASE_URL"
archive="$BINARIES_DIR/$(basename $DISK_IMAGE_RELEASE_URL)"
[ -f "$archive" ] || wget -O"$archive" "$DISK_IMAGE_RELEASE_URL"
tar -xa --strip-components=1 -C "$BINARIES_DIR" -f "$archive"
fi
$common/mkrauc-status.sh "$BINARIES_DIR/${NAME}.pkg" >"$BINARIES_DIR/rauc.status"
$common/mkdisk.sh -a $BR2_ARCH -n $diskimg -s $DISK_IMAGE_SIZE $bootcfg
fi
load_cfg GNS3_APPLIANCE
if [ "$GNS3_APPLIANCE" = "y" ]; then
load_cfg GNS3_APPLIANCE_RAM
load_cfg GNS3_APPLIANCE_IFNUM
ixmsg "Creating GNS3 Appliance, $GNS3_APPLIANCE_RAM MiB with $GNS3_APPLIANCE_IFNUM ports"
$common/mkgns3a.sh $NAME $GNS3_APPLIANCE_RAM $GNS3_APPLIANCE_IFNUM
$common/mkgns3a.sh $BR2_ARCH $NAME $diskimg $GNS3_APPLIANCE_RAM $GNS3_APPLIANCE_IFNUM
fi
load_cfg FIT_IMAGE
@@ -47,12 +72,22 @@ if [ "$FIT_IMAGE" = "y" ]; then
$common/mkfit.sh
fi
if [ -z "${NAME##*minimal*}" ]; then
NAME=$(echo "$NAME" | sed 's/-minimal//')
if [ "$BR2_TARGET_ROOTFS_SQUASHFS" = "y" ]; then
rel=$(ver)
ln -sf rootfs.squashfs "$BINARIES_DIR/${NAME}${rel}.img"
if [ -n "$rel" ]; then
ln -sf "$BINARIES_DIR/${NAME}${rel}.img" "$BINARIES_DIR/${NAME}.img"
fi
fi
rel=$(ver)
ln -sf rootfs.squashfs "$BINARIES_DIR/${NAME}${rel}.img"
if [ -n "$rel" ]; then
ln -sf "$BINARIES_DIR/${NAME}${rel}.img" "$BINARIES_DIR/${NAME}.img"
fi
# Menuconfig support for modifying Qemu args in release tarballs
cp "$BR2_EXTERNAL_INFIX_PATH/board/common/rootfs/bin/onieprom" "$BINARIES_DIR/"
cp "$BR2_EXTERNAL_INFIX_PATH/board/common/qemu/qemu.sh" "$BINARIES_DIR/"
sed -e "s/@ARCH@/QEMU_$BR2_ARCH/" \
-e "s/@DISK_IMG@/$diskimg/" \
< "$BR2_EXTERNAL_INFIX_PATH/board/common/qemu/Config.in.in" \
> "$BINARIES_DIR/Config.in"
rm -f "$BINARIES_DIR/qemu.cfg"
CONFIG_="CONFIG_" BR2_CONFIG="$BINARIES_DIR/qemu.cfg" \
"$O/build/buildroot-config/conf" --olddefconfig "$BINARIES_DIR/Config.in"
rm -f "$BINARIES_DIR/qemu.cfg.old" "$BINARIES_DIR/.config.old"
@@ -2,7 +2,7 @@ mainmenu "QEMU Virtualization"
choice
prompt "Target Architecture"
default QEMU_aarch64
default @ARCH@
config QEMU_x86_64
bool "x86_64"
@@ -37,19 +37,49 @@ choice
config QEMU_ROOTFS_MMC
bool "MMC"
depends on QEMU_aarch64
config QEMU_ROOTFS_INITRD
bool "Initrd"
depends on QEMU_LOADER_KERNEL
config QEMU_ROOTFS_VSCSI
bool "Virtio SCSI"
endchoice
choice
prompt "Console"
default QEMU_CONSOLE_VIRTIO
config QEMU_CONSOLE_VIRTIO
bool "Virtio (hvc0)"
depends on QEMU_LOADER_KERNEL
config QEMU_CONSOLE_SERIAL
bool "Serial (ttyS0/ttyAMA0)"
endchoice
config QEMU_MACHINE
string
default "qemu-system-aarch64 -M virt -cpu cortex-a72 -m 256M" if QEMU_aarch64
default "qemu-system-x86_64 -M q35,accel=kvm -cpu host -m 512M" if QEMU_x86_64
string "Select emulated machine"
default "qemu-system-aarch64 -M virt -cpu cortex-a72" if QEMU_aarch64
default "qemu-system-x86_64 -M q35,accel=kvm -cpu host" if QEMU_x86_64
help
You should not have to change this setting, although you may
want to tweak it, or change the acceleration.
The default is based on the Buildroot architecture, selected by
the defconfig you started with. Currently Infix supports only
aarch64 (ARM64) and x86_64 (AMD64).
config QEMU_MACHINE_RAM
string "RAM size (k/M/G)"
default "384M"
help
The default, 384 MiB, works for most configurations, even less for
the Infix Classic builds. However, if you get kernel panic with:
"System is deadlocked on memory", try increasing this one.
config QEMU_KERNEL
string
@@ -65,15 +95,9 @@ config QEMU_BIOS
config QEMU_ROOTFS
string
default "disk.img" if !QEMU_ROOTFS_INITRD
default "@DISK_IMG@" if !QEMU_ROOTFS_INITRD
default "rootfs.squashfs" if QEMU_ROOTFS_INITRD
config QEMU_CONSOLE
string
depends on !QEMU_ROOTFS_MMC
default "ttyAMA0" if QEMU_aarch64
default "ttyS0" if QEMU_x86_64
config QEMU_DTB_EXTEND
bool
depends on QEMU_LOADER_UBOOT
@@ -94,6 +118,9 @@ config QEMU_RW_VAR
default "var.ext4"
endif
config QEMU_VPD
bool "Emulate a Vital Product Data (VPD) Memory"
config QEMU_HOST
string "Export host filesystem path"
default "/tmp"
@@ -127,7 +154,11 @@ endchoice
config QEMU_NET_MODEL
string "Interface model"
default "virtio"
default "virtio-net-pci"
help
The default, virtio-net-pci, NIC works for most use-cases, but
if you want to play with low-level stuff like ethtool, you
might want to test the Intel 82545EM driver, e1000.
config QEMU_NET_BRIDGE_DEV
string "Bridge device"
+117 -28
View File
@@ -19,15 +19,27 @@
#
# Local variables
imgdir=$(readlink -f $(dirname "$0"))
prognm=$(basename "$0")
usage()
{
echo "usage: $prognm [opts]"
echo "Usage:"
echo " $prognm [opts] [ARGS]"
echo
echo " -c Run menuconfig to change Qemu settings"
echo " -h This help text"
echo "Options:"
echo " -c Run menuconfig to change Qemu settings"
echo " -h This help text"
echo
echo "Arguments:"
echo " ARGS1 Args before the '--' separator are for kernel space"
echo " -- Separator"
echo " ARGS2 Args after the '--' separator are for the init process"
echo " Also, qemu.cfg has QEMU_APPEND which can affect this."
echo
echo "Example:"
echo " qemu.sh -- finit.debug"
echo "___________________________________________________________________"
echo "Note: 'kconfig-frontends' package (Debian/Ubuntu) must be installed"
echo " for -c to work: sudo apt install kconfig-frontents"
@@ -69,14 +81,20 @@ loader_args()
append_args()
{
# Disabled, not needed anymore with virtconsole (hvc0)
# [ "$CONFIG_QEMU_CONSOLE" ] && echo -n "console=$CONFIG_QEMU_CONSOLE "
if [ "$CONFIG_QEMU_CONSOLE_VIRTIO" ]; then
echo -n "console=hvc0 "
elif [ "$CONFIG_QEMU_x86_64" ]; then
echo -n "console=ttyS0 "
elif [ "$CONFIG_QEMU_aarch64" ]; then
echo -n "console=ttyAMA0 "
else
die "Unknown console"
fi
echo -n "console=hvc0 "
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))
echo -n "root=/dev/ram ramdisk_size=${size} "
echo -n "root=/dev/ram0 ramdisk_size=${size} "
elif [ "$CONFIG_QEMU_ROOTFS_VSCSI" = "y" ]; then
echo -n "root=PARTLABEL=primary "
fi
@@ -103,6 +121,38 @@ rootfs_args()
fi
}
serial_args()
{
echo -n "-display none "
echo -n "-device virtio-serial "
echo -n "-chardev stdio,id=console0,mux=on "
echo -n "-mon chardev=console0 "
if [ "$CONFIG_QEMU_CONSOLE_VIRTIO" ]; then
echo -n "-device virtconsole,nr=0,name=console,chardev=console0 "
elif [ "$CONFIG_QEMU_CONSOLE_SERIAL" ]; then
echo -n "-serial chardev:console0 "
else
die "Unknown console"
fi
echo -n "-chardev socket,id=gdbserver,path=gdbserver.sock,server=on,wait=off "
echo -n "-device virtconsole,nr=1,name=gdbserver,chardev=gdbserver "
}
usb_args()
{
USBSTICK="usb.vfat"
if ! [ -f $USBSTICK ]; then
dd if=/dev/zero of=${USBSTICK} bs=8M count=1 >/dev/null 2>&1
mkfs.vfat $USBSTICK >/dev/null 2>&1
fi
echo -n "-drive if=none,id=usbstick,format=raw,file=${USBSTICK} "
echo -n "-usb "
echo -n "-device usb-ehci,id=ehci "
echo -n "-device usb-storage,bus=ehci.0,drive=usbstick "
}
rw_args()
{
[ "$CONFIG_QEMU_RW" ] || return
@@ -126,36 +176,74 @@ rw_args()
host_args()
{
[ "${QEMU_HOST}" ] || return
[ "$CONFIG_QEMU_HOST" ] || return
echo -n "-virtfs local,path=${QEMU_HOST},security_model=none,writeout=immediate,mount_tag=hostfs "
echo -n "-virtfs local,path=$CONFIG_QEMU_HOST,security_model=none,writeout=immediate,mount_tag=hostfs "
}
net_dev_args()
{
local name="e$1"
local mac=$(printf "02:00:00:00:00:%02x" $1)
echo -n "-device $CONFIG_QEMU_NET_MODEL,netdev=$name,mac=$mac "
echo "$name $mac" >>"$mactab"
}
net_args()
{
QEMU_NET_MODEL=${QEMU_NET_MODEL:-virtio}
# Infix will pick up this file via fwcfg and install it to /etc
mactab=${imgdir}/mactab
:> "$mactab"
echo -n "-fw_cfg name=opt/mactab,file=$mactab "
if [ "$CONFIG_QEMU_NET_BRIDGE" = "y" ]; then
QEMU_NET_BRIDGE_DEV=${QEMU_NET_BRIDGE_DEV:-virbr0}
echo -n "-nic bridge,br=$CONFIG_QEMU_NET_BRIDGE_DEV,model=$CONFIG_QEMU_NET_MODEL "
echo -n "-netdev bridge,id=e0,br=$CONFIG_QEMU_NET_BRIDGE_DEV "
net_dev_args 0
elif [ "$CONFIG_QEMU_NET_TAP" = "y" ]; then
QEMU_NET_TAP_N=${QEMU_NET_TAP_N:-1}
mactab=$(dirname "$CONFIG_QEMU_ROOTFS")/mactab
rm -f "$mactab"
for i in $(seq 0 $(($CONFIG_QEMU_NET_TAP_N - 1))); do
printf "e$i 52:54:00:12:34:%02x\n" $((0x56 + i)) >>"$mactab"
echo -n "-netdev tap,id=nd$i,ifname=qtap$i -device e1000,netdev=nd$i "
echo -n "-netdev tap,id=e$i,ifname=qtap$i "
net_dev_args $i
done
echo -n "-fw_cfg name=opt/mactab,file=$mactab "
elif [ "$CONFIG_QEMU_NET_USER" = "y" ]; then
[ "$CONFIG_QEMU_NET_USER_OPTS" ] && QEMU_NET_USER_OPTS="$CONFIG_QEMU_NET_USER_OPTS,"
local useropts=
[ "$CONFIG_QEMU_NET_USER_OPTS" ] && useropts=",$CONFIG_QEMU_NET_USER_OPTS"
echo -n "-nic user,${QEMU_NET_USER_OPTS}model=$CONFIG_QEMU_NET_MODEL "
echo -n "-netdev user,id=e0${useropts} "
net_dev_args 0
else
echo -n "-nic none"
fi
}
# Vital Product data
vpd_args()
{
[ "$CONFIG_QEMU_VPD" = "y" ] || return
vpd_file="${imgdir}/vpd"
if ! [ -f "$vpd_file" ]; then
onieprom="${imgdir}/onieprom"
# This is you QEMU factory/default password:
pwhash=$(echo -n "admin" | mkpasswd -s -m sha256crypt)
cat <<EOF | "$onieprom" -e >"$vpd_file"
{
"manufacture-date": "$(date +"%m/%d/%Y %H:%M:%S")",
"vendor-extension": [
[
61046,
"{\"pwhash\":\"$pwhash\"}"
]
]
}
EOF
fi
echo -n "-fw_cfg name=opt/vpd,file=$vpd_file"
}
wdt_args()
{
echo -n "-device i6300esb -rtc clock=host"
@@ -165,18 +253,16 @@ run_qemu()
{
local qemu
read qemu <<EOF
$CONFIG_QEMU_MACHINE \
-display none -rtc base=utc,clock=vm \
-device virtio-serial -chardev stdio,mux=on,id=console0 \
-device virtconsole,chardev=console0 -mon chardev=console0 \
-chardev socket,id=gdbserver,path=gdbserver.sock,server=on,wait=off \
-device virtconsole,name=console1,chardev=gdbserver \
$CONFIG_QEMU_MACHINE -m $CONFIG_QEMU_MACHINE_RAM \
$(loader_args) \
$(rootfs_args) \
$(serial_args) \
$(rw_args) \
$(usb_args) \
$(host_args) \
$(net_args) \
$(wdt_args) \
$(vpd_args) \
$CONFIG_QEMU_EXTRA
EOF
@@ -219,7 +305,7 @@ generate_dot()
hostports="<qtap0> qtap0"
targetports="<e0> e0"
edges="host:qtap0 -- target:e0;"
edges="host:qtap0 -- target:e0 [kind=mgmt];"
for tap in $(seq 1 $(($CONFIG_QEMU_NET_TAP_N - 1))); do
hostports="$hostports | <qtap$tap> qtap$tap "
targetports="$targetports | <e$tap> e$tap "
@@ -284,6 +370,10 @@ else
load_qemucfg qemu.cfg
fi
if [ -z "$QEMU_EXTRA_APPEND" ]; then
QEMU_EXTRA_APPEND="$*"
fi
generate_dot
echo "Starting Qemu :: Ctrl-a x -- exit | Ctrl-a c -- toggle console/monitor"
@@ -291,4 +381,3 @@ line=$(stty -g)
stty raw
run_qemu $(dtb_args)
stty "$line"
+218
View File
@@ -0,0 +1,218 @@
#!/usr/bin/env python3
import binascii
import struct
HDRMGC = b"TlvInfo"
HDRVER = 1
HDRFMT = ">7sxBH"
HDRLEN = struct.calcsize(HDRFMT)
CRCFMT = ">BBL"
CRCLEN = struct.calcsize(CRCFMT)
def pack_varstr(s, maxlen=0xff):
b = bytes(s, "ascii")
assert(len(b) <= maxlen)
return b
def unpack_varstr(b):
return b.decode("ascii")
def pack_u8(num):
return struct.pack("B", num)
def unpack_u8(b):
return struct.unpack("B", b)[0]
def pack_u16(num):
return struct.pack(">H", num)
def unpack_u16(b):
return struct.unpack(">H", b)[0]
def pack_u32(num):
return struct.pack(">L", num)
def unpack_u32(b):
return struct.unpack(">L", b)[0]
def pack_date(datestr):
assert(len(datestr) == 19)
return pack_varstr(datestr, 19)
def pack_country(cstr):
assert(len(cstr) == 2)
return pack_varstr(cstr, 2)
def pack_mac(macstr):
return struct.pack("6B", *[int(o, 16) for o in macstr.split(":")])
def unpack_mac(b):
o = struct.unpack("6B", b)
return f"{o[0]:02x}:{o[1]:02x}:{o[2]:02x}:{o[3]:02x}:{o[4]:02x}:{o[5]:02x}"
OPS = {
"varstr": (pack_varstr, unpack_varstr),
"u8": (pack_u8, unpack_u8),
"u16": (pack_u16, unpack_u16),
"u32": (pack_u32, unpack_u32),
"date": (pack_date, unpack_varstr),
"country": (pack_country, unpack_varstr),
"mac": (pack_mac, unpack_mac),
}
TLV = (
{ "type": 0x21, "name": "product-name", "ops": "varstr" },
{ "type": 0x22, "name": "part-number", "ops": "varstr" },
{ "type": 0x23, "name": "serial-number", "ops": "varstr" },
{ "type": 0x24, "name": "mac-address", "ops": "mac" },
{ "type": 0x25, "name": "manufacture-date", "ops": "date" },
{ "type": 0x26, "name": "device-version", "ops": "u8" },
{ "type": 0x27, "name": "label-revision", "ops": "varstr" },
{ "type": 0x28, "name": "platform-name", "ops": "varstr" },
{ "type": 0x29, "name": "onie-version", "ops": "varstr" },
{ "type": 0x2a, "name": "num-macs", "ops": "u16" },
{ "type": 0x2b, "name": "manufacturer", "ops": "varstr" },
{ "type": 0x2c, "name": "country-code", "ops": "country" },
{ "type": 0x2d, "name": "vendor", "ops": "varstr" },
{ "type": 0x2e, "name": "diag-version", "ops": "varstr" },
{ "type": 0x2f, "name": "service-tag", "ops": "varstr" },
)
TLV_VENDOR_EXTENSION = 0xfd
TLV_CRC32 = 0xfe
def _tlv_by_lambda(fn):
info = next(filter(fn, TLV))
if "ops" in info:
return info, OPS[info["ops"]]
else:
return info
def tlv_by_name(name):
try:
return _tlv_by_lambda(lambda info: info["name"] == name)
except StopIteration:
raise ValueError(f"Unknown type name \"{name}\"")
def tlv_by_type(t):
try:
return _tlv_by_lambda(lambda info: info["type"] == t)
except StopIteration:
raise ValueError(f"Unknown type id {t}")
def into_tlv(d):
def pack_vendor(exts):
out = b""
for (iana_pen, val) in exts:
b = bytes(val, "utf-8")
l = len(b) + struct.calcsize(">L")
assert(l <= 0xff)
out += struct.pack(">BBL", TLV_VENDOR_EXTENSION, l, iana_pen) + b
return out
out = b""
# Generate all optional data
for (k, v) in sorted(d.items()):
if k == "vendor-extension":
out += pack_vendor(v)
else:
info, (pack, _) = tlv_by_name(k)
val = pack(v)
out += struct.pack("BB", info["type"], len(val)) + val
# Prepend the header now that we know the total length of the
# optional fields - make sure sure to include the CRC TLV length,
# which is appended in the last step
out = struct.pack(HDRFMT, HDRMGC, HDRVER, len(out) + CRCLEN) + out
out += struct.pack("BB", TLV_CRC32, struct.calcsize(">L"))
out += struct.pack(">L", binascii.crc32(out))
return out
def from_tlv(f):
d = {}
def unpack_vendor(ext):
head, tail = ext[:4], ext[4:]
iana_pen = struct.unpack(">L", head)[0]
val = tail.decode("utf-8")
if "vendor-extension" not in d:
d["vendor-extension"] = []
d["vendor-extension"].append([iana_pen, val])
head = f.read(HDRLEN)
magic, ver, l = struct.unpack(HDRFMT, head)
assert(magic == HDRMGC)
assert(ver == 1)
tail = f.read(l)
b = head + tail
assert(len(b) >= HDRLEN + l)
crcoffs = HDRLEN + l - CRCLEN
t, l, v = struct.unpack(CRCFMT, b[crcoffs:crcoffs+CRCLEN])
assert(t == TLV_CRC32)
assert(v == binascii.crc32(b[:crcoffs + struct.calcsize("BB")]))
while len(tail) >= 2:
t, l = struct.unpack("BB", tail[:2])
v = tail[2:l+2]
tail = tail[l+2:]
if t == TLV_VENDOR_EXTENSION:
unpack_vendor(v)
continue
elif t == TLV_CRC32:
break
info, (_, unpack) = tlv_by_type(t)
d[info["name"]] = unpack(v)
return d
if __name__ == "__main__":
import argparse
import json
import os
import sys
parser = argparse.ArgumentParser(prog='onieprom')
parser.add_argument("infile", nargs="?", default=sys.stdin, type=argparse.FileType("rb", 0))
parser.add_argument("outfile", nargs="?", default=sys.stdout, type=argparse.FileType("wb"))
parser.add_argument("-e", "--encode", default=False, action="store_true",
help="Encode JSON input to binary output")
parser.add_argument("-d", "--decode", default=False, action="store_true",
help="Decode binary input to JSON output")
args = parser.parse_args()
if (not args.encode) and (not args.decode):
c = args.infile.read(1)
args.infile.seek(0, 0)
if c == b"{":
args.encode = True
elif c == b"T":
args.decode = True
else:
sys.stderr.write("Neither encode nor decode specified, and could not infer operation from input")
sys.exit(1)
if args.encode:
args.outfile.buffer.write(into_tlv(json.load(args.infile)))
else:
args.outfile.write(json.dumps(from_tlv(args.infile)))
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
Q=$@
/bin/echo -n "$Q, are you sure (y/N)? "
read -n1 yorn
echo
if [ x$yorn != "xy" ] && [ x$yorn != "xY" ]; then
echo "OK, aborting."
exit 1
fi
exit 0
+1
View File
@@ -0,0 +1 @@
/usr/bin/mg
@@ -1,5 +0,0 @@
{
"ietf-system:system": {
"hostname": "infix"
}
}
+88
View File
@@ -0,0 +1,88 @@
#!/bin/sh
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# avahi is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with avahi; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
set -e
# Command line arguments:
# $1 event that happened:
# BIND: Successfully claimed address
# CONFLICT: An IP address conflict happened
# UNBIND: The IP address is no longer needed
# STOP: The daemon is terminating
# $2 interface name
# $3 IP adddress
PATH="$PATH:/usr/bin:/usr/sbin:/bin:/sbin"
# Use a different metric for each interface, so that we can set
# identical routes to multiple interfaces.
METRIC=$((1000 + `cat "/sys/class/net/$2/ifindex" 2>/dev/null || echo 0`))
if [ -x /bin/ip -o -x /sbin/ip ] ; then
# We have the Linux ip tool from the iproute package
case "$1" in
BIND)
ip addr flush dev "$2" label "$2:avahi"
ip addr add "$3"/16 brd 169.254.255.255 label "$2:avahi" scope link dev "$2" proto 6
ip route add default dev "$2" metric "$METRIC" scope link ||:
;;
CONFLICT|UNBIND|STOP)
ip route del default dev "$2" metric "$METRIC" scope link ||:
ip addr del "$3"/16 brd 169.254.255.255 label "$2:avahi" scope link dev "$2"
;;
*)
echo "Unknown event $1" >&2
exit 1
;;
esac
elif [ -x /bin/ifconfig -o -x /sbin/ifconfig ] ; then
# We have the old ifconfig tool
case "$1" in
BIND)
ifconfig "$2:avahi" inet "$3" netmask 255.255.0.0 broadcast 169.254.255.255 up
route add default dev "$2:avahi" metric "$METRIC" ||:
;;
CONFLICT|STOP|UNBIND)
route del default dev "$2:avahi" metric "$METRIC" ||:
ifconfig "$2:avahi" down
;;
*)
echo "Unknown event $1" >&2
exit 1
;;
esac
else
echo "No network configuration tool found." >&2
exit 1
fi
exit 0
-3
View File
@@ -13,6 +13,3 @@ export PROMPT_COMMAND=prompt_command
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# Disble built-ins
enable -n help
@@ -0,0 +1,27 @@
# This file defines default behavior and a skeleton for including config
# snippets from both confd, i.e., ietf-system.yang, and DHCP clients.
# Default values taken from Debian /etc/chrony/chrony.conf
# *.conf when acting as an NTP server
confdir /etc/chrony/conf.d
# *.sources from DHCP clients, e.g., /run/chrony-dhcp/$ifname.sources:
# server 192.0.2.1 iburst
sourcedir /run/chrony/dhcp-sources.d
# *.sources for NTP servers generated by confd:ietf-system.c
sourcedir /etc/chrony/sources.d
# Where to store the system clock rate information across reboots.
driftfile /var/lib/chrony/chrony.drift
# Stop bad estimates upsetting machine clock.
maxupdateskew 100.0
# Enables kernel synchronisation (every 11 minutes) of the real-time
# clock. Note that it cant be used along with the 'rtcfile' directive.
rtcsync
# Step the system clock instead of slewing it if the adjustment is
# larger than one second, but only in the first three clock updates.
makestep 1 3
+1
View File
@@ -0,0 +1 @@
CHRONY_ARGS="-f /etc/chrony/chrony.conf"
-1
View File
@@ -1,2 +1 @@
set COLORTERM=yes
runparts /cfg/start.d
@@ -1,2 +1,3 @@
run [S] /lib/infix/sysctl-sync-ip-conf --
run [S] /lib/infix/nameif -- Probing network interfaces
run [S] log:console /libexec/infix/probe -- Probing system information
run [S] <pid/syslogd> /libexec/infix/sysctl-sync-ip-conf --
run [S] <pid/syslogd> /libexec/infix/nameif -- Probing network interfaces
@@ -0,0 +1,4 @@
service :%i pid:!/run/k8s-logger-%i.pid <usr/container:%i> \
[2345] k8s-logger -cni %i -f local1 /run/containers/%i.fifo -- Logger for container %i
sysv :%i pid:!/run/container:%i.pid <pid/k8s-logger:%i> kill:10 \
[2345] container -n %i -- container %i
@@ -0,0 +1,5 @@
set G_MESSAGES_DEBUG=nocolor
service [2345] <service/dbus/running> \
env:-/etc/default/rauc log:prio:user.notice \
rauc service $RAUC_ARGS -- Software update service
@@ -1,2 +0,0 @@
task [S] /lib/infix/ssh-hostkeys --
service [2345789] <usr/ssh-hostkeys> /usr/sbin/sshd -D -- OpenSSH daemon
@@ -0,0 +1,5 @@
# Override Finit plugin
service cgroup.system name:dbus notify:none pid:!/run/messagebus.pid \
[S123456789] <pid/syslogd> /usr/bin/dbus-daemon --nofork --system --syslog-only \
-- D-Bus message bus daemon
+1
View File
@@ -0,0 +1 @@
../available/rauc.conf
@@ -1 +0,0 @@
../available/sshd.conf
+2 -5
View File
@@ -11,15 +11,12 @@ sysfs /sys sysfs defaults 0 0
debugfs /sys/kernel/debug debugfs nofail 0 0
cfgfs /config configfs nofail,noauto 0 0
# Optional host share when running in Qemu
hostfs /host 9p nofail,cache=none,msize=16384 0 0
# The chosen backing storage for the overlays placed on /cfg, /etc,
# /home, /root, and /var, are determined dynamically by /lib/infix/mnt
# /home, /root, and /var, are determined dynamically by /libexec/infix/mnt
# depending on the available devices.
mnttmp /mnt/tmp tmpfs defaults 0 0
LABEL=aux /mnt/aux auto noatime,nodiratime,noauto 0 0
LABEL=var /mnt/var auto noatime,nodiratime,noauto 0 0
LABEL=cfg /mnt/cfg auto noatime,nodiratime,noauto 0 0
hostfs /mnt/host 9p cache=none,msize=16384,noauto 0 0
/lib/infix/mnt# /cfg helper none 0 0
/libexec/infix/mnt# /cfg helper none 0 0
+1
View File
@@ -1,2 +1,3 @@
1 port
2 iface
3 internal
@@ -0,0 +1,3 @@
4 static
5 dhcp
6 random
@@ -0,0 +1,3 @@
# Do not authorize usb ports before they have been checked in in the device-tree
options usbcore authorized_default=0
+4
View File
@@ -0,0 +1,4 @@
.-------.
| . . | Infix -- a Network Operating System
|-. v .-| https://kernelkit.github.io
'-'---'-'
-122
View File
@@ -1,122 +0,0 @@
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /restconf/ {
fastcgi_pass unix:/var/run/clixon/restconf.sock;
include fastcgi_params;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
@@ -4,17 +4,21 @@ alias ll='ls -alF'
alias ls='ls --color=auto'
export EDITOR=/usr/bin/edit
export VISUAL=/usr/bin/edit
export LESS="-P %f (press h for help or q to quit)"
alias vim='vi'
alias view='vi -R'
alias emacs='mg'
alias sensible-editor=edit
alias sensible-pager=pager
alias hd="hexdump -C"
alias ip='ip --color=auto'
alias ipb='ip -br'
alias ipaddr='ip addr'
alias iplink='ip link'
alias bridge='bridge --color=auto'
alias cli='klish'
alias llping='ping -L ff02::1 -I'
alias docker=podman
+361
View File
@@ -0,0 +1,361 @@
# Network services, Internet style
#
# Updated from https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml .
#
# New ports will be added on request if they have been officially assigned
# by IANA and used in the real-world or are needed by a debian package.
# If you need a huge list of used numbers please install the nmap package.
tcpmux 1/tcp # TCP port service multiplexer
echo 7/tcp
echo 7/udp
discard 9/tcp sink null
discard 9/udp sink null
systat 11/tcp users
daytime 13/tcp
daytime 13/udp
netstat 15/tcp
qotd 17/tcp quote
chargen 19/tcp ttytst source
chargen 19/udp ttytst source
ftp-data 20/tcp
ftp 21/tcp
fsp 21/udp fspd
ssh 22/tcp # SSH Remote Login Protocol
telnet 23/tcp
smtp 25/tcp mail
time 37/tcp timserver
time 37/udp timserver
whois 43/tcp nicname
tacacs 49/tcp # Login Host Protocol (TACACS)
tacacs 49/udp
domain 53/tcp # Domain Name Server
domain 53/udp
bootps 67/udp
bootpc 68/udp
tftp 69/udp
gopher 70/tcp # Internet Gopher
finger 79/tcp
http 80/tcp www # WorldWideWeb HTTP
kerberos 88/tcp kerberos5 krb5 kerberos-sec # Kerberos v5
kerberos 88/udp kerberos5 krb5 kerberos-sec # Kerberos v5
iso-tsap 102/tcp tsap # part of ISODE
acr-nema 104/tcp dicom # Digital Imag. & Comm. 300
pop3 110/tcp pop-3 # POP version 3
sunrpc 111/tcp portmapper # RPC 4.0 portmapper
sunrpc 111/udp portmapper
auth 113/tcp authentication tap ident
nntp 119/tcp readnews untp # USENET News Transfer Protocol
ntp 123/udp # Network Time Protocol
epmap 135/tcp loc-srv # DCE endpoint resolution
netbios-ns 137/udp # NETBIOS Name Service
netbios-dgm 138/udp # NETBIOS Datagram Service
netbios-ssn 139/tcp # NETBIOS session service
imap2 143/tcp imap # Interim Mail Access P 2 and 4
snmp 161/tcp # Simple Net Mgmt Protocol
snmp 161/udp
snmp-trap 162/tcp snmptrap # Traps for SNMP
snmp-trap 162/udp snmptrap
cmip-man 163/tcp # ISO mgmt over IP (CMOT)
cmip-man 163/udp
cmip-agent 164/tcp
cmip-agent 164/udp
mailq 174/tcp # Mailer transport queue for Zmailer
xdmcp 177/udp # X Display Manager Control Protocol
bgp 179/tcp # Border Gateway Protocol
smux 199/tcp # SNMP Unix Multiplexer
qmtp 209/tcp # Quick Mail Transfer Protocol
z3950 210/tcp wais # NISO Z39.50 database
ipx 213/udp # IPX [RFC1234]
ptp-event 319/udp
ptp-general 320/udp
pawserv 345/tcp # Perf Analysis Workbench
zserv 346/tcp # Zebra server
rpc2portmap 369/tcp
rpc2portmap 369/udp # Coda portmapper
codaauth2 370/tcp
codaauth2 370/udp # Coda authentication server
clearcase 371/udp Clearcase
ldap 389/tcp # Lightweight Directory Access Protocol
ldap 389/udp
svrloc 427/tcp # Server Location
svrloc 427/udp
https 443/tcp # http protocol over TLS/SSL
https 443/udp # HTTP/3
snpp 444/tcp # Simple Network Paging Protocol
microsoft-ds 445/tcp # Microsoft Naked CIFS
kpasswd 464/tcp
kpasswd 464/udp
submissions 465/tcp ssmtp smtps urd # Submission over TLS [RFC8314]
saft 487/tcp # Simple Asynchronous File Transfer
isakmp 500/udp # IPSEC key management
rtsp 554/tcp # Real Time Stream Control Protocol
rtsp 554/udp
nqs 607/tcp # Network Queuing system
asf-rmcp 623/udp # ASF Remote Management and Control Protocol
qmqp 628/tcp
ipp 631/tcp # Internet Printing Protocol
ldp 646/tcp # Label Distribution Protocol
ldp 646/udp
#
# UNIX specific services
#
exec 512/tcp
biff 512/udp comsat
login 513/tcp
who 513/udp whod
shell 514/tcp cmd syslog # no passwords used
syslog 514/udp
printer 515/tcp spooler # line printer spooler
talk 517/udp
ntalk 518/udp
route 520/udp router routed # RIP
gdomap 538/tcp # GNUstep distributed objects
gdomap 538/udp
uucp 540/tcp uucpd # uucp daemon
klogin 543/tcp # Kerberized `rlogin' (v5)
kshell 544/tcp krcmd # Kerberized `rsh' (v5)
dhcpv6-client 546/udp
dhcpv6-server 547/udp
afpovertcp 548/tcp # AFP over TCP
nntps 563/tcp snntp # NNTP over SSL
submission 587/tcp # Submission [RFC4409]
ldaps 636/tcp # LDAP over SSL
ldaps 636/udp
tinc 655/tcp # tinc control port
tinc 655/udp
silc 706/tcp
kerberos-adm 749/tcp # Kerberos `kadmin' (v5)
#
domain-s 853/tcp # DNS over TLS [RFC7858]
domain-s 853/udp # DNS over DTLS [RFC8094]
rsync 873/tcp
ftps-data 989/tcp # FTP over SSL (data)
ftps 990/tcp
telnets 992/tcp # Telnet over SSL
imaps 993/tcp # IMAP over SSL
pop3s 995/tcp # POP-3 over SSL
#
# From ``Assigned Numbers'':
#
#> The Registered Ports are not controlled by the IANA and on most systems
#> can be used by ordinary user processes or programs executed by ordinary
#> users.
#
#> Ports are used in the TCP [45,106] to name the ends of logical
#> connections which carry long term conversations. For the purpose of
#> providing services to unknown callers, a service contact port is
#> defined. This list specifies the port used by the server process as its
#> contact port. While the IANA can not control uses of these ports it
#> does register or list uses of these ports as a convienence to the
#> community.
#
socks 1080/tcp # socks proxy server
proofd 1093/tcp
rootd 1094/tcp
openvpn 1194/tcp
openvpn 1194/udp
rmiregistry 1099/tcp # Java RMI Registry
lotusnote 1352/tcp lotusnotes # Lotus Note
ms-sql-s 1433/tcp # Microsoft SQL Server
ms-sql-m 1434/udp # Microsoft SQL Monitor
ingreslock 1524/tcp
datametrics 1645/tcp old-radius
datametrics 1645/udp old-radius
sa-msg-port 1646/tcp old-radacct
sa-msg-port 1646/udp old-radacct
kermit 1649/tcp
groupwise 1677/tcp
l2f 1701/udp l2tp
radius 1812/tcp
radius 1812/udp
radius-acct 1813/tcp radacct # Radius Accounting
radius-acct 1813/udp radacct
cisco-sccp 2000/tcp # Cisco SCCP
nfs 2049/tcp # Network File System
nfs 2049/udp # Network File System
gnunet 2086/tcp
gnunet 2086/udp
rtcm-sc104 2101/tcp # RTCM SC-104 IANA 1/29/99
rtcm-sc104 2101/udp
gsigatekeeper 2119/tcp
gris 2135/tcp # Grid Resource Information Server
cvspserver 2401/tcp # CVS client/server operations
venus 2430/tcp # codacon port
venus 2430/udp # Venus callback/wbc interface
venus-se 2431/tcp # tcp side effects
venus-se 2431/udp # udp sftp side effect
codasrv 2432/tcp # not used
codasrv 2432/udp # server port
codasrv-se 2433/tcp # tcp side effects
codasrv-se 2433/udp # udp sftp side effect
mon 2583/tcp # MON traps
mon 2583/udp
dict 2628/tcp # Dictionary server
f5-globalsite 2792/tcp
gsiftp 2811/tcp
gpsd 2947/tcp
gds-db 3050/tcp gds_db # InterBase server
icpv2 3130/udp icp # Internet Cache Protocol
isns 3205/tcp # iSNS Server Port
isns 3205/udp # iSNS Server Port
iscsi-target 3260/tcp
mysql 3306/tcp
ms-wbt-server 3389/tcp
nut 3493/tcp # Network UPS Tools
nut 3493/udp
distcc 3632/tcp # distributed compiler
daap 3689/tcp # Digital Audio Access Protocol
svn 3690/tcp subversion # Subversion protocol
suucp 4031/tcp # UUCP over SSL
sysrqd 4094/tcp # sysrq daemon
sieve 4190/tcp # ManageSieve Protocol
epmd 4369/tcp # Erlang Port Mapper Daemon
remctl 4373/tcp # Remote Authenticated Command Service
f5-iquery 4353/tcp # F5 iQuery
ntske 4460/tcp # Network Time Security Key Establishment
ipsec-nat-t 4500/udp # IPsec NAT-Traversal [RFC3947]
iax 4569/udp # Inter-Asterisk eXchange
mtn 4691/tcp # monotone Netsync Protocol
radmin-port 4899/tcp # RAdmin Port
sip 5060/tcp # Session Initiation Protocol
sip 5060/udp
sip-tls 5061/tcp
sip-tls 5061/udp
xmpp-client 5222/tcp jabber-client # Jabber Client Connection
xmpp-server 5269/tcp jabber-server # Jabber Server Connection
cfengine 5308/tcp
mdns 5353/udp # Multicast DNS
postgresql 5432/tcp postgres # PostgreSQL Database
freeciv 5556/tcp rptp # Freeciv gameplay
amqps 5671/tcp # AMQP protocol over TLS/SSL
amqp 5672/tcp
amqp 5672/sctp
x11 6000/tcp x11-0 # X Window System
x11-1 6001/tcp
x11-2 6002/tcp
x11-3 6003/tcp
x11-4 6004/tcp
x11-5 6005/tcp
x11-6 6006/tcp
x11-7 6007/tcp
gnutella-svc 6346/tcp # gnutella
gnutella-svc 6346/udp
gnutella-rtr 6347/tcp # gnutella
gnutella-rtr 6347/udp
redis 6379/tcp
sge-qmaster 6444/tcp sge_qmaster # Grid Engine Qmaster Service
sge-execd 6445/tcp sge_execd # Grid Engine Execution Service
mysql-proxy 6446/tcp # MySQL Proxy
babel 6696/udp # Babel Routing Protocol
ircs-u 6697/tcp # Internet Relay Chat via TLS/SSL
bbs 7000/tcp
afs3-fileserver 7000/udp
afs3-callback 7001/udp # callbacks to cache managers
afs3-prserver 7002/udp # users & groups database
afs3-vlserver 7003/udp # volume location database
afs3-kaserver 7004/udp # AFS/Kerberos authentication
afs3-volser 7005/udp # volume managment server
afs3-bos 7007/udp # basic overseer process
afs3-update 7008/udp # server-to-server updater
afs3-rmtsys 7009/udp # remote cache manager service
font-service 7100/tcp xfs # X Font Service
http-alt 8080/tcp webcache # WWW caching service
puppet 8140/tcp # The Puppet master service
bacula-dir 9101/tcp # Bacula Director
bacula-fd 9102/tcp # Bacula File Daemon
bacula-sd 9103/tcp # Bacula Storage Daemon
xmms2 9667/tcp # Cross-platform Music Multiplexing System
nbd 10809/tcp # Linux Network Block Device
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
amanda 10080/tcp # amanda backup services
dicom 11112/tcp
hkp 11371/tcp # OpenPGP HTTP Keyserver
db-lsp 17500/tcp # Dropbox LanSync Protocol
dcap 22125/tcp # dCache Access Protocol
gsidcap 22128/tcp # GSI dCache Access Protocol
wnn6 22273/tcp # wnn6
#
# Datagram Delivery Protocol services
#
rtmp 1/ddp # Routing Table Maintenance Protocol
nbp 2/ddp # Name Binding Protocol
echo 4/ddp # AppleTalk Echo Protocol
zip 6/ddp # Zone Information Protocol
#=========================================================================
# The remaining port numbers are not as allocated by IANA.
#=========================================================================
# Kerberos (Project Athena/MIT) services
kerberos4 750/udp kerberos-iv kdc # Kerberos (server)
kerberos4 750/tcp kerberos-iv kdc
kerberos-master 751/udp kerberos_master # Kerberos authentication
kerberos-master 751/tcp
passwd-server 752/udp passwd_server # Kerberos passwd server
krb-prop 754/tcp krb_prop krb5_prop hprop # Kerberos slave propagation
zephyr-srv 2102/udp # Zephyr server
zephyr-clt 2103/udp # Zephyr serv-hm connection
zephyr-hm 2104/udp # Zephyr hostmanager
iprop 2121/tcp # incremental propagation
supfilesrv 871/tcp # Software Upgrade Protocol server
supfiledbg 1127/tcp # Software Upgrade Protocol debugging
#
# Services added for the Debian GNU/Linux distribution
#
poppassd 106/tcp # Eudora
moira-db 775/tcp moira_db # Moira database
moira-update 777/tcp moira_update # Moira update protocol
moira-ureg 779/udp moira_ureg # Moira user registration
spamd 783/tcp # spamassassin daemon
skkserv 1178/tcp # skk jisho server port
predict 1210/udp # predict -- satellite tracking
rmtcfg 1236/tcp # Gracilis Packeten remote config server
xtel 1313/tcp # french minitel
xtelw 1314/tcp # french minitel
zebrasrv 2600/tcp # zebra service
zebra 2601/tcp # zebra vty
ripd 2602/tcp # ripd vty (zebra)
ripngd 2603/tcp # ripngd vty (zebra)
ospfd 2604/tcp # ospfd vty (zebra)
bgpd 2605/tcp # bgpd vty (zebra)
ospf6d 2606/tcp # ospf6d vty (zebra)
ospfapi 2607/tcp # OSPF-API
isisd 2608/tcp # ISISd vty (zebra)
fax 4557/tcp # FAX transmission service (old)
hylafax 4559/tcp # HylaFAX client-server protocol (new)
munin 4949/tcp lrrd # Munin
rplay 5555/udp # RPlay audio service
nrpe 5666/tcp # Nagios Remote Plugin Executor
nsca 5667/tcp # Nagios Agent - NSCA
canna 5680/tcp # cannaserver
syslog-tls 6514/tcp # Syslog over TLS [RFC5425]
sane-port 6566/tcp sane saned # SANE network scanner daemon
ircd 6667/tcp # Internet Relay Chat
zope-ftp 8021/tcp # zope management by ftp
tproxy 8081/tcp # Transparent Proxy
omniorb 8088/tcp # OmniORB
clc-build-daemon 8990/tcp # Common lisp build daemon
xinetd 9098/tcp
git 9418/tcp # Git Version Control System
zope 9673/tcp # zope server
webmin 10000/tcp
kamanda 10081/tcp # amanda backup services (Kerberos)
amandaidx 10082/tcp # amanda backup services
amidxtape 10083/tcp # amanda backup services
sgi-cmsd 17001/udp # Cluster membership services daemon
sgi-crsd 17002/udp
sgi-gcd 17003/udp # SGI Group membership daemon
sgi-cad 17004/tcp # Cluster Admin daemon
binkp 24554/tcp # binkp fidonet protocol
asp 27374/tcp # Address Search Protocol
asp 27374/udp
csync2 30865/tcp # cluster synchronization tool
dircproxy 57000/tcp # Detachable IRC Proxy
tfido 60177/tcp # fidonet EMSI over telnet
fido 60179/tcp # fidonet EMSI over TCP
# Local services
@@ -0,0 +1 @@
Banner /etc/banner
+1
View File
@@ -0,0 +1 @@
%wheel ALL=(ALL:ALL) NOPASSWD: ALL
@@ -1 +1,2 @@
net.core.fb_tunnels_only_for_init_net=2
net.core.rmem_max=1000000
@@ -0,0 +1 @@
local1.* -/var/log/container
@@ -1 +0,0 @@
local7.* -/var/log/profinet.log
@@ -0,0 +1 @@
local0.* -/var/log/upgrade.log
@@ -1 +1,3 @@
d /var/lib/chrony 0755 chrony chrony
d /var/lib/chrony 0750 chrony chrony
d /run/chrony 0750 chrony chrony
d /run/chrony/dhcp-sources.d 0755 chrony chrony
@@ -1,31 +0,0 @@
#!/bin/sh
set -e
PATH=/lib/infix/factory:$PATH
[ "$FACTORY_D" ] || FACTORY_D=/etc/auto-factory.d
[ "$CFG_D" ] || CFG_D=/cfg
[ "$GENCFG_D" ] || GENCFG_D=/cfg/factory.d
mkdir -p $GENCFG_D
gen-hostname >$FACTORY_D/20-auto-hostname.json
gen-interfaces >$FACTORY_D/20-auto-interfaces.json
[ -s $GENCFG_D/20-auto-hostkey.json ] || gen-hostkeys >$GENCFG_D/20-auto-hostkey.json
# shellcheck disable=SC2046
jq -s 'reduce .[] as $item ({}; . * $item)' \
$(find $FACTORY_D -name '*.json') \
$(find $GENCFG_D -name '*.json') \
>$CFG_D/auto-factory-config.cfg
# TODO: Look for statically defined factory-config, based on the
# system's product ID.
# If we haven't found a better one, settle for auto-factory-config as
# the system's factory-config.
[ -h $CFG_D/factory-config.cfg ] || \
ln -sf auto-factory-config.cfg $CFG_D/factory-config.cfg
# Bootstrap sysrepo db with all modules required by confd
sysrepo-bootstrap.sh $CFG_D/factory-config.cfg $CFG_D/startup-config.cfg
@@ -1,47 +0,0 @@
#!/bin/sh
set -e
gen_interface()
{
cat <<EOF
,{
"name": "$1",
"type": "iana-if-type:ethernetCsmacd",
"ietf-ip:ipv6": {
"enabled": true,
"forwarding": false,
"dup-addr-detect-transmits": 1,
"autoconf": {
"create-global-addresses": true
}
}
}
EOF
}
phys_ifaces=$(ip -d -j link show | jq -r '
.[] |
select(.link_type == "ether") |
select(has("linkinfo") | not) |
.ifname')
cat <<EOF
{
"ietf-interfaces:interfaces": {
"interface": [
{
"name": "lo",
"type": "iana-if-type:softwareLoopback",
"ietf-ip:ipv4": {
"address": [{ "ip": "127.0.0.1", "prefix-length": 8 }]
},
"ietf-ip:ipv6": {
"address": [{ "ip": "::1", "prefix-length": 128 }]
}
}
$(for iface in $phys_ifaces; do gen_interface $iface; done)
]
}
}
EOF
@@ -1,9 +0,0 @@
#!/bin/sh
for type in ecdsa ed25519 rsa; do
[ -f /var/lib/ssh/ssh_host_${type}_key ] \
|| ssh-keygen -N "" -t $type -f /var/lib/ssh/ssh_host_${type}_key \
|| exit 1
done
initctl cond set ssh-hostkeys
@@ -17,10 +17,37 @@
set -e
nm=$(basename $0)
nm=$(basename "$0")
err=0
opt="-k"
# External button or bootloader changed kernel command line
check_factory()
{
if [ -f /mnt/cfg/infix/.reset ]; then
return 0;
fi
if grep -q 'finit.cond=factory-reset' /proc/cmdline; then
return 0;
fi
# Add to your br2-external to extend factory-reset check
if [ ! -x /libexec/infix/check-factory ]; then
return 1;
fi
/libexec/infix/check-factory
}
factory_reset()
{
# XXX: flash LEDs to confirm factory-reset in progress
logger $opt -p user.crit -t "$nm" "Resetting to factory defaults."
rm -rf /mnt/cfg/* /mnt/var/*
sync
}
mount_rw()
{
# If something is already setup, leave it be.
@@ -60,6 +87,10 @@ mount_overlay()
mkdir -p -m 0755 "$u"
mkdir -p -m 0755 "$w"
# Ensure that all users in wheel can create the .reset file
# on /cfg and upload docker images to /var
chgrp wheel "$(dirname "$u")"
mount -t overlay "$tag-overlay" "$dst" \
-o lowerdir="$dst",upperdir="$u",workdir="$w"
}
@@ -78,12 +109,8 @@ varsrc=/mnt/var
if ! mount_rw var >/dev/null 2>&1; then
logger $opt -p user.warn -t "$nm" \
"No persistent storage found for /var, only /var/lib is persisted."
varsrc=/mnt/tmp
varsrc=/mnt/tmp/infix/var
vlibsrc=/mnt/cfg/vlib
else
mount_bind "$varsrc" /var
varsrc=
vlibsrc=
fi
cfgsrc=/mnt/cfg
@@ -100,35 +127,23 @@ if ! mount_rw cfg >/dev/null 2>&1; then
# there's no point in overlaying one ramdisk on top of another.
vlibsrc=
else
# Check for factory reset
if [ -f /mnt/cfg/infix/.reset ]; then
logger $opt -p user.crit -t "$nm" "Resetting to factory defaults."
rm -rf /mnt/cfg/infix /mnt/var/infix
sync
fi
# Check build: NETCONF or Classic
# Classic Infix has read-write /etc across boots
if [ "$VARIANT_ID" != "netconf" ]; then
etcsrc=/mnt/cfg
fi
# Ensure that all users in wheel can create the .reset file
mkdir -p /mnt/cfg/infix
chgrp wheel /mnt/cfg/infix
fi
mount_overlay cfg $cfgsrc /cfg
mount_overlay etc $etcsrc /etc
mount_overlay home $cfgsrc /home
mount_overlay root $cfgsrc /root
if check_factory; then
factory_reset
fi
[ "$varsrc" ] && mount_overlay var "$varsrc" /var
[ "$vlibsrc" ] && mount_bind "$vlibsrc" /var/lib
mount_overlay cfg "$cfgsrc" /cfg
mount_overlay etc "$etcsrc" /etc
mount_overlay home "$cfgsrc" /home
mount_overlay root "$cfgsrc" /root
mount_bind "$varsrc" /var
# Keep transient configs in a ramdisk and symlink out to /cfg for
# startup.
mkdir -p /mnt/tmp/infix/db
ln -s /cfg/startup_db /mnt/tmp/infix/db/startup_db
[ "$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
@@ -25,19 +25,14 @@ for netif in /sys/class/net/*; do
dsa="dsa$num"
logger -k -p user.notice -t "$ident" "Found DSA interface, renaming $iface -> $dsa"
ip link set dev "$iface" name $dsa
ip link set dev "$iface" name $dsa group internal
num=$((num + 1))
done
# Find and mark all switch ports
ports=$(devlink port 2>/dev/null | awk '/flavour physical/{print $5}')
for iface in $ports; do
ip link set "$iface" group port
done
# Testing, e.g., using /etc/mactab may use TAP devices to create
# emulated switch ports, make sure to mark them as well
ports=$(ip -json link | jq -r '.[].ifname | match("^e[[:digit:]]+").string')
ports=$(devlink -j port | jq -r '.port[]
| select(.flavour == "physical")
| .netdev')
for iface in $ports; do
ip link set "$iface" group port
done
@@ -4,11 +4,14 @@
# existing interfaces. This syncs the default settings to all known
# interfaces at boot, such that physical interfaces will start from
# the same point as virtual ones.
tmp=$(mktemp)
sysctl net.ipv4.conf.default >/tmp/sysctl-ip-default
sysctl net.ipv6.conf.default >>/tmp/sysctl-ip-default
sysctl net.ipv4.conf.default >$tmp
sysctl net.ipv6.conf.default >>$tmp
for iface in $(ip -j link show | jq -r .[].ifname); do
sed -e "s/.default./.${iface}./g" /tmp/sysctl-ip-default \
| sysctl -p -
sed -e "s/.default./.${iface}./g" $tmp | sysctl -p -
done
rm $tmp
+1 -1
View File
@@ -7,7 +7,7 @@ inform()
local level="$1"
shift
logger -p "daemon.$level" -t dagger -c $LOGGER_STDOUT "$@"
logger -p "daemon.$level" -I $PPID -t dagger -c $LOGGER_STDOUT "$@"
}
abort()
+1 -1
View File
@@ -1 +1 @@
nano
/etc/alternatives/editor
+1 -1
View File
@@ -1 +1 @@
nano
/etc/alternatives/editor
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
# Helper script to chronyc, checks if daemon is running
if ! chronyc serverstats >/dev/null; then
echo "NTP client not enabled."
exit 1
fi
case $1 in
tracking)
chronyc tracking
;;
sources)
chronyc sources -v
;;
*)
echo "Unknown NTP command."
;;
esac
+590
View File
@@ -0,0 +1,590 @@
#!/bin/sh
all=""
env=""
port=""
force=
log()
{
logger -I $PPID -t container -p local1.notice -- "$*"
}
# 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.
unpack_archive()
{
image=$1
name=$2
# Supported transports for load and create
case "$image" in
oci:*) # Unpacked OCI image
file=${image#oci:}
;;
oci-archive:*) # Packed OCI image, .tar or .tar.gz format
file=${image#oci-archive:}
;;
*) # docker://*, docker-archive:*, or URL
echo "$image"
return 0
;;
esac
if [ ! -e "$file" ]; then
if [ -e "/var/lib/conatainers/oci/$file" ]; then
file="/var/lib/conatainers/oci/$file"
elif [ -e "/lib/oci/$file" ]; then
file="/lib/oci/$file"
else
log "Error: cannot find OCI archive $file in search path."
exit 1
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
fi
else
index=$(tar tf "$file" |grep index.json)
if [ -z "$index" ]; then
log "Error: invalid OCI archive, cannot find index.json in $file"
exit 1
fi
[ -n "$quiet" ] || log "Extracting OCI archive $file ..."
tar xf "$file" || (log "Error: failed unpacking $file in $(pwd)"; exit 1)
fi
dir=$(dirname "$index")
[ -n "$quiet" ] || log "Loading OCI image $dir ..."
podman load -qi "$dir" >/dev/null
# Rename image from podman default $dir:latest
if [ -n "$name" ]; then
podman tag "$dir" "$name" >/dev/null
podman rmi "$dir" >/dev/null
else
name=$dir
fi
echo "$name"
}
running()
{
run=$(podman inspect "$1" 2>/dev/null |jq .[].State.Running)
[ "$run" = "true" ] && return 0
return 1
}
# shellcheck disable=SC2086
create()
{
name=$1
image=$2
shift 2
if [ -z "$name" ] || [ -z "$image" ]; then
echo "Usage:"
echo " container create NAME IMAGE"
exit 1
fi
# 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"
fi
args="$args --cgroup-parent=containers"
args="$args --restart=$restart --systemd=false --tz=local $privileged --replace --quiet"
args="$args $ro $vol $mount $hostname $entrypoint $env $port $logging"
pidfn=/run/container:${name}.pid
[ -n "$quiet" ] || log "---------------------------------------"
[ -n "$quiet" ] || log "Got name: $name image: $image"
[ -n "$quiet" ] || log "Got networks: $network"
if [ -n "$network" ]; then
for net in $network; do
args="$args --net=$net"
done
for srv in $dns; do
args="$args --dns=$srv"
done
for domain in $search; do
args="$args --dns-search=$domain"
done
else
network="--net none"
fi
# shellcheck disable=SC2048
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 "$manual" ] || start "$name"
exit 0
fi
log "Error: failed creating container $name, please check the configuration."
exit 1
}
delete()
{
name=$1
image=$2
if [ -z "$name" ]; then
echo "Usage:"
echo " container delete NAME"
exit 1
fi
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
fi
sleep 1;
done
}
start()
{
name=$1
if running "$name"; then
[ -n "$quiet" ] || echo "$name: already running."
return
fi
initctl -bq cond set "container:$name"
# Real work is done by wrap() courtesy of finit sysv emulation
}
stop()
{
name=$1
if ! running "$name"; then
[ -n "$quiet" ] || echo "$name: not running."
return
fi
initctl -bq cond clr "container:$name"
# Real work is done by wrap() courtesy of finit sysv emulation
}
wrap()
{
name=$1
cmd=$2
podman "$cmd" "$name"
}
# Removes network $1 from all containers
netwrm()
{
net=$1
for c in $(podman ps $all --format "{{.Names}}"); do
for n in $(podman inspect "$c" |jq -r '.[].NetworkSettings.Networks | keys[]'); do
if [ "$n" = "$net" ]; then
podman network disconnect $force "$n" "$c" >/dev/null
fi
done
done
}
usage()
{
cat <<EOF
usage:
container [opt] cmd [arg]
options:
-a, --all Show all, of something
--dns NAMESERVER Set nameserver(s) when creating a container
--dns-search LIST Set host lookup search list when creating container
-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
--entrypoint Disable container image's ENTRYPOINT, run cmd + arg
-f, --force Force operation, e.g. remove
-h, --help Show this help text
--hostname NAME Set hostname when creating container
--net NETWORK Network interface(s) when creating or finding container
-l, --log-driver DRV Log driver to use
--log-opt OPT Logging options to log driver
--log-path PATH Path for k8s-file log pipe
-m, --mount HOST:DEST Bind mount a read-only file inside a container
--manual Do not start container automatically after creation
-n, --name NAME Alternative way of supplying name to start/stop/restart
--privileged Give container extended privileges
-p, --publish PORT Publish ports when creating container
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
-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
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
list [image | oci] List names (only) of containers, images, or OCI archives
load [NAME | URL] NM Load OCI tarball fileNAME or URL to image NM
remove IMAGE Remove an (unused) container image
restart [NAME] Restart a crashed container
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]
shell Start a shell inside a container
show [image | volume] Show containers, images, or volumes
stat Show continuous stats about containers (Ctrl-C aborts)
start [NAME] Start a container, see -n
stop [NAME] Stop a container, see -n
volume [prune] Prune unused volumes
EOF
}
while [ "$1" != "" ]; do
case $1 in
-a | --all)
all="-a"
;;
-c | --creds)
shift
creds="-u $1"
;;
-d | --detach)
detach="-d"
;;
--dns)
shift
dns="$dns $1"
;;
--dns-search)
shift
search="$search $1"
;;
-e | --env)
shift
env="$env --env-file=$1"
;;
--entrypoint)
entrypoint="--entrypoint=\"\""
;;
-f | --force)
force="-f"
;;
-h | --help)
usage
exit 0
;;
--hostname)
shift
hostname="--hostname $1"
;;
-l | --log-driver)
shift
logging=" --log-driver=$1"
;;
--log-opt)
shift
logging="$logging --log-opt $1"
;;
--log-path)
shift
logging="$logging --log-opt path=$1"
log_path="$1"
;;
-m | --mount)
shift
mount="--mount=$1"
;;
--manual)
manual=true
;;
-n | --name)
shift
name="$1"
;;
--net)
shift
if [ -n "$network" ]; then
network="$network $1"
else
network=$1
fi
;;
--privileged)
privileged="--privileged=true"
;;
-p | --publish)
shift
port="$port -p $1"
;;
-q | --quiet)
quiet="-q"
;;
-r | --restart)
shift
restart=$1
;;
--read-only)
ro="--read-only=true"
;;
-s | --simple)
simple=true
;;
-v | --volume)
shift
vol="$vol -v $1"
;;
*)
break
;;
esac
shift
done
cmd=$1
if [ -n "$cmd" ]; then
shift
fi
case $cmd in
# Does not work atm., cannot attach to TTY because
# we monitor 'podman start -ai foo' with Finit.
# attach)
# podman attach "$1"
# ;;
create)
[ -n "$quiet" ] || log "Got create args: $*"
create "$@"
;;
delete)
cmd=$1
name=$2
if [ "$cmd" = "network" ] && [ -n "$name" ]; then
netwrm "$name"
else
delete "$@"
fi
;;
exec)
podman exec -it "$@"
;;
find)
cmd=$1
pid=$2
if [ "$cmd" = "ifname" ] && [ -n "$pid" ]; then
nsenter -t "$pid" -n ip -d -j link | \
jq --arg ifname "$network" -r '.[] | select(.ifalias==$ifname) | .ifname'
else
containers=$(podman ps $all --format "{{.Names}}")
for c in $containers; do
json=$(podman inspect "$c")
nets=$(echo "$json" |jq -r '.[].NetworkSettings.Networks | keys[]' 2>/dev/null)
for n in $nets; do
if [ "$network" = "$n" ]; then
pid=$(echo "$json" | jq .[].State.Pid)
echo "$pid"
exit 0
fi
done
done
fi
;;
help)
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)
# Show resulting image(s) matching $name
if [ -n "$name" ]; then
podman images -n "$name"
else
exit 1
fi
;;
ls | list)
cmd=$1
[ -n "$cmd" ] && shift
case $cmd in
image*)
podman images $all --format "{{.Repository}}:{{.Tag}}"
;;
oci)
find /lib/oci /var/lib/containers/oci -type f 2>/dev/null
;;
*)
podman ps $all --format "{{.Names}}"
;;
esac
;;
pull)
podman pull "$@"
;;
remove)
podman rmi $all $force -i "$1"
;;
run)
img=$1
cmd=$2
[ -n "$port" ] || port="-P"
if [ -n "$cmd" ]; then
shift 2
[ -n "$detach" ] || echo "Starting $img ENTRYPOINT $cmd :: use Ctrl-p Ctrl-q to detach"
podman run -it --rm $detach $port --entrypoint="$cmd" "$img" "$@"
else
[ -n "$detach" ] || echo "Starting $img :: use Ctrl-p Ctrl-q to detach"
podman run -it --rm $detach $port "$img"
fi
;;
save)
name=$1
file=$2
if echo "$file" | grep -q ".gz"; then
file=${file%%.gz}
gzip=true
fi
if ! echo "$file" | grep -q ".tar"; then
file=${file}.tar
gzip=true
fi
podman save -o "$file" "$name"
if [ -s "$file" ] && [ -n "$gzip" ]; then
gzip "$file"
fi
;;
shell)
podman exec -it "$1" sh -l
;;
show)
cmd=$1
[ -n "$cmd" ] && shift
case $cmd in
image*)
if [ -n "$simple" ]; then
podman images $all --format "{{.Names}} {{.Size}}" \
| sed 's/\[\(.*\)\] /\1 /g' \
| awk '{ printf "%-60s %s %s\n", $1, $2, $3}'
else
podman images $all
fi
;;
volume*)
printf "%-20s CONTAINER\n" "VOLUME"
for v in $(podman volume ls --format "{{.Name}}"); do
printf "%-20s" "$v"
podman ps -a --filter volume="$v" --format '{{.Names}}' | sed 's/^/ /'
done
;;
*)
if [ -n "$simple" ]; then
podman ps $all --format "{{.ID}} {{.Names}} {{.Image}}" \
| awk '{ printf "%s %-30s %s\n", $1, $2, $3}'
else
podman ps $all
fi
;;
esac
;;
start)
if [ -n "$name" ]; then
wrap "$name" start
elif [ -n "$1" ]; then
start "$1"
else
usage
exit 1
fi
;;
restart)
if [ -n "$name" ]; then
wrap "$name" restart
elif [ -n "$1" ]; then
stop "$1"
start "$1"
else
usage
exit 1
fi
;;
stop)
if [ -n "$name" ]; then
wrap "$name" stop
elif [ -n "$1" ]; then
stop "$1"
else
usage
exit 1
fi
;;
stat*)
podman stats -i 2
;;
upgrade)
img=$(podman inspect "$1" | jq -r .[].ImageName)
if [ -z "$img" ]; then
echo "No such container ($1), or invalid ImageName. Cannot upgrade."
exit 1;
fi
podman stop "$1"
podman pull "$img" || (echo "Failed fetching $img, check your network (settings)."; exit 1)
"/var/lib/containers/active/${1}.sh" || (echo "Failed recreating container $1"; exit 1)
;;
volume)
cmd=$1
[ -n "$cmd" ] && shift
case $cmd in
prune)
podman volume $force prune
;;
*)
false
;;
esac
;;
*)
usage
exit 1
;;
esac
+162
View File
@@ -0,0 +1,162 @@
#!/bin/sh
# This script expect a system with resolvconf (openresolv) and iproute2
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
ACTION="$1"
IP_CACHE="/var/lib/misc/${interface}.cache"
RESOLV_CONF="/run/resolvconf/interfaces/${interface}.conf"
NTPFILE="/run/chrony/dhcp-sources.d/${interface}.sources"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] || subnet=32
[ -n "$metric" ] || metric=100
# Handle stateful DHCPv6 like DHCPv4
[ -n "$ipv6" ] && ip="$ipv6/128"
if [ -z "${IF_WAIT_DELAY}" ]; then
IF_WAIT_DELAY=10
fi
log()
{
logger -I $$ -t udhcpc -p user.notice "$*"
}
wwait_for_ipv6_default_route()
{
log "waiting for IPv6 default route to be installed."
while [ $IF_WAIT_DELAY -gt 0 ]; do
if ip -6 route list proto dhcp dev $interface | grep -q default; then
return
fi
sleep 1
printf "."
: $((IF_WAIT_DELAY -= 1))
done
log "Timed out witing for IPv6 default route!"
}
# RFC3442: If the DHCP server returns both a Classless
# Static Routes option and a Router option, the DHCP
# client MUST ignore the Router option.
set_dhcp_routes()
{
if [ -n "$staticroutes" ]; then
# 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"
ip route add "$1" via "$2" dev $interface metric $metric proto dhcp
shift 2
done
elif [ -n "$router" ] ; then
for i in $router ; do
ip route add default via $i dev $interface metric $((metric++)) proto dhcp
done
fi
}
clr_dhcp_routes()
{
log "deleting DHCP routes from $interface"
ip route show proto dhcp dev $interface | while read rt via nh dev dev; do
log "removing $rt nh $nh on $dev"
ip route del $rt via $nh dev $dev proto dhcp
done
}
clr_dhcp_addresses()
{
addrs=$(ip -j addr show dev $interface \
| jq -c '.[0].addr_info[] | select(.family == "inet") | select(.protocol == "dhcp")')
for addr in $addrs; do
ip="$(echo "$addr" | jq -r '."local"')"
prefix="$(echo "$addr" | jq -r '."prefixlen"')"
log "removing $ip/$prefix from $interface"
ip addr del "$ip/$prefix" dev "$interface"
done
}
log "action $ACTION"
case "$ACTION" in
deconfig)
clr_dhcp_addresses
clr_dhcp_routes
/bin/ip link set dev $interface up
# drop info from this interface
rm -f "$RESOLV_CONF"
rm -f "$NTPFILE"
if [ -x /usr/sbin/avahi-autoipd ]; then
/usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface
fi
;;
leasefail|nak)
if [ -x /usr/sbin/avahi-autoipd ]; then
/usr/sbin/avahi-autoipd -c $interface || /usr/sbin/avahi-autoipd -wD $interface --no-chroot
fi
;;
renew|bound)
if [ -x /usr/sbin/avahi-autoipd ]; then
/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
echo "$ip" > "$IP_CACHE"
fi
if [ -n "$ipv6" ] ; then
wait_for_ipv6_default_route
fi
clr_dhcp_routes
set_dhcp_routes
# set hostname if given
if [ -n "$hostname" ]; then
log "setting new hostname: $hostname"
hostname "$hostname"
augtool -s "set /files/etc/hosts/*[ipaddr='127.0.1.1']/canonical $hostname"
fi
# drop info from this interface
truncate -s 0 "$RESOLV_CONF"
# prefer rfc3397 domain search list (option 119) if available
if [ -n "$search" ]; then
search_list=$search
elif [ -n "$domain" ]; then
search_list=$domain
fi
if [ -n "$search_list" ]; then
log "adding search $search_list"
echo "search $search_list # $interface" >> $RESOLV_CONF
fi
for i in $dns ; do
log "adding dns $i"
echo "nameserver $i # $interface" >> $RESOLV_CONF
resolvconf -u
done
if [ -n "$ntpsrv" ]; then
truncate -s 0 "$NTPFILE"
for srv in $ntpsrv; do
log "got NTP server $srv"
echo "server $srv iburst" >> "$NTPFILE"
done
chronyc reload sources >/dev/null
fi
esac
HOOK_DIR="$0.d"
for hook in "${HOOK_DIR}/"*; do
[ -f "${hook}" -a -x "${hook}" ] || continue
"${hook}" "$ACTION"
done
exit 0
+5 -1
View File
@@ -8,9 +8,13 @@
&env {
vendor = "infix";
bootdelay = "-2";
bootcmd = "run ixboot";
bootcmd = "run ixbtn";
boot_targets = "virtio mmc";
ixbtn = /incbin/("scripts/ixbtn.sh");
ixdevmode = /incbin/("scripts/ixdevmode.sh");
ixfactory = /incbin/("scripts/ixfactory.sh");
ixbtn = /incbin/("scripts/ixbtn.sh");
ixboot = /incbin/("scripts/ixboot.sh");
ixbootmedia = /incbin/("scripts/ixbootmedia.sh");
ixbootslot = /incbin/("scripts/ixbootslot.sh");

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