Compare commits

...
Author SHA1 Message Date
Tobias Waldekranz bc064c53f3 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-09 21:16:15 +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
186 changed files with 16944 additions and 1321 deletions
+9 -5
View File
@@ -16,7 +16,7 @@ jobs:
variant: [netconf, classic]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set Build Variables
id: vars
run: |
@@ -28,7 +28,7 @@ jobs:
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-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
@@ -37,7 +37,7 @@ jobs:
dl-${{ matrix.platform }}-
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') }}
@@ -65,9 +65,10 @@ jobs:
if: matrix.platform == 'x86_64' && matrix.variant == 'netconf'
run: |
make test-qeneth
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: output/${{ steps.vars.outputs.tgz }}
name: artifact-${{ matrix.variant }}-${{ matrix.platform }}
release:
if: ${{github.repository_owner == 'kernelkit' && github.ref_name == 'main'}}
name: Upload Latest Build
@@ -76,7 +77,10 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
pattern: "artifact-*"
merge-multiple: true
- uses: ncipollo/release-action@v1
with:
allowUpdates: true
+5 -2
View File
@@ -1,6 +1,8 @@
name: Coverity Scan
on:
schedule:
- cron: '5 0 * * *'
workflow_dispatch:
env:
@@ -9,6 +11,7 @@ env:
jobs:
coverity:
if: ${{github.repository_owner == 'kernelkit'}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -21,7 +24,7 @@ jobs:
--post-data "token=$TOKEN&project=${PROJECT_NAME}&md5=1" \
-O coverity-latest.tar.gz.md5
echo "md5=$(cat coverity-latest.tar.gz.md5)" | tee -a $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
id: cache
with:
path: coverity-latest.tar.gz
@@ -75,7 +78,7 @@ jobs:
--form description="${PROJECT_NAME} $(git rev-parse HEAD)" \
https://scan.coverity.com/builds?project=${PROJECT_NAME}
- name: Upload build.log
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverity-build.log
path: cov-int/build-log.txt
+8 -4
View File
@@ -18,7 +18,7 @@ jobs:
name: Regression Testing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Set Build Variables
@@ -28,7 +28,7 @@ jobs:
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') }}
@@ -37,7 +37,7 @@ jobs:
dl-x86_64-
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') }}
@@ -48,6 +48,10 @@ jobs:
- name: Configure NETCONF
run: |
make x86_64_defconfig
- name: Unit Test
run: make test-unit
- name: Build
run: |
make
@@ -58,7 +62,7 @@ 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 }}
+10 -6
View File
@@ -28,7 +28,7 @@ jobs:
variant: [netconf, classic]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set Release Variables
id: build
run: |
@@ -52,7 +52,7 @@ jobs:
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-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
@@ -61,7 +61,7 @@ jobs:
dl-${{ matrix.platform }}-
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') }}
@@ -87,16 +87,20 @@ jobs:
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
- uses: actions/upload-artifact@v4
with:
path: output/${{ steps.build.outputs.tgz }}
name: artifact-${{ matrix.variant }}-${{ matrix.platform }}
release:
name: Release Infix ${{ github.ref_name }}
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: "artifact-*"
merge-multiple: true
- name: Extract ChangeLog entry ...
run: |
awk '/^-----*$/{if (x == 1) exit; x=1;next}x' doc/ChangeLog.md \
+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
+4 -1
View File
@@ -1,4 +1,5 @@
[![License Badge][]][License] [![Coverity Status][]][Coverity Scan]
[![License Badge][]][License] [![Coverity Status][]][Coverity Scan] [![Discord][discord-badge]][discord-url]
<img align="right" src="doc/logo.png" alt="Infix - Linux <3 NETCONF" width=480 border=10>
<details><summary><b>Documentation</b></summary>
@@ -98,3 +99,5 @@ more information, see: [Infix in Virtual Environments](doc/virtual.md).
[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
+12 -48
View File
@@ -6,6 +6,7 @@
* Device tree for Alder board
*/
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
@@ -195,53 +196,6 @@
};
/* CP SDHCI (Micro-SD) */
/ {
cp0_reg_sd_vccq: cp0_sd_vccq@0 {
compatible = "regulator-gpio";
regulator-name = "cp0_sd_vccq";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <3300000>;
/* gpios = <&CP_SD_HST_18_EN>; */
states = <1800000 0x1
3300000 0x0>;
};
cp0_reg_sd_vcc: cp0_sd_vcc@0 {
compatible = "regulator-fixed";
regulator-name = "cp0_sd_vcc";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
/* gpio = <&CP_SD_CRD_PWR_OFF>; */
enable-active-high;
regulator-always-on;
};
};
&cp0_pinctrl {
cp0_sdhci_pins: cp0-sdhi-pins-0 {
marvell,pins = \
CP_SD_CRD_PWR_OFF(MPP_ID), CP_SD_HST_18_EN(MPP_ID), \
CP_SD_CRD_DT(MPP_ID), CP_SD_LED(MPP_ID), \
CP_SD_CLK(MPP_ID), CP_SD_CMD(MPP_ID), \
CP_SD_D0(MPP_ID), CP_SD_D1(MPP_ID), \
CP_SD_D2(MPP_ID), CP_SD_D3(MPP_ID);
marvell,function = "sdio";
};
};
&cp0_sdhci0 {
status = "disabled";
pinctrl-names = "default";
pinctrl-0 = <&cp0_sdhci_pins>;
bus-width = <4>;
/* cd-gpios = <&CP_SD_CRD_DT>; */
vqmmc-supply = <&cp0_reg_sd_vccq>;
vmmc-supply = <&cp0_reg_sd_vcc>;
};
/* SPI1 (Boot FLASH) */
&cp0_pinctrl {
@@ -647,9 +601,19 @@
};
};
/* 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";
+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 {
+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
@@ -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
+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
+1 -1
View File
@@ -208,7 +208,7 @@ vpd_args()
cat <<EOF | "$onieprom" -e >"$vpd_file"
{
"manufacture-date": "$(date +"%d/%m/%Y %H:%M:%S")",
"manufacture-date": "$(date +"%m/%d/%Y %H:%M:%S")",
"vendor-extension": [
[
61046,
@@ -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,3 +1,3 @@
run [S] log:console /lib/infix/probe -- Probing system information
run [S] <pid/syslogd> /lib/infix/sysctl-sync-ip-conf --
run [S] <pid/syslogd> /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
+2 -2
View File
@@ -12,11 +12,11 @@ debugfs /sys/kernel/debug debugfs nofail 0 0
cfgfs /config configfs nofail,noauto 0 0
# The chosen backing storage for the overlays placed on /cfg, /etc,
# /home, /root, and /var, are determined dynamically by /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
+4
View File
@@ -0,0 +1,4 @@
.-------.
| . . | Infix -- a Network Operating System
|-. v .-| https://kernelkit.github.io
'-'---'-'
+1
View File
@@ -0,0 +1 @@
%wheel ALL=(ALL:ALL) NOPASSWD: ALL
@@ -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
@@ -33,11 +33,11 @@ check_factory()
fi
# Add to your br2-external to extend factory-reset check
if [ ! -x /lib/infix/check-factory ]; then
if [ ! -x /libexec/infix/check-factory ]; then
return 1;
fi
/lib/infix/check-factory
/libexec/infix/check-factory
}
factory_reset()
+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()
+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
@@ -1,14 +1,16 @@
#!/bin/sh
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
# This script expect a system with resolvconf (openresolv) and iproute2
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
ACTION="$1"
RESOLV_CONF="/etc/resolv.conf"
[ -e $RESOLV_CONF ] || touch $RESOLV_CONF
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" ] && NETMASK="$subnet"
[ -n "$subnet" ] || subnet=32
[ -n "$metric" ] || metric=100
# Handle stateful DHCPv6 like DHCPv4
[ -n "$ipv6" ] && ip="$ipv6/128"
@@ -16,113 +18,139 @@ if [ -z "${IF_WAIT_DELAY}" ]; then
IF_WAIT_DELAY=10
fi
wait_for_ipv6_default_route() {
printf "Waiting for IPv6 default route to appear"
while [ $IF_WAIT_DELAY -gt 0 ]; do
if ip -6 route list | grep -q default; then
printf "\n"
return
fi
sleep 1
printf "."
: $((IF_WAIT_DELAY -= 1))
done
printf " timeout!\n"
log()
{
logger -I $$ -t udhcpc -p user.notice "$*"
}
flush_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"')"
ip addr del "$ip/$prefix" dev "$interface"
done
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)
flush_dhcp_addresses
deconfig)
clr_dhcp_addresses
clr_dhcp_routes
/bin/ip link set dev $interface up
/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
;;
# drop info from this interface
# resolv.conf may be a symlink to /tmp/, so take care
TMPFILE=$(mktemp)
grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
cat $TMPFILE > $RESOLV_CONF
rm -f $TMPFILE
leasefail|nak)
if [ -x /usr/sbin/avahi-autoipd ]; then
/usr/sbin/avahi-autoipd -c $interface || /usr/sbin/avahi-autoipd -wD $interface --no-chroot
fi
;;
if [ -x /usr/sbin/avahi-autoipd ]; then
/usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface
fi
;;
renew|bound)
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
;;
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
renew|bound)
if [ -x /usr/sbin/avahi-autoipd ]; then
/usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface
fi
/bin/ip addr add dev $interface $ip/$NETMASK $BROADCAST proto 5
if [ -n "$ipv6" ] ; then
wait_for_ipv6_default_route
fi
clr_dhcp_routes
set_dhcp_routes
# RFC3442: If the DHCP server returns both a Classless
# Static Routes option and a Router option, the DHCP
# client MUST ignore the Router option.
if [ -n "$staticroutes" ]; then
echo "deleting routers"
route -n | while read dest gw mask flags metric ref use iface; do
[ "$iface" != "$interface" -o "$gw" = "0.0.0.0" ] || \
route del -net "$dest" netmask "$mask" gw "$gw" dev "$interface"
done
# 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
# format: dest1/mask gw1 ... destn/mask gwn
set -- $staticroutes
while [ -n "$1" -a -n "$2" ]; do
ip route add -net "$1" via "$2" dev "$interface" proto 16
shift 2
done
elif [ -n "$router" ] ; then
echo "deleting routers"
while route del default gw 0.0.0.0 dev $interface 2> /dev/null; do
:
done
# drop info from this interface
truncate -s 0 "$RESOLV_CONF"
for i in $router ; do
ip route add default via $i dev $interface proto 16
done
fi
# prefer rfc3397 domain search list (option 119) if available
if [ -n "$search" ]; then
search_list=$search
elif [ -n "$domain" ]; then
search_list=$domain
fi
# drop info from this interface
# resolv.conf may be a symlink to /tmp/, so take care
TMPFILE=$(mktemp)
grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
cat $TMPFILE > $RESOLV_CONF
rm -f $TMPFILE
if [ -n "$search_list" ]; then
log "adding search $search_list"
echo "search $search_list # $interface" >> $RESOLV_CONF
fi
# prefer rfc3397 domain search list (option 119) if available
if [ -n "$search" ]; then
search_list=$search
elif [ -n "$domain" ]; then
search_list=$domain
fi
for i in $dns ; do
log "adding dns $i"
echo "nameserver $i # $interface" >> $RESOLV_CONF
resolvconf -u
done
[ -n "$search_list" ] &&
echo "search $search_list # $interface" >> $RESOLV_CONF
for i in $dns ; do
echo adding dns $i
echo "nameserver $i # $interface" >> $RESOLV_CONF
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"
+2 -2
View File
@@ -1,3 +1,3 @@
#!/bin/bash -li
#!/bin/sh
# Source settings, aliases, and probe terminal size, then hand over to klish
exec /usr/bin/klish
exec env CLISH=yes bash -ilc /usr/bin/klish
@@ -1 +1,2 @@
alias cli='clish'
alias cfg='sysrepocfg -f json'
@@ -0,0 +1,7 @@
if [ -z "$CLISH" ]; then
cat <<EOF
Run the command 'cli' for interactive OAM
EOF
fi
+2 -1
View File
@@ -1,4 +1,5 @@
net.ipv6.conf.all.forwarding=0
net.ipv6.conf.all.forwarding=1
net.ipv6.conf.default.forwarding=0
net.ipv6.conf.all.autoconf=0
net.ipv6.conf.default.autoconf=0
net.ipv6.conf.default.keep_addr_on_down=1
@@ -18,7 +18,7 @@ class PadRoute:
prefix = 30
protocol = 10
next_hop = 30
metric = 10
pref = 8
class PadSoftware:
name = 10
@@ -55,30 +55,44 @@ def get_json_data(default, indata, *args):
return data
class Route:
def __init__(self,data):
def __init__(self,data,ip):
self.data = data
self.prefix = data.get('ietf-ipv4-unicast-routing:destination-prefix', '')
self.prefix = data.get(f'ietf-{ip}-unicast-routing:destination-prefix', '')
self.protocol = data.get('source-protocol','')[14:]
self.metric = data.get('route-preference','')
interface = get_json_data(None, self.data, 'next-hop', 'outgoing-interface')
address = get_json_data(None, self.data, 'next-hop', 'ietf-ipv4-unicast-routing:next-hop-address')
special = get_json_data(None, self.data, 'next-hop', 'special-next-hop')
if interface:
self.next_hop = interface
elif address:
self.next_hop = address
elif special:
self.next_hop = special
self.pref = data.get('route-preference','')
self.next_hop = []
next_hop_list=get_json_data(None, self.data, 'next-hop', 'next-hop-list')
if next_hop_list:
for nh in next_hop_list["next-hop"]:
if(nh.get(f"ietf-{ip}-unicast-routing:address")):
self.next_hop.append(nh[f"ietf-{ip}-unicast-routing:address"])
elif(nh.get("outgoing-interface")):
self.next_hop.append(nh["outgoing-interface"])
else:
self.next_hop.append("unspecified")
else:
self.next_hop = "unspecified"
interface = get_json_data(None, self.data, 'next-hop', 'outgoing-interface')
address = get_json_data(None, self.data, 'next-hop', f'ietf-{ip}-unicast-routing:next-hop-address')
special = get_json_data(None, self.data, 'next-hop', 'special-next-hop')
if address:
self.next_hop.append(address)
elif interface:
self.next_hop.append(interface)
elif special:
self.next_hop.append(special)
else:
self.next_hop.append("unspecified")
def print(self):
row = f"{self.prefix:<{PadRoute.prefix}}"
row += f"{self.next_hop:<{PadRoute.next_hop}}"
row += f"{self.metric:<{PadRoute.metric}}"
row += f"{self.next_hop[0]:<{PadRoute.next_hop}}"
row += f"{self.pref:>{PadRoute.pref}} "
row += f"{self.protocol:<{PadRoute.protocol}}"
print(row)
for nh in self.next_hop[1:]:
row = f"{'':<{PadRoute.prefix}}"
row += f"{nh:<{PadRoute.next_hop}}"
print(row)
class Software:
"""Software bundle class """
@@ -369,24 +383,24 @@ def ietf_interfaces(json, name):
sys.exit(1)
pr_interface_list(json)
def ietf_routing(json, protocol="ipv4"):
def ietf_routing(json, ip="ipv4"):
if not json.get("ietf-routing:routing"):
print(f"Error, top level \"ietf-routing:routing\" missing")
sys.exit(1)
routes = get_json_data({}, json, 'ietf-routing:routing','ribs', 'rib')[0]
routes = get_json_data(None, routes, "routes", "route")
hdr = (f"{'PREFIX':<{PadRoute.prefix}}"
f"{'NEXT-HOP':<{PadRoute.next_hop}}"
f"{'METRIC':<{PadRoute.metric}}"
f"{'PREF':>{PadRoute.pref}} "
f"{'PROTOCOL':<{PadRoute.protocol}}")
print(Decore.invert(hdr))
if routes:
for r in routes:
route = Route(r)
route.print()
for rib in get_json_data({}, json, 'ietf-routing:routing','ribs', 'rib'):
if rib["name"] != ip:
continue;
routes = get_json_data(None, rib, "routes", "route")
if routes:
for r in routes:
route = Route(r, ip)
route.print()
def find_slot(_slots, name):
for _slot in [Software(data) for data in _slots]:
+60
View File
@@ -0,0 +1,60 @@
#!/usr/bin/python3
# This script is used to transform the output from the show ip ospf commands and order
# them to match the ietf-ospf YANG model. For example, interfaces is ordered under
# area but FRR has areas in interfaces.
#
# This makes the parsing for the operational parts of YANG model more easy
#
import json
import subprocess
iface_out=subprocess.check_output("vtysh -c 'show ip ospf interface json'", shell=True)
ospf_out=subprocess.check_output("vtysh -c 'show ip ospf json'", shell=True)
neighbor_out=subprocess.check_output("vtysh -c 'show ip ospf neighbor detail json'", shell=True)
interfaces=json.loads(iface_out)
ospf=json.loads(ospf_out)
neighbors=json.loads(neighbor_out)
for ifname,iface in interfaces["interfaces"].items():
iface["name"] = ifname
iface["neighbors"] = []
for area_id in ospf["areas"]:
area_type=""
stub=False
if("NSSA" in iface["area"]):
iface_area_id = iface["area"][:-7]
area_type = "nssa-area"
elif("Stub" in iface["area"]):
iface_area_id = iface["area"][:-7]
iface["areaId"] = iface["area"][:-7]
area_type = "stub-area"
else:
iface_area_id = iface["area"]
area_type = "normal-area"
if(iface_area_id != area_id):
continue
ospf["areas"][area_id]["area-type"] = area_type
iface["area"] = iface_area_id
for nbrAddress,nbrDatas in neighbors["neighbors"].items():
for nbrData in nbrDatas:
nbrIfname=nbrData["ifaceName"].split(":")[0]
if(("NSSA" in nbrData.get("areaId", {})) or ("Stub" in nbrData.get("areaId", {}))):
nbrData["areaId"] = nbrData["areaId"][:-7]
if ((nbrIfname != ifname) and (area_id != nbrData.get("areaId"))):
#print(f'Continute {ifname} {nbrData.get("areaId")}')
continue
nbrData["neighborIp"] = nbrAddress
iface["neighbors"].append(nbrData)
if(not ospf["areas"][area_id].get("interfaces", None)):
ospf["areas"][area_id]["interfaces"] = []
ospf["areas"][area_id]["interfaces"].append(iface)
print(json.dumps(ospf))
@@ -63,7 +63,7 @@ ok
step "Formatting $blk"
[ -b $blk ] || { echo "$blk is not a block device" >&2; err; }
/lib/infix/prod/fdisk $blk || err
/libexec/infix/prod/fdisk $blk || err
sleep 1
ok
@@ -3,6 +3,8 @@
import subprocess
import json
import sys # (built-in module)
import argparse
from datetime import datetime
def json_get_yang_type(iface_in):
if iface_in['link_type'] == "loopback":
@@ -116,49 +118,233 @@ def iface_is_dsa(iface_in):
return False
return True
def add_ipv4_route(routes):
cmd = ['ip', '-4', '-s', '-d', '-j', 'route']
def get_vpd_vendor_extensions(data):
vendor_extensions=[]
for ext in data:
vendor_extension = {}
vendor_extension["iana-enterprise-number"] = ext[0]
vendor_extension["extension-data"] = ext[1]
vendor_extensions.append(vendor_extension)
return vendor_extensions
def get_vpd_data(vpd):
component={}
component["name"]=vpd.get("board")
component["infix-hardware:vpd-data"] = {}
if vpd.get("data"):
if vpd["data"].get("manufacture-date"):
component["mfg-date"]=datetime.strptime(vpd["data"]["manufacture-date"],"%m/%d/%Y %H:%M:%S").strftime("%Y-%m-%-dT%H:%M:%SZ")
if vpd["data"].get("manufacter"):
component["mfg-name"]=vpd["data"]["manufacturer"]
if vpd["data"].get("product-name"):
component["model-name"]=vpd["data"]["product-name"]
if vpd["data"].get("serial-number"):
component["serial-num"]=vpd["data"]["serial-number"]
# Set VPD-data entrys
for k,v in vpd["data"].items():
if vpd["data"].get(k):
if k != "vendor-extension":
component["infix-hardware:vpd-data"][k] = v
else:
vendor_extensions=get_vpd_vendor_extensions(v)
component["infix-hardware:vpd-data"]["infix-hardware:vendor-extension"] = vendor_extensions
return component
def add_hardware(hw_out, test):
cmd = ['cat', "/run/system.json"]
data = run_json_cmd(cmd)
components=[]
for _,vpd in data.get("vpd").items():
component=get_vpd_data(vpd)
components.append(component)
insert(hw_out, "component", components)
def get_routes(routes, proto, data):
out={}
out["route"] = []
if(proto == "ipv4"):
default = "0.0.0.0/0"
host_prefix_length="32"
else:
default = "::/0"
host_prefix_length="128"
for d in data:
new = {}
next_hop = {}
if(d['dst'] == "default"):
d['dst'] = "0.0.0.0/0"
d['dst'] = default
if(d['dst'].find('/') == -1):
d['dst'] = d['dst']+"/32"
new['ietf-ipv4-unicast-routing:destination-prefix'] = d['dst']
d['dst'] = d['dst']+"/"+host_prefix_length
new[f'ietf-{proto}-unicast-routing:destination-prefix'] = d['dst']
new['source-protocol'] = "infix-routing:"+d['protocol']
if d.get("metric"):
new['route-preference'] = d['metric']
else:
new['route-preference'] = 0
if d['type'] == "blackhole":
next_hop['special-next-hop'] = "blackhole"
if d['type'] == "unreachable":
next_hop['special-next-hop'] = "unreachable"
if d['type'] == "unicast":
if(d.get("gateway")):
next_hop['ietf-ipv4-unicast-routing:next-hop-address'] = d['gateway']
elif(d.get("dev")):
next_hop['outgoing-interface'] = d['dev']
new['next-hop'] = next_hop
if d.get('nexthops'):
next_hops = []
for n in d.get('nexthops'):
next_hop = {}
if(n.get("dev")):
next_hop['outgoing-interface'] = n['dev']
if(n.get("gateway")):
next_hop[f'ietf-{proto}-unicast-routing:address'] = n['gateway']
next_hops.append(next_hop)
insert(new,'next-hop','next-hop-list','next-hop',next_hops)
else:
next_hop = {}
if d['type'] == "blackhole":
next_hop['special-next-hop'] = "blackhole"
if d['type'] == "unreachable":
next_hop['special-next-hop'] = "unreachable"
if d['type'] == "unicast":
if(d.get("dev")):
next_hop['outgoing-interface'] = d['dev']
if(d.get("gateway")):
next_hop[f'ietf-{proto}-unicast-routing:next-hop-address'] = d['gateway']
new['next-hop'] = next_hop
out['route'].append(new)
insert(routes, 'routes', out)
def add_ip_link(ifname, iface_out):
cmd = ['ip', '-s', '-d', '-j', 'link', 'show', 'dev', ifname]
def add_ipv4_route(routes, test):
if test:
cmd = ['cat', f"{test}/ip-4-route.json"]
else:
cmd = ['ip', '-4', '-s', '-d', '-j', 'route']
data = run_json_cmd(cmd)
get_routes(routes, "ipv4", data)
def add_ipv6_route(routes, test):
if test:
cmd = ['cat', f"{test}/ip-6-route.json"]
else:
cmd = ['ip', '-6', '-s', '-d', '-j', 'route']
data = run_json_cmd(cmd)
get_routes(routes, "ipv6", data)
def frr_to_ietf_neighbor_state(state):
state=state.split("/")[0]
if(state == "TwoWay"):
return "2-way"
return state.lower()
def add_ospf_routes(ospf):
cmd = ['vtysh', '-c', "show ip ospf rout json"]
data = run_json_cmd(cmd)
routes=[]
for prefix,info in data.items():
if(prefix.find("/") == -1): # Ignore router IDs
continue
route={}
route["prefix"] = prefix
nexthops=[]
routetype=info["routeType"].split(" ")
if(len(routetype) > 1):
if(routetype[1]=="E1"):
route["route-type"] = "external-1"
elif(routetype[1]=="E2"):
route["route-type"] = "external-2"
elif(routetype[1]=="IA"):
route["route-type"] = "inter-area"
elif(routetype[0] == "N"):
route["route-type"] = "intra-area"
for hop in info["nexthops"]:
nexthop={}
if(hop["ip"] != " "):
nexthop["next-hop"] = hop["ip"]
else:
nexthop["outgoing-interface"] = hop["directlyAttachedTo"]
nexthops.append(nexthop)
route["next-hops"] = {}
route["next-hops"]["next-hop"] = nexthops
routes.append(route)
insert(ospf, "ietf-ospf:local-rib", "ietf-ospf:route", routes)
def add_ospf(ospf):
cmd = ['/libexec/infix/ospf-status']
data = run_json_cmd(cmd)
ospf["ietf-ospf:router-id"] = data["routerId"]
ospf["ietf-ospf:address-family"] = "ipv4"
areas=[]
for area_id,values in data["areas"].items():
area={}
area["ietf-ospf:area-id"] = area_id
area["ietf-ospf:interfaces"] = {}
if values.get("area-type"):
area["ietf-ospf:area-type"] = values["area-type"]
interfaces=[]
for iface in values.get("interfaces", {}):
interface={}
interface["ietf-ospf:neighbors"] = {}
interface["name"]=iface["name"]
if(iface.get("drId")):
interface["dr-router-id"]=iface["drId"]
if(iface.get("drAddress")):
interface["dr-ip-addr"]=iface["drAddress"]
if(iface.get("bdrId")):
interface["bdr-router-id"]=iface["bdrId"]
if(iface.get("bdrAddress")):
interface["bdr-ip-addr"]=iface["bdrAddress"]
if(iface.get("timerPassiveIface")):
interface["passive"] = True
else:
interface["passive"] = False
interface["enabled"] = iface["ospfEnabled"]
if(iface["networkType"] == "POINTOPOINT"):
interface["interface-type"] = "point-to-point"
if(iface["networkType"] == "BROADCAST"):
interface["interface-type"] = "broadcast"
if iface.get("state"):
map = {
"DependUpon": "down", # Do not know what this is, never seen it and no entry in yang, but it listed before down in list in frr
"Down": "down",
"Waiting": "waiting",
"Loopback": "loopback",
"Point-To-Point": "point-to-point",
"DROther": "dr-other",
"Backup": "bdr",
"DR": "dr"
}
val = map.get(iface["state"], "unknown")
interface["state"] = val
neighbors = []
for neigh in iface["neighbors"]:
neighbor={}
neighbor["neighbor-router-id"] = neigh["neighborIp"]
neighbor["address"] = neigh["ifaceAddress"]
neighbor["dr-router-id"] = neigh["routerDesignatedId"]
neighbor["bdr-router-id"] = neigh["routerDesignatedBackupId"]
neighbor["dead-timer"] = neigh["routerDeadIntervalTimerDueMsec"]
neighbor["state"]=frr_to_ietf_neighbor_state(neigh["nbrState"])
neighbors.append(neighbor)
interface["ietf-ospf:neighbors"] = {}
interface["ietf-ospf:neighbors"]["ietf-ospf:neighbor"] = neighbors
interfaces.append(interface)
area["ietf-ospf:interfaces"]["ietf-ospf:interface"] = interfaces
areas.append(area)
insert(ospf, "ietf-ospf:areas", "area", areas)
add_ospf_routes(ospf)
def add_ip_link(ifname, iface_out, test):
if test:
cmd = ['cat', f"{test}/ip-link-show-dev-{ifname}.json"]
else:
cmd = ['ip', '-s', '-d', '-j', 'link', 'show', 'dev', ifname]
data = run_json_cmd(cmd)
if len(data) != 1:
print(f"Error: expected ip link output to be array with length 1", file=sys.stderr)
sys,exit(1)
sys.exit(1)
iface_in = data[0]
@@ -201,8 +387,11 @@ def add_ip_link(ifname, iface_out):
if val is not None:
insert(iface_out, "statistics", "in-octets", str(val))
def add_ip_addr(ifname, iface_out):
cmd = ['ip', '-j', 'addr', 'show', 'dev', ifname]
def add_ip_addr(ifname, iface_out, test):
if test:
cmd = ['cat', f"{test}/ip-addr-show-dev-{ifname}.json"]
else:
cmd = ['ip', '-j', 'addr', 'show', 'dev', ifname]
data = run_json_cmd(cmd)
if len(data) != 1:
@@ -248,8 +437,11 @@ def add_ip_addr(ifname, iface_out):
insert(iface_out, "ietf-ip:ipv4", "address", inet)
insert(iface_out, "ietf-ip:ipv6", "address", inet6)
def add_ethtool_groups(ifname, iface_out):
cmd = ['ethtool', '--json', '-S', ifname, '--all-groups']
def add_ethtool_groups(ifname, iface_out, test):
if test:
cmd = ['cat', f"{test}/ethtool-groups-{ifname}.json"]
else:
cmd = ['ethtool', '--json', '-S', ifname, '--all-groups']
data = run_json_cmd(cmd)
if len(data) != 1:
@@ -323,11 +515,15 @@ def add_ethtool_groups(ifname, iface_out):
if found:
frame['in-error-oversize-frames'] = str(tot)
def add_ethtool_std(ifname, iface_out):
cmd = ['ethtool', ifname]
def add_ethtool_std(ifname, iface_out, test):
keys = ['Speed', 'Duplex', 'Auto-negotiation']
result = {}
if test:
cmd = ['cat', f"{test}/ethtool-{ifname}.txt"]
else:
cmd = ['ethtool', ifname]
lines = run_cmd(cmd)
for line in lines:
line = line.strip()
@@ -358,18 +554,20 @@ def add_ethtool_std(ifname, iface_out):
insert(iface_out, "ieee802-ethernet-interface:ethernet", "speed", str(num))
if __name__ == "__main__":
if len(sys.argv) < 2:
print(f"usage: yanger <model> [params]", file=sys.stderr)
sys.exit(1)
model = sys.argv[1]
if(model == 'ietf-interfaces'):
parser = argparse.ArgumentParser(description="YANG data creator")
parser.add_argument("model", help="IETF Model")
parser.add_argument("-p", "--param", default=None, help="Model dependant parameter")
parser.add_argument("-t", "--test", default=None, help="Test data base path")
args = parser.parse_args()
if (args.model == 'ietf-interfaces'):
# For now, we handle each interface separately, as this is how it's
# currently implemented in sysrepo. I.e sysrepo will subscribe to
# each individual interface and query it for YANG data.
if len(sys.argv) != 3:
print(f"usage: yanger ietf-interfaces IFNAME", file=sys.stderr)
if not args.param:
print(f"usage: yanger ietf-interfaces -p INTERFACE", file=sys.stderr)
sys.exit(1)
yang_data = {
@@ -378,28 +576,58 @@ if __name__ == "__main__":
}
}
ifname = sys.argv[2]
ifname = args.param
iface_out = yang_data['ietf-interfaces:interfaces']['interface'][0]
add_ip_link(ifname, iface_out)
add_ip_addr(ifname, iface_out)
add_ethtool_groups(ifname, iface_out)
add_ethtool_std(ifname, iface_out)
elif(model == 'ietf-routing'):
add_ip_link(ifname, iface_out, args.test)
add_ip_addr(ifname, iface_out, args.test)
add_ethtool_groups(ifname, iface_out, args.test)
add_ethtool_std(ifname, iface_out, args.test)
elif (args.model == 'ietf-routing'):
yang_data = {
"ietf-routing:routing": {
"ribs": {
"rib": [{
"name": "ipv4",
"address-family": "ipv4",
"address-family": "ipv4"
},
{
"name": "ipv6",
"address-family": "ipv6"
}]
}
}
}
ipv4routes = yang_data['ietf-routing:routing']['ribs']['rib'][0]
add_ipv4_route(ipv4routes);
ipv6routes = yang_data['ietf-routing:routing']['ribs']['rib'][1]
add_ipv4_route(ipv4routes, args.test)
add_ipv6_route(ipv6routes, args.test)
elif (args.model == 'ietf-ospf'):
yang_data = {
"ietf-routing:routing": {
"control-plane-protocols": {
"control-plane-protocol": [
{
"type": "ietf-ospf:ospfv2",
"name": "default",
"ietf-ospf:ospf": {
"ietf-ospf:areas":
{
}
}
}]
}
}
}
add_ospf(yang_data['ietf-routing:routing']['control-plane-protocols']['control-plane-protocol'][0]["ietf-ospf:ospf"])
elif (args.model == 'ietf-hardware'):
yang_data = {
"ietf-hardware:hardware": {
}
}
add_hardware(yang_data["ietf-hardware:hardware"], args.test)
else:
print(f"Unsupported model {model}", file=sys.stderr)
print(f"Unsupported model {args.model}", file=sys.stderr)
sys.exit(1)
print(json.dumps(yang_data, indent=2))
+8 -5
View File
@@ -1,27 +1,30 @@
test-dir := $(BR2_EXTERNAL_INFIX_PATH)/test
INFIX_TESTS ?= $(test-dir)/case/all-repo.yaml $(test-dir)/case/all-unit.yaml \
$(test-dir)/case/all.yaml
UNIT_TESTS ?= $(test-dir)/case/all-repo.yaml $(test-dir)/case/all-unit.yaml
INFIX_TESTS ?= $(test-dir)/case/all.yaml
test-env = $(test-dir)/env \
-f $(BINARIES_DIR)/infix-x86_64.img \
-p $(BINARIES_DIR)/infix-x86_64.pkg \
$(1) $(2)
test-env-qeneth = $(call test-env,-q $(test-dir)/virt/dual,$(1))
test-env-qeneth = $(call test-env,-q $(test-dir)/virt/quad,$(1))
test-env-run = $(call test-env,-C -t $(BINARIES_DIR)/qemu.dot,$(1))
.PHONY: test-%
test-unit:
$(test-dir)/env $(test-dir)/9pm/9pm.py $(UNIT_TESTS)
test-qeneth:
$(call test-env-qeneth,\
$(BR2_EXTERNAL_INFIX_PATH)/9pm/9pm.py \
$(BR2_EXTERNAL_INFIX_PATH)/test/9pm/9pm.py \
$(INFIX_TESTS))
test-qeneth-sh:
$(call test-env-qeneth,/bin/sh)
test-run: | ~/.infix-test-venv
$(call test-env-run,\
$(BR2_EXTERNAL_INFIX_PATH)/9pm/9pm.py \
$(BR2_EXTERNAL_INFIX_PATH)/test/9pm/9pm.py \
$(INFIX_TESTS))
test-run-sh: | ~/.infix-test-venv
$(call test-env-run,/bin/sh)
+3
View File
@@ -6,6 +6,7 @@ BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y
BR2_DL_DIR="${BR2_EXTERNAL_INFIX_PATH}/dl"
BR2_CCACHE=y
BR2_CCACHE_DIR="${BR2_EXTERNAL_INFIX_PATH}/.ccache"
BR2_ENABLE_DEBUG=y
BR2_GLOBAL_PATCH_DIR="${BR2_EXTERNAL_INFIX_PATH}/patches"
BR2_TARGET_GENERIC_HOSTNAME="infix"
BR2_TARGET_GENERIC_ISSUE="Infix by KernelKit"
@@ -41,6 +42,7 @@ BR2_PACKAGE_UBOOT_TOOLS=y
BR2_PACKAGE_UBOOT_TOOLS_FIT_SUPPORT=y
BR2_PACKAGE_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y
BR2_PACKAGE_UBOOT_TOOLS_FIT_CHECK_SIGN=y
BR2_PACKAGE_UBOOT_TOOLS_MKENVIMAGE=y
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_LIBCURL_CURL=y
BR2_PACKAGE_NSS_MDNS=y
@@ -77,6 +79,7 @@ BR2_PACKAGE_TCPDUMP=y
BR2_PACKAGE_TRACEROUTE=y
BR2_PACKAGE_DIALOG=y
BR2_PACKAGE_PDMENU=y
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_IRQBALANCE=y
BR2_PACKAGE_KMOD_TOOLS=y
BR2_PACKAGE_PWGEN=y
+4
View File
@@ -90,6 +90,8 @@ BR2_PACKAGE_TRACEROUTE=y
BR2_PACKAGE_ULOGD=y
BR2_PACKAGE_BASH=y
BR2_PACKAGE_BASH_COMPLETION=y
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_SUDO=y
BR2_PACKAGE_IRQBALANCE=y
BR2_PACKAGE_KMOD_TOOLS=y
BR2_PACKAGE_PWGEN=y
@@ -128,10 +130,12 @@ BR2_PACKAGE_FINIT_PLUGIN_RTC=y
BR2_PACKAGE_FINIT_PLUGIN_TTY=y
BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y
BR2_PACKAGE_IITO=y
BR2_PACKAGE_KEYACK=y
BR2_PACKAGE_KLISH_PLUGIN_INFIX=y
BR2_PACKAGE_LOWDOWN=y
BR2_PACKAGE_TETRIS=y
BR2_PACKAGE_QUERIERD=y
BR2_PACKAGE_LIBINPUT=y
DISK_IMAGE_BOOT_BIN=y
GNS3_APPLIANCE_RAM=512
GNS3_APPLIANCE_IFNUM=10
+164
View File
@@ -0,0 +1,164 @@
BR2_aarch64=y
BR2_cortex_a53=y
BR2_ARM_FPU_VFPV4=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y
BR2_DL_DIR="${BR2_EXTERNAL_INFIX_PATH}/dl"
BR2_CCACHE=y
BR2_CCACHE_DIR="${BR2_EXTERNAL_INFIX_PATH}/.ccache"
BR2_ENABLE_DEBUG=y
BR2_GLOBAL_PATCH_DIR="${BR2_EXTERNAL_INFIX_PATH}/patches"
BR2_TARGET_GENERIC_HOSTNAME="infix"
BR2_TARGET_GENERIC_ISSUE="Infix by KernelKit"
BR2_INIT_FINIT=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_ROOTFS_DEVICE_TABLE="system/device_table.txt ${BR2_EXTERNAL_INFIX_PATH}/board/common/xattrs ${BR2_EXTERNAL_INFIX_PATH}/board/netconf/xattrs"
# BR2_TARGET_ENABLE_ROOT_LOGIN is not set
BR2_TARGET_GENERIC_GETTY_TERM="xterm"
BR2_SYSTEM_DHCP="eth0"
BR2_ENABLE_LOCALE_WHITELIST="C en_US en_CA"
BR2_GENERATE_LOCALE="en_US en_CA"
BR2_TARGET_TZ_INFO=y
BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL_INFIX_PATH}/board/common/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/netconf/rootfs"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_INFIX_PATH)/board/aarch64/r2s/post-build.sh ${BR2_EXTERNAL_INFIX_PATH}/board/common/post-build.sh ${BR2_EXTERNAL_INFIX_PATH}/board/netconf/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BR2_EXTERNAL_INFIX_PATH)/board/aarch64/r2s/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.5.11"
BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_INFIX_PATH)/board/aarch64/r2s/rk3328-nanopi-r2s-dts.patch"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_INFIX_PATH)/board/aarch64/r2s/linux_defconfig"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="rockchip/rk3328-nanopi-r2s"
BR2_LINUX_KERNEL_INSTALL_TARGET=y
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_INFIX_PATH)/board/common/busybox_defconfig"
BR2_PACKAGE_STRACE=y
BR2_PACKAGE_STRESS_NG=y
BR2_PACKAGE_JQ=y
BR2_PACKAGE_E2FSPROGS=y
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT61=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_RTW88=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_815X=y
BR2_PACKAGE_DBUS_CXX=y
BR2_PACKAGE_DBUS_GLIB=y
BR2_PACKAGE_DBUS_TRIGGERD=y
BR2_PACKAGE_EUDEV_RULES_GEN=y
# BR2_PACKAGE_EUDEV_ENABLE_HWDB is not set
BR2_PACKAGE_GPTFDISK=y
BR2_PACKAGE_GPTFDISK_SGDISK=y
BR2_PACKAGE_MDIO_TOOLS=y
BR2_PACKAGE_RNG_TOOLS=y
BR2_PACKAGE_UBOOT_TOOLS_FIT_SUPPORT=y
BR2_PACKAGE_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y
BR2_PACKAGE_UBOOT_TOOLS_FIT_CHECK_SIGN=y
BR2_PACKAGE_UBOOT_TOOLS_MKENVIMAGE=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_LIBOPENSSL_BIN=y
BR2_PACKAGE_LIBCURL_CURL=y
BR2_PACKAGE_NETOPEER2_CLI=y
BR2_PACKAGE_NSS_MDNS=y
BR2_PACKAGE_ONIGURUMA=y
BR2_PACKAGE_AVAHI=y
BR2_PACKAGE_AVAHI_DAEMON=y
BR2_PACKAGE_AVAHI_DEFAULT_SERVICES=y
BR2_PACKAGE_CHRONY=y
BR2_PACKAGE_CONNTRACK_TOOLS=y
BR2_PACKAGE_DNSMASQ=y
BR2_PACKAGE_ETHTOOL=y
BR2_PACKAGE_FPING=y
BR2_PACKAGE_FRR=y
# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
BR2_PACKAGE_IPROUTE2=y
BR2_PACKAGE_IPTABLES=y
BR2_PACKAGE_IPTABLES_NFTABLES=y
BR2_PACKAGE_IPUTILS=y
BR2_PACKAGE_LLDPD=y
BR2_PACKAGE_NETCALC=y
BR2_PACKAGE_NETCAT_OPENBSD=y
BR2_PACKAGE_NETSNMP=y
BR2_PACKAGE_NFTABLES=y
BR2_PACKAGE_NMAP=y
BR2_PACKAGE_NMAP_NCAT=y
BR2_PACKAGE_NMAP_NMAP=y
BR2_PACKAGE_NMAP_NPING=y
BR2_PACKAGE_OPENRESOLV=y
BR2_PACKAGE_OPENSSH=y
BR2_PACKAGE_SOCAT=y
BR2_PACKAGE_TCPDUMP=y
BR2_PACKAGE_TRACEROUTE=y
BR2_PACKAGE_ULOGD=y
BR2_PACKAGE_BASH_COMPLETION=y
BR2_PACKAGE_SUDO=y
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_IRQBALANCE=y
BR2_PACKAGE_KMOD_TOOLS=y
BR2_PACKAGE_PWGEN=y
BR2_PACKAGE_RAUC=y
BR2_PACKAGE_RAUC_DBUS=y
BR2_PACKAGE_RAUC_GPT=y
BR2_PACKAGE_RAUC_NETWORK=y
BR2_PACKAGE_SYSKLOGD=y
BR2_PACKAGE_SYSKLOGD_LOGGER=y
BR2_PACKAGE_WATCHDOGD=y
BR2_PACKAGE_LESS=y
BR2_PACKAGE_MG=y
BR2_PACKAGE_NANO=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="256M"
BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.5"
BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="rk3328"
BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES=""
BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_ARM32_TOOLCHAIN=y
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2021.10"
BR2_TARGET_UBOOT_BOARD_DEFCONFIG="nanopi-r2s-rk3328"
BR2_TARGET_UBOOT_NEEDS_DTC=y
BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y
BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb"
BR2_TARGET_UBOOT_SPL=y
BR2_TARGET_UBOOT_SPL_NAME="idbloader.img"
BR2_PACKAGE_HOST_ENVIRONMENT_SETUP=y
BR2_PACKAGE_HOST_GENEXT2FS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_RAUC=y
BR2_PACKAGE_HOST_UBOOT_TOOLS=y
INFIX_VENDOR_HOME="https://github.com/kernelkit"
INFIX_DESC="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."
INFIX_HOME="https://github.com/kernelkit/infix/"
INFIX_DOC="https://github.com/kernelkit/infix/tree/main/doc"
INFIX_SUPPORT="mailto:kernelkit@googlegroups.com"
BR2_PACKAGE_CONFD=y
BR2_PACKAGE_STATD=y
BR2_PACKAGE_FACTORY=y
BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y
BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS=y
BR2_PACKAGE_FINIT_PLUGIN_MODULES_LOAD=y
BR2_PACKAGE_FINIT_PLUGIN_RTC=y
BR2_PACKAGE_FINIT_PLUGIN_TTY=y
BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y
BR2_PACKAGE_IITO=y
BR2_PACKAGE_KLISH_PLUGIN_INFIX=y
BR2_PACKAGE_LOWDOWN=y
BR2_PACKAGE_TETRIS=y
BR2_PACKAGE_QUERIERD=y
# SIGN_ENABLED is not set
# GNS3_APPLIANCE is not set
+4 -1
View File
@@ -5,6 +5,7 @@ BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y
BR2_DL_DIR="${BR2_EXTERNAL_INFIX_PATH}/dl"
BR2_CCACHE=y
BR2_CCACHE_DIR="${BR2_EXTERNAL_INFIX_PATH}/.ccache"
BR2_ENABLE_DEBUG=y
BR2_GLOBAL_PATCH_DIR="${BR2_EXTERNAL_INFIX_PATH}/patches"
BR2_TARGET_GENERIC_HOSTNAME="infix"
BR2_TARGET_GENERIC_ISSUE="Infix by KernelKit"
@@ -34,6 +35,7 @@ BR2_PACKAGE_UBOOT_TOOLS=y
BR2_PACKAGE_UBOOT_TOOLS_FIT_SUPPORT=y
BR2_PACKAGE_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y
BR2_PACKAGE_UBOOT_TOOLS_FIT_CHECK_SIGN=y
BR2_PACKAGE_UBOOT_TOOLS_MKENVIMAGE=y
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_LIBCURL_CURL=y
BR2_PACKAGE_NSS_MDNS=y
@@ -69,6 +71,7 @@ BR2_PACKAGE_TCPDUMP=y
BR2_PACKAGE_TRACEROUTE=y
BR2_PACKAGE_DIALOG=y
BR2_PACKAGE_PDMENU=y
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_IRQBALANCE=y
BR2_PACKAGE_KMOD_TOOLS=y
BR2_PACKAGE_PWGEN=y
@@ -86,7 +89,7 @@ BR2_TARGET_ROOTFS_SQUASHFS=y
BR2_TARGET_EDK2=y
BR2_TARGET_GRUB2=y
BR2_TARGET_GRUB2_X86_64_EFI=y
BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_gpt normal efi_gop configfile loadenv test terminfo terminal echo"
BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 squash4 part_gpt normal efi_gop configfile loadenv test echo reboot net efinet tftp loopback"
BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="${BR2_EXTERNAL_INFIX_PATH}/board/x86_64/grub-embed.cfg"
BR2_TARGET_GRUB2_INSTALL_TOOLS=y
BR2_PACKAGE_HOST_DOSFSTOOLS=y
+3
View File
@@ -85,6 +85,8 @@ BR2_PACKAGE_TRACEROUTE=y
BR2_PACKAGE_ULOGD=y
BR2_PACKAGE_BASH=y
BR2_PACKAGE_BASH_COMPLETION=y
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_SUDO=y
BR2_PACKAGE_IRQBALANCE=y
BR2_PACKAGE_KMOD_TOOLS=y
BR2_PACKAGE_PWGEN=y
@@ -131,6 +133,7 @@ BR2_PACKAGE_FINIT_PLUGIN_RTC=y
BR2_PACKAGE_FINIT_PLUGIN_TTY=y
BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y
BR2_PACKAGE_IITO=y
BR2_PACKAGE_KEYACK=y
BR2_PACKAGE_KLISH_PLUGIN_INFIX=y
BR2_PACKAGE_LOWDOWN=y
BR2_PACKAGE_TETRIS=y
+177 -11
View File
@@ -122,7 +122,33 @@ Multiple address assignment methods are available:
| link-local | infix-ip | Auto-assignment of IPv4 address in 169.254.x.x/16 range |
| dhcp | infix-dhcp-client | Assignment of IPv4 address by DHCP server, e.g., *10.0.1.1/24* |
DHCP address method is only available for *LAN* interfaces (ethernet, virtual ethernet (veth), bridge, etc.)
Supported DHCP (request) options, configurability (Cfg) and defaults,
are listed below. Configurable options can be disabled on a per client
interface basis, some options, like `clientid` and option 81, are
possible to set the value of as well.
| **Opt** | **Name** | **Cfg** | **Description** |
|---------|------------------|---------|-----------------------------------------------------|
| 1 | `subnet` | No | Request IP address and netmask |
| 3 | `router` | Yes | Default route(s), see also option 121 and 249 |
| 6 | `dns` | Yes | DNS server(s), static ones take precedence |
| 12 | `hostname` | Yes | DHCP cannot set hostname, only for informing server |
| 15 | `domain` | Yes | Default domain name, for name resolution |
| 28 | `broadcast` | Yes | Broadcast address, calculated if disabled |
| 42 | `ntpsrv` | Yes | NTP server(s), static ones take precedence |
| 50 | `address` | Yes | Request (previously cached) address |
| 61 | `clientid` | Yes | Default MAC address (and option 12) |
| 81 | `fqdn` | Yes | Similar to option 12, request FQDN update in DNS |
| 119 | `search` | Yes | Request domain search list |
| 121 | `staticroutes` | Yes | Classless static routes |
| 249 | `msstaticroutes` | Yes | Microsoft static route |
| | | | |
**Default:** `router`, `dns`, `domain`, `broadcast`, `ntpsrv`, `search`,
`address`, `staticroutes`, `msstaticroutes`
> **Note:** DHCP address method is only available for *LAN* interfaces
> (Ethernet, virtual Ethernet (veth), bridge, link aggregates, etc.)
### IPv6 Address Assignment
@@ -327,14 +353,47 @@ possible to specify use of a random identifier ([ietf-ip][ietf-ip-yang] YANG and
Both the link-local address (fe80::) and the global address (2001:)
have changed type to *random*.
### IPv4 forwarding
To be able to route (static or dynamic) on the interface it is
required to enable forwarding. This setting controlls if packets
received on this interface can be forwarded.
```
admin@example:/config/> edit interface eth0
admin@example:/config/interface/eth0/> set ipv4 forwarding
admin@example:/config/interface/eth0/> leave
admin@example:/>
```
### IPv6 forwarding
This flag behaves totally different than for IPv4. For IPv6 the
ability to route between interfaces is always enabled, instead this
flag controls if the interface will be in host/router mode.
| **Feature** | **Forward enabled** | **Forward disabled** |
|:------------------------------------------|:--------------------|:---------------------|
| IsRouter set in Neighbour Advertisements. | Yes | No |
| Transmit Router Solicitations. | No | Yes |
| Router Advertisements are ignored | No | Yes |
| Accept Redirects | No | Yes |
```
admin@example:/config/> edit interface eth0
admin@example:/config/interface/eth0/> set ipv6 forwarding
admin@example:/config/interface/eth0/> leave
admin@example:/>
```
## Routing support
| **Yang Model** | **Description** |
|:--------------------------|:----------------------------------------------------------|
| ietf-routing | Base routing model, required for all other routing models |
| ietf-ipv4-unicast-routing | Static IPv4 unicast routing |
| **Yang Model** | **Description** |
|:--------------------------|:--------------------------------------------------------------------------------------|
| ietf-routing | Base model, used to set configuration and read operational status in the other models |
| ietf-ipv4-unicast-routing | Static IPv4 unicast routing |
| ietf-ipv6-unicast-routing | Static IPv6 unicast routing |
| ietf-ospf | OSPF routing |
| infix-routing | Infix deviations |
### Static routes
### IPv4 Static routes
Remember to enable [IPv4 forwarding](#IPv4-forwarding) for the interfaces.
admin@example:/> configure
admin@example:/config/> edit routing control-plane-protocol static name default
@@ -345,15 +404,121 @@ have changed type to *random*.
> **Note:** The only name allowed for a control-plane-protocol is currently
> *default*. Meaning, you can only have one instance per routing protocol.
### View IPv4 routing table
### IPv6 Static routes
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:/>
> **Note:** The only name allowed for a control-plane-protocol is currently
> *default*. Meaning, you can only have one instance per routing protocol.
### OSPFv2 Routing
Infix supports OSPF dynamic routing for IPv4, i.e., OSPFv2.
Remember to enable [IPv4 forwarding](#IPv4-forwarding) for the
interfaces you want to run OSPFv2.
admin@example:/config/> edit routing control-plane-protocol ospfv2 name default
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/> set ospf area 0.0.0.0 interface e0 enabled true
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/> leave
admin@example:/>
> **Note:** The only instance name allowed for a
> control-plane-protocol is currently *default*. Meaning, you can
> only have one instance per routing protocol.
#### OSPF area types
In addition to *regular* OSPF areas, area types *NSSA* and *Stub* are supported.
To configure a NSSA area with summary routes:
admin@example:/config/> edit routing control-plane-protocol ospfv2 name default
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/> set ospf area 0.0.0.1 area-type nssa-area
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/> set ospf area 0.0.0.1 summary true
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/> leave
admin@example:/>
#### Bidirectional Forwarding Detection (BFD)
It is possible to enable BFD per interface to speed up detection of
link loss.
admin@example:/config/> edit routing control-plane-protocol ospfv2 name default
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/ospf/> set area 0.0.0.0 interface e0 bfd enabled true
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/> leave
admin@example:/>
#### OSPF interface settings
We have already seen how to enable OSPF per interface (*enabled true*)
and BFD for OSPF per interface (*bfd enabled true*). These and other
OSPF interface settings are done in context of an OSFP area, e.g.,
*area 0.0.0.0*. Available commands can be listed using the `?` mark.
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/> edit ospf area 0.0.0.0
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/ospf/area/0.0.0.0/> edit interface e0
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/ospf/area/0.0.0.0/interface/e0/> set ?
bfd BFD interface configuration.
cost Interface's cost.
dead-interval Interval after which a neighbor is declared down
enabled Enables/disables the OSPF protocol on the interface.
hello-interval Interval between Hello packets (seconds). It must
interface-type Interface type.
passive Enables/disables a passive interface. A passive
retransmit-interval Interval between retransmitting unacknowledged Link
transmit-delay Estimated time needed to transmit Link State Update
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/ospf/area/0.0.0.0/interface/e0/> set
For example, setting the OSPF *interface type* to *point-to-point* for
an Ethernet interface can be done as follows.
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/ospf/area/0.0.0.0/interface/e0/> set interface-type point-to-point
admin@example:/config/routing/control-plane-protocol/ospfv2/name/default/ospf/area/0.0.0.0/interface/e0/>
#### Debug OSPFv2
Using NETCONF and the YANG model *ietf-routing* it is possible to read the OSPF routing table, neighbors
and more, that may be useful for debugging the OSPFv2 setup. The CLI
has various OSPF status commands such as `show ospf neighbor`, `show
ospf interface` and `show ospf routes`.
admin@example:/> show ospf neighbor
Neighbor ID Pri State Up Time Dead Time Address Interface RXmtL RqstL DBsmL
10.1.1.2 1 Full/- 3h46m59s 30.177s 10.1.1.2 e0:10.1.1.1 0 0 0
10.1.1.3 1 Full/- 3h46m55s 34.665s 10.1.1.3 e1:10.1.1.1 0 0 0
admin@example:/>
### View routing table
The routing table can be viewed from the operational datastore over
NETCONF or using the CLI:
admin@example:/> show routes
PREFIX NEXT-HOP METRIC PROTOCOL
192.168.1.0/24 e0 kernel
192.168.200.0/24 192.168.1.1 20 static
#### IPv4 routing table
admin@example:/> show routes ipv4
PREFIX NEXT-HOP PREF PROTOCOL
192.168.1.0/24 e0 kernel
192.168.200.0/24 192.168.1.1 20 static
admin@example:/>
#### IPv6 routing table
admin@example:/> show routes ipv6
PREFIX NEXT-HOP PREF PROTOCOL
2001:db8:3c4d:50::/64 eth4 256 kernel
fe80::/64 eth5 256 kernel
fe80::/64 eth3 256 kernel
fe80::/64 eth1 256 kernel
fe80::/64 eth0 256 kernel
fe80::/64 eth2 256 kernel
fe80::/64 eth4 256 kernel
admin@example:/>
#### Source protocol
The source protocol describes the origin of the route.
@@ -362,6 +527,7 @@ The source protocol describes the origin of the route.
| kernel | Added when setting a subnet address on an interface |
| static | User created static routes |
| dhcp | Routes retrieved from DHCP |
| ospf | Routes retreived from OSPFv2 |
The YANG model *ietf-routing* support multiple ribs but only two are
currently supported, namely `ipv4` and `ipv6`.
+3
View File
@@ -18,6 +18,9 @@ run-menuconfig: $(BUILD_DIR)/buildroot-config/mconf
CONFIG_="CONFIG_" BR2_CONFIG="$(BINARIES_DIR)/.config" \
$(BUILD_DIR)/buildroot-config/mconf $(BINARIES_DIR)/Config.in
#
# Buildroot package extensions
#
define FRR_POST_BUILD_HOOK
mkdir -p $(TARGET_DIR)/etc/iproute2/
cp -r $(@D)/tools/etc/iproute2/rt_protos.d/ $(TARGET_DIR)/etc/iproute2/
+1
View File
@@ -6,6 +6,7 @@ source "$BR2_EXTERNAL_INFIX_PATH/package/faux/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/finit/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/ifupdown-ng/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/iito/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/keyack/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/klish-plugin-infix/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/klish/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/klish-plugin-sysrepo/Config.in"
+10 -7
View File
@@ -100,17 +100,17 @@ config BR2_PACKAGE_FINIT_WATCHDOG_DEV
endif
config BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG
bool "hotplug plugin (mdev/udev)"
bool "Start (udevd/mdev -df) at boot"
help
By default, Finit builds and launches its hotplug plugin.
It is responsible for detecting and starting the mdev tool,
or udevd daemon. The former exists in many BusyBox based
systems and is called for "cold plugging". The latter has
many various incarnations and is mostly used for desktop
systems.
By default, Finit installs /lib/finit/system/10-hotplug.conf
which detects if the system has udevd or mdev daemon. They
are both used to probe for devices, load modules and firmware
to devices that request it.
For lxc/docker application builds you do not need this.
With this you probably do not need the modprobe plugin.
config BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS
bool "hook scripts"
default n
@@ -141,6 +141,9 @@ config BR2_PACKAGE_FINIT_PLUGIN_MODPROBE
For lxc/docker application builds you do not need this.
You probably do not want this anymore, use udevd or mdev to
probe devices, load modules and firmware instead.
config BR2_PACKAGE_FINIT_PLUGIN_RTC
bool "RTC plugin"
help
+2 -2
View File
@@ -1,8 +1,8 @@
# From https://github.com/troglobit/finit/releases/
sha256 84ce1623ee935dc5d2d615ca14ed087f4bb3c47207fda97f26b1346e4983a6b2 finit-4.6.tar.gz
sha256 139adcb81ec8a5bb628249f92e2144b20f7e14c53aa56bb86a2fd42c5e7dca11 finit-4.7.tar.gz
# Locally calculated
sha256 3a2b964c1772d03ab17b73a389ecce9151e0b190a9247817a2c009b16d356422 LICENSE
sha256 2fd62c0fe6ea6d1861669f4c87bda83a0b5ceca64f4baa4d16dd078fbd218c14 LICENSE
# GIT Snapshot
sha256 8c880293409cf566f6256bff193f985c50bd2eb99d2ff964dcaa9590251ed27e finit-438d6b4e638418a2a22024a3cead2f47909d72b9.tar.gz
+1 -1
View File
@@ -4,7 +4,7 @@
#
################################################################################
FINIT_VERSION = 4.6
FINIT_VERSION = 4.7
FINIT_SITE = https://github.com/troglobit/finit/releases/download/$(FINIT_VERSION)
FINIT_LICENSE = MIT
FINIT_LICENSE_FILES = LICENSE
+6
View File
@@ -0,0 +1,6 @@
config BR2_PACKAGE_KEYACK
bool "keyack"
help
Blocks until a specific key is pressed and released. Useful
when you want a user to confirm some action by physically
pressing a button.
+24
View File
@@ -0,0 +1,24 @@
################################################################################
#
# keyack
#
################################################################################
KEYACK_VERSION = 1.0
KEYACK_LICENSE = MIT
KEYACK_LICENSE_FILES = LICENSE
KEYACK_SITE_METHOD = local
KEYACK_SITE = $(BR2_EXTERNAL_INFIX_PATH)/src/keyack
KEYACK_REDISTRIBUTE = NO
define KEYACK_BUILD_CMDS
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \
LDLIBS="$(TARGET_LDFLAGS)"
endef
define KEYACK_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \
DESTDIR="$(TARGET_DIR)" install
endef
$(eval $(generic-package))
@@ -1,3 +1,3 @@
# Locally calculated
sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE
sha256 468b9a4da872257795964e2fff17fbfc5a592070a98a0a51e5f54464171ee73f klish-plugin-sysrepo-fa1228a7ff2b3500b8c1bc6f6f0d28bddd2d0a91-br1.tar.gz
sha256 59ce3461a002a8113be030ef476940027f5e0e73dbe8afc56739cda6b55349ab klish-plugin-sysrepo-f828a96efb12c3f7f8807aae089561fd69f4a6af-br1.tar.gz
@@ -4,7 +4,7 @@
#
################################################################################
KLISH_PLUGIN_SYSREPO_VERSION = fa1228a7ff2b3500b8c1bc6f6f0d28bddd2d0a91
KLISH_PLUGIN_SYSREPO_VERSION = f828a96efb12c3f7f8807aae089561fd69f4a6af
KLISH_PLUGIN_SYSREPO_SITE = https://github.com/kernelkit/klish-plugin-sysrepo.git
#KLISH_PLUGIN_SYSREPO_VERSION = cdd3eb51a7f7ee0ed5bd925fa636061d3b1b85fb
#KLISH_PLUGIN_SYSREPO_SITE = https://src.libcode.org/pkun/klish-plugin-sysrepo.git
@@ -1 +1 @@
service [2345] log:null <!pid/zebra> ospfd -A 127.0.0.1 -u frr -g frr -f /etc/frr/ospfd.conf-- OSPF daemon
service [2345] log:null <!pid/zebra> ospfd -A 127.0.0.1 -u frr -g frr -f /etc/frr/ospfd.conf -- OSPF daemon
@@ -1,2 +1,12 @@
service name:syslogd env:-/etc/default/sysklogd <run/udevadm:5/success> \
# This service provides the same sync condition as the BusyBox syslogd,
# which allows us to create a barrier at boot for services that might
# otherwise leak log messages to console.
# Use <pid/syslogd> as barrier for other system tasks and service that
# rely on modules, firmware, and device nodes to be ready.
service if:udevd env:-/etc/default/sysklogd <run/udevadm:5/success> \
[S0123456789] syslogd -F $SYSLOGD_ARGS -- System log daemon
service if:mdev env:-/etc/default/sysklogd <run/coldplug/success> \
[S0123456789] syslogd -F $SYSLOGD_ARGS -- System log daemon
service if:mdevd env:-/etc/default/sysklogd <run/coldplug/success> \
[S0123456789] syslogd -F $SYSLOGD_ARGS -- System log daemon
@@ -1,4 +1,5 @@
# Finit has a built-in watchdog daemon that starts very early
# to take care of the hand-over from any bootloader. Therefore
# watchdogd does not need to start until the default runlevel.
service [0123456789] watchdogd -xns -- System watchdog daemon
# Finit comes with a bundled mini-watchdogd, for Infix this is disabled,
# so we want to start watchdogd as soon as possible.
rlimit rtprio 99
service cgroup.root env:-/etc/default/watchdogd \
[S0123456789] watchdogd -xns $WATCHDOGD_ARGS -- System watchdog daemon
@@ -0,0 +1,61 @@
From 0f75b03c008eacb9818af3a56dc088e72a623d17 Mon Sep 17 00:00:00 2001
From: Marco Felsch <m.felsch@pengutronix.de>
Date: Wed, 9 Nov 2022 12:59:09 +0100
Subject: [PATCH] feat(build): add support for new binutils versions
Users of GNU ld (BPF) from binutils 2.39+ will observe multiple instaces
of a new warning when linking the bl*.elf in the form:
ld.bfd: warning: stm32mp1_helper.o: missing .note.GNU-stack section implies executable stack
ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld.bfd: warning: bl2.elf has a LOAD segment with RWX permissions
ld.bfd: warning: bl32.elf has a LOAD segment with RWX permissions
These new warnings are enbaled by default to secure elf binaries:
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
Fix it in a similar way to what the Linux kernel does, see:
https://lore.kernel.org/all/20220810222442.2296651-1-ndesaulniers@google.com/
Following the reasoning there, we set "-z noexecstack" for all linkers
(although LLVM's LLD defaults to it) and optional add
--no-warn-rwx-segments since this a ld.bfd related.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Upstream: https://github.com/ARM-software/arm-trusted-firmware/commit/1f49db5f25cdd4e43825c9bcc0575070b80f628c
---
Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 1ddb7b844..470956b19 100644
--- a/Makefile
+++ b/Makefile
@@ -416,6 +416,8 @@ endif
GCC_V_OUTPUT := $(shell $(CC) -v 2>&1)
+TF_LDFLAGS += -z noexecstack
+
# LD = armlink
ifneq ($(findstring armlink,$(notdir $(LD))),)
TF_LDFLAGS += --diag_error=warning --lto_level=O1
@@ -442,7 +444,10 @@ TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
else
-TF_LDFLAGS += --fatal-warnings -O1
+# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we
+# are not loaded by a elf loader.
+TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments)
+TF_LDFLAGS += -O1
TF_LDFLAGS += --gc-sections
# ld.lld doesn't recognize the errata flags,
# therefore don't add those in that case
--
2.30.2
@@ -1,36 +0,0 @@
commit 5db2fb2c325807c67b38d18b454bbfc55b51b77f
Author: Joachim Wiberg <troglobit@gmail.com>
Date: Sat May 20 10:08:31 2023 +0200
initctl: let -f force-skip check for built-in service
When calling `initctl -b create` from a start script at bootstrap you
risk blocking the boot since Finit currently cannot reply to IPC during
that period.
This patch allows -f to override this builtin check for the following
initctl commands:
- touch
- show
- edit
- create
- delete
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
diff --git a/src/serv.c b/src/serv.c
index 570f5ac..2029ddd 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -41,6 +41,10 @@ static int is_builtin(char *arg)
{
svc_t *svc;
+ /* skip check, we may be in non-responsive bootstrap */
+ if (iforce)
+ return 0;
+
svc = client_svc_find(arg);
if (!svc)
return 0;
@@ -1,58 +0,0 @@
From 6f0d448765d61a741add34baec422c24e357e7dc Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Tue, 27 Jun 2023 12:18:09 +0200
Subject: [PATCH] Fix #227: delayed service_kill() may stall shutdown/reboot
Organization: Addiva Elektronik
This turns out to be the root-cause of #227. Finit is waiting forever
for proceeses to stop at shutdown/reboot, while a subreaper has already
collected the PID, or Finit for some reason did not collect the PID.
When the process timeout calls service_kill() we now check if the kernel
actually knows of this process or not. If it's already been collected,
we can notify Finit of this by calling service_monitor() to clean up the
'svc' and in turn call sm_step() to finalize the state transition.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/service.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/service.c b/src/service.c
index 21acd28..ddd7e4f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -850,17 +850,26 @@ fail:
*/
static void service_kill(svc_t *svc)
{
+ char *nm, *id = svc_ident(svc, NULL, 0);
+
service_timeout_cancel(svc);
if (svc->pid <= 1) {
/* Avoid killing ourselves or all processes ... */
- dbg("%s: Aborting SIGKILL, already terminated.", svc_ident(svc, NULL, 0));
+ dbg("%s: Aborting SIGKILL, already terminated.", id);
return;
}
- dbg("%s: Sending SIGKILL to process group %d", pid_get_name(svc->pid, NULL, 0), svc->pid);
- logit(LOG_CONSOLE | LOG_NOTICE, "Stopping %s[%d], sending SIGKILL ...",
- svc_ident(svc, NULL, 0), svc->pid);
+ nm = pid_get_name(svc->pid, NULL, 0);
+ if (!nm) {
+ /* PID possibly monitored by someone else? */
+ dbg("%s: Aborting SIGKILL, PID[%d] no longer exists.", id, svc->pid);
+ service_monitor(svc->pid, 0);
+ return;
+ }
+
+ dbg("%s: Sending SIGKILL to process group %d", nm, svc->pid);
+ logit(LOG_CONSOLE | LOG_NOTICE, "Stopping %s[%d], sending SIGKILL ...", id, svc->pid);
if (runlevel != 1)
print_desc("Killing ", svc->desc);
--
2.34.1
@@ -0,0 +1,78 @@
From cbf96a1de0feee85f8a4014f29f9f3b7558dbff0 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Sun, 10 Dec 2023 16:42:29 +0100
Subject: [PATCH 1/2] Silence 'not available' log messages for nowarn
run/task/service
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/service.c | 4 ++--
src/svc.c | 5 +++--
src/svc.h | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/service.c b/src/service.c
index c6ee18d0..1ee54e5a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1620,7 +1620,7 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
strlcat(ident, id, sizeof(ident));
}
- if (ifstmt && !svc_ifthen(1, ident, ifstmt))
+ if (ifstmt && !svc_ifthen(1, ident, ifstmt, nowarn))
return 0;
levels = conf_parse_runlevels(runlevels);
@@ -2027,7 +2027,7 @@ void service_mark_unavail(void)
if (!svc->ifstmt[0])
continue;
- if (!svc_ifthen(1, svc_ident(svc, buf, sizeof(buf)), svc->ifstmt))
+ if (!svc_ifthen(1, svc_ident(svc, buf, sizeof(buf)), svc->ifstmt, svc->nowarn))
svc_mark(svc);
}
}
diff --git a/src/svc.c b/src/svc.c
index 001993de..6bb90049 100644
--- a/src/svc.c
+++ b/src/svc.c
@@ -649,7 +649,7 @@ int svc_enabled(svc_t *svc)
return 0;
}
- if (!svc_ifthen(0, NULL, svc->ifstmt)) {
+ if (!svc_ifthen(0, NULL, svc->ifstmt, svc->nowarn)) {
// dbg("ifthen:%s>", svc->ifstmt[0] ? svc->ifstmt : "<");
return 0;
}
@@ -704,11 +704,12 @@ int svc_conflicts(svc_t *svc)
* @is_conf: Set when called by service_mark_unavail()
* @ident: svc_t identififcation (name:id)
* @stmt: if: statement from .conf file
+ * @quiet: If non-zero, do not warn in syslog
*
* Returns:
* %TRUE(1) yes, use this svc_t, %FALSE(0) prune
*/
-int svc_ifthen(int is_conf, const char *ident, char *stmt)
+int svc_ifthen(int is_conf, const char *ident, char *stmt, int quiet)
{
char stmts[MAX_IDENT_LEN];
int not = 0;
diff --git a/src/svc.h b/src/svc.h
index f94a30e5..520aabcc 100644
--- a/src/svc.h
+++ b/src/svc.h
@@ -249,7 +249,7 @@ void svc_prune_bootstrap (void);
void svc_enable (svc_t *svc);
int svc_enabled (svc_t *svc);
int svc_conflicts (svc_t *svc);
-int svc_ifthen (int is_conf, const char *ident, char *stmt);
+int svc_ifthen (int is_conf, const char *ident, char *stmt, int quiet);
int svc_parse_jobstr (char *str, size_t len, void *user_data, int (*found)(svc_t *, void *), int (not_found)(char *, char *, void *));
--
2.34.1
@@ -0,0 +1,34 @@
From ed88469276c569acd9ef16bcc38cd80afd8dea52 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Sun, 10 Dec 2023 17:32:19 +0100
Subject: [PATCH 2/2] Actually silence the log message, missing hunk for
previous change
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/svc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/svc.c b/src/svc.c
index 6bb90049..773f0ab6 100644
--- a/src/svc.c
+++ b/src/svc.c
@@ -759,11 +759,13 @@ int svc_ifthen(int is_conf, const char *ident, char *stmt, int quiet)
svc = svc_find_by_str(stmt);
if (not && svc) {
- logit(LOG_NOTICE, "skipping %s, %s already loaded.", ident, svc_ident(svc, NULL, 0));
+ if (!quiet)
+ logit(LOG_NOTICE, "skipping %s, %s already loaded.", ident, svc_ident(svc, NULL, 0));
return 0;
}
if (!not && !svc) {
- logit(LOG_NOTICE, "skipping %s, %s not available.", ident, stmt);
+ if (!quiet)
+ logit(LOG_NOTICE, "skipping %s, %s not available.", ident, stmt);
return 0;
}
}
--
2.34.1
@@ -0,0 +1,27 @@
From 1175168ef202c32ce07a674b0c14678c5c130274 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Thu, 22 Jun 2023 10:24:57 +0200
Subject: [PATCH] Allow 'factory' as copy-from (only) in rpc copy-config
Organization: Addiva Elektronik
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/netconf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/netconf.c b/src/netconf.c
index 840debb..fa778d5 100644
--- a/src/netconf.c
+++ b/src/netconf.c
@@ -332,6 +332,8 @@ np2srv_rpc_copyconfig_cb(sr_session_ctx_t *session, uint32_t UNUSED(sub_id), con
ds = SR_DS_STARTUP;
} else if (!strcmp(nodeset->dnodes[0]->schema->name, "candidate")) {
ds = SR_DS_CANDIDATE;
+ } else if (!strcmp(nodeset->dnodes[0]->schema->name, "factory")) {
+ ds = SR_DS_FACTORY_DEFAULT; /* only allowed as copy-from */
} else {
assert(!strcmp(nodeset->dnodes[0]->schema->name, "url"));
#ifdef NP2SRV_URL_CAPAB
--
2.34.1
@@ -0,0 +1,38 @@
diff --git a/src/netconf_monitoring.c b/src/netconf_monitoring.c
index 467338b..4280a7f 100644
--- a/src/netconf_monitoring.c
+++ b/src/netconf_monitoring.c
@@ -273,11 +273,14 @@ np2srv_ncm_oper_cb(sr_session_ctx_t *session, uint32_t UNUSED(sub_id), const cha
{
struct lyd_node *root = NULL, *cont, *list;
const struct lys_module *mod;
+ const struct lysp_submodule *submod;
sr_conn_ctx_t *conn;
struct ly_ctx *ly_ctx;
char **cpblts;
char *time_str, buf[11];
uint32_t i;
+ LY_ARRAY_COUNT_TYPE u;
+ struct timespec ts;
/* context is locked while the callback is executed */
conn = sr_session_get_connection(session);
@@ -320,6 +323,18 @@ np2srv_ncm_oper_cb(sr_session_ctx_t *session, uint32_t UNUSED(sub_id), const cha
lyd_new_list(cont, NULL, "schema", 0, &list, mod->name, mod->revision ? mod->revision : "", "yin");
lyd_new_term(list, NULL, "namespace", mod->ns, 0, NULL);
lyd_new_term(list, NULL, "location", "NETCONF", 0, NULL);
+
+ LY_ARRAY_FOR(mod->parsed->includes, u) {
+ submod = mod->parsed->includes[u].submodule;
+
+ lyd_new_list(cont, NULL, "schema", 0, &list, submod->name, submod->revs ? submod->revs[0].date : "", "yang");
+ lyd_new_term(list, NULL, "namespace", mod->ns, 0, NULL);
+ lyd_new_term(list, NULL, "location", "NETCONF", 0, NULL);
+
+ lyd_new_list(cont, NULL, "schema", 0, &list, submod->name, submod->revs ? submod->revs[0].date : "", "yin");
+ lyd_new_term(list, NULL, "namespace", mod->ns, 0, NULL);
+ lyd_new_term(list, NULL, "location", "NETCONF", 0, NULL);
+ }
}
/* sessions */
@@ -1,79 +0,0 @@
From 519b1368bf36cda4bc761c6390697cc730e73f63 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Wed, 24 May 2023 06:55:41 +0200
Subject: [PATCH] netopeer2-server: add support for running in foreground with
syslog
Organization: Addiva Elektronik
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
doc/netopeer2-server.8 | 7 +++++--
src/main.c | 9 +++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/doc/netopeer2-server.8 b/doc/netopeer2-server.8
index 4caf0f7..617c552 100644
--- a/doc/netopeer2-server.8
+++ b/doc/netopeer2-server.8
@@ -2,13 +2,13 @@
.\" groff -man -Tascii netopeer2-server.8
.\"
-.TH "netopeer2-server" 8 "2021-11-10" "Netopeer"
+.TH "netopeer2-server" 8 "2023-05-25" "Netopeer"
.SH NAME
netopeer2-server \- NETCONF server daemon build on libnetconf2 with sysrepo datastore
.
.SH SYNOPSIS
.B netopeer2-server
-[\fB-dhV\fP] [\fB-p\fP \fIPATH\fP] [\fB-U\fP[\fIPATH\fP]] [\fB-m\fP \fIMODE\fP] [\fB-u\fP \fIUID\fP]
+[\fB-dFhV\fP] [\fB-p\fP \fIPATH\fP] [\fB-U\fP[\fIPATH\fP]] [\fB-m\fP \fIMODE\fP] [\fB-u\fP \fIUID\fP]
[\fB-g\fP \fIGID\fP] [\fB-t\fP \fITIMEOUT\fP] [\fB-v\fP \fILEVEL\fP] [\fB-c\fP \fICATEGORY\fP]
.br
.
@@ -22,6 +22,9 @@ YANG module data in sysrepo.
.BR "\-d"
Debug mode (do not daemonize and print verbose messages to stderr instead of syslog).
.TP
+.BR "\-F"
+Run in foreground (do not daemonize) and log to syslog.
+.TP
.BR "\-h"
Display help.
.TP
diff --git a/src/main.c b/src/main.c
index 59cc87e..b210d40 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1078,9 +1078,10 @@ print_version(void)
static void
print_usage(char *progname)
{
- fprintf(stdout, "Usage: %s [-dhV] [-p PATH] [-U[PATH]] [-m MODE] [-u UID] [-g GID] [-t TIMEOUT] [-x PATH]\n", progname);
+ fprintf(stdout, "Usage: %s [-dFhV] [-p PATH] [-U[PATH]] [-m MODE] [-u UID] [-g GID] [-t TIMEOUT] [-x PATH]\n", progname);
fprintf(stdout, " [-v LEVEL] [-c CATEGORY]\n");
fprintf(stdout, " -d Debug mode (do not daemonize and print verbose messages to stderr instead of syslog).\n");
+ fprintf(stdout, " -F Run in foreground, like -d, but log to syslog.\n");
fprintf(stdout, " -h Display help.\n");
fprintf(stdout, " -V Show program version.\n");
fprintf(stdout, " -p PATH Path to pidfile (default path is \"%s\").\n", NP2SRV_PID_FILE_PATH);
@@ -1152,11 +1153,15 @@ main(int argc, char *argv[])
np2srv.server_dir = SERVER_DIR;
/* process command line options */
- while ((c = getopt(argc, argv, "dhVp:f:U::m:u:g:n:i:t:x:v:c:")) != -1) {
+ while ((c = getopt(argc, argv, "dFhVp:f:U::m:u:g:n:i:t:x:v:c:")) != -1) {
switch (c) {
case 'd':
daemonize = 0;
break;
+ case 'F':
+ daemonize = 0;
+ np2_stderr_log = 0;
+ break;
case 'h':
print_usage(argv[0]);
return EXIT_SUCCESS;
--
2.34.1
@@ -1,16 +1,20 @@
commit 6fc440089353d76a9b8cb7c480402ee911a1387d
Author: Joachim Wiberg <troglobit@gmail.com>
Date: Tue Mar 28 10:37:53 2023 +0200
From 49c660c412342e1af76735e75cd3f286ae655b82 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Tue, 28 Mar 2023 10:37:53 +0200
Subject: [PATCH 1/4] sysrepo-plugind: add support for running in foreground
with syslog
Organization: Addiva Elektronik
sysrepo-plugind: add support for running in foreground with syslog
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/executables/sysrepo-plugind.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/executables/sysrepo-plugind.c b/src/executables/sysrepo-plugind.c
index bd584ed5..3079a855 100644
index 9ab59cb3..e689f930 100644
--- a/src/executables/sysrepo-plugind.c
+++ b/src/executables/sysrepo-plugind.c
@@ -97,6 +97,7 @@ help_print(void)
@@ -98,6 +98,7 @@ help_print(void)
" Change verbosity to a level (none, error, warning, info, debug) or\n"
" number (0, 1, 2, 3, 4).\n"
" -d, --debug Debug mode - is not daemonized and logs to stderr instead of syslog.\n"
@@ -18,7 +22,7 @@ index bd584ed5..3079a855 100644
" -P, --plugin-install <path>\n"
" Install a sysrepo-plugind plugin. The plugin is simply copied\n"
" to the designated plugin directory.\n"
@@ -200,6 +201,8 @@ daemon_init(int debug, sr_log_level_t log_level)
@@ -201,6 +202,8 @@ daemon_init(int debug, sr_log_level_t log_level)
if (debug) {
handle_signals();
@@ -27,7 +31,7 @@ index bd584ed5..3079a855 100644
sr_log_stderr(log_level);
return;
}
@@ -240,6 +243,7 @@ daemon_init(int debug, sr_log_level_t log_level)
@@ -241,6 +244,7 @@ daemon_init(int debug, sr_log_level_t log_level)
close(fd);
}
@@ -35,7 +39,7 @@ index bd584ed5..3079a855 100644
/* set verbosity */
sr_log_syslog("sysrepo-plugind", log_level);
}
@@ -459,6 +463,7 @@ main(int argc, char **argv)
@@ -466,6 +470,7 @@ main(int argc, char **argv)
{"version", no_argument, NULL, 'V'},
{"verbosity", required_argument, NULL, 'v'},
{"debug", no_argument, NULL, 'd'},
@@ -43,7 +47,7 @@ index bd584ed5..3079a855 100644
{"plugin-install", required_argument, NULL, 'P'},
{"pid-file", required_argument, NULL, 'p'},
{"fatal-plugin-fail", no_argument, NULL, 'f'},
@@ -467,7 +472,7 @@ main(int argc, char **argv)
@@ -474,7 +479,7 @@ main(int argc, char **argv)
/* process options */
opterr = 0;
@@ -52,7 +56,7 @@ index bd584ed5..3079a855 100644
switch (opt) {
case 'h':
version_print();
@@ -499,6 +504,9 @@ main(int argc, char **argv)
@@ -506,6 +511,9 @@ main(int argc, char **argv)
case 'd':
debug = 1;
break;
@@ -62,3 +66,6 @@ index bd584ed5..3079a855 100644
case 'P':
/* plugin-install */
if (get_plugins_dir(&plugins_dir)) {
--
2.34.1
@@ -1,7 +1,8 @@
From 5e919a20585392b4f2e0344bee2ac54d59c91ba4 Mon Sep 17 00:00:00 2001
From 87224ddce4ed1a118b3efb24e0dc7167f8754c22 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Wed, 7 Jun 2023 15:19:13 +0200
Subject: [PATCH] Refactor _sr_install_modules() to use ly_ctx_load_module()
Subject: [PATCH 2/4] Refactor _sr_install_modules() to use
ly_ctx_load_module()
Organization: Addiva Elektronik
This fixes issues with sysrepo discarding searchpaths and thus not
@@ -16,10 +17,10 @@ Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
3 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/src/common.c b/src/common.c
index 08630446..84149063 100644
index f8acfb81..bef98f9a 100644
--- a/src/common.c
+++ b/src/common.c
@@ -3601,7 +3601,7 @@ sr_get_trim_predicates(const char *expr, char **expr2)
@@ -3596,7 +3596,7 @@ sr_get_trim_predicates(const char *expr, char **expr2)
}
sr_error_info_t *
@@ -28,7 +29,7 @@ index 08630446..84149063 100644
{
sr_error_info_t *err_info = NULL;
const char *ptr;
@@ -3631,6 +3631,9 @@ sr_get_schema_name_format(const char *schema_path, char **module_name, LYS_INFOR
@@ -3626,6 +3626,9 @@ sr_get_schema_name_format(const char *schema_path, char **module_name, LYS_INFOR
if (ptr) {
/* truncate revision */
((char *)ptr)[0] = '\0';
@@ -39,7 +40,7 @@ index 08630446..84149063 100644
return NULL;
diff --git a/src/common.h b/src/common.h
index d955ba49..d8448da4 100644
index 00cc909f..ca5c08ca 100644
--- a/src/common.h
+++ b/src/common.h
@@ -958,10 +958,11 @@ sr_error_info_t *sr_get_trim_predicates(const char *expr, char **expr2);
@@ -56,10 +57,10 @@ index d955ba49..d8448da4 100644
/**
* @brief Get datastore string name.
diff --git a/src/sysrepo.c b/src/sysrepo.c
index 7271c273..2c0d61fd 100644
index 1387ea9d..ee30c462 100644
--- a/src/sysrepo.c
+++ b/src/sysrepo.c
@@ -1226,6 +1226,10 @@ sr_install_module_set_searchdirs(struct ly_ctx *new_ctx, const char *search_dirs
@@ -1243,6 +1243,10 @@ sr_install_module_set_searchdirs(struct ly_ctx *new_ctx, const char *search_dirs
sdirs_str = strdup(search_dirs);
SR_CHECK_MEM_GOTO(!sdirs_str, err_info, cleanup);
@@ -70,7 +71,7 @@ index 7271c273..2c0d61fd 100644
/* add each search dir */
for (ptr = strtok_r(sdirs_str, ":", &ptr2); ptr; ptr = strtok_r(NULL, ":", &ptr2)) {
if (!ly_ctx_set_searchdir(new_ctx, ptr)) {
@@ -1304,15 +1308,15 @@ sr_install_modules_prepare_mod(struct ly_ctx *new_ctx, sr_conn_ctx_t *conn, sr_i
@@ -1321,15 +1325,15 @@ sr_install_modules_prepare_mod(struct ly_ctx *new_ctx, sr_conn_ctx_t *conn, sr_i
{
sr_error_info_t *err_info = NULL;
const struct lys_module *ly_mod;
@@ -88,7 +89,7 @@ index 7271c273..2c0d61fd 100644
goto cleanup;
}
@@ -1345,14 +1349,9 @@ sr_install_modules_prepare_mod(struct ly_ctx *new_ctx, sr_conn_ctx_t *conn, sr_i
@@ -1362,14 +1366,9 @@ sr_install_modules_prepare_mod(struct ly_ctx *new_ctx, sr_conn_ctx_t *conn, sr_i
goto cleanup;
}
@@ -106,7 +107,7 @@ index 7271c273..2c0d61fd 100644
goto cleanup;
}
@@ -1375,8 +1374,12 @@ sr_install_modules_prepare_mod(struct ly_ctx *new_ctx, sr_conn_ctx_t *conn, sr_i
@@ -1392,8 +1391,12 @@ sr_install_modules_prepare_mod(struct ly_ctx *new_ctx, sr_conn_ctx_t *conn, sr_i
}
cleanup:
@@ -121,7 +122,7 @@ index 7271c273..2c0d61fd 100644
return err_info;
}
@@ -1834,7 +1837,7 @@ sr_update_modules_prepare(struct ly_ctx *new_ctx, sr_conn_ctx_t *conn, const cha
@@ -1851,7 +1854,7 @@ sr_update_modules_prepare(struct ly_ctx *new_ctx, sr_conn_ctx_t *conn, const cha
for (i = 0; i < schema_path_count; ++i) {
/* learn about the module */
upd_mods[i].schema_path = schema_paths[i];
@@ -1,7 +1,7 @@
From bef358ba11b01c248b45fbe003d8d3ded0acb657 Mon Sep 17 00:00:00 2001
From 2d3b9524b1448dd6a8ef83e4e101e509d2552dcc Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Fri, 16 Jun 2023 12:13:16 +0200
Subject: [PATCH 2/2] Add support for loading /etc/sysrepo/factory-default
Subject: [PATCH 3/4] Add support for loading /etc/sysrepo/factory-default
Organization: Addiva Elektronik
Follow-up to 3d07270 which adds support for compile-time defaults, this
@@ -16,10 +16,10 @@ Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
3 files changed, 57 insertions(+), 6 deletions(-)
diff --git a/src/common.c b/src/common.c
index 84149063..ff9ba96e 100644
index bef98f9a..bbb0c949 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1317,6 +1317,35 @@ sr_path_conn_lockfile(sr_cid_t cid, int creat, char **path)
@@ -1306,6 +1306,35 @@ sr_path_conn_lockfile(sr_cid_t cid, int creat, char **path)
return err_info;
}
@@ -56,7 +56,7 @@ index 84149063..ff9ba96e 100644
sr_remove_evpipes(void)
{
diff --git a/src/common.h b/src/common.h
index d8448da4..37f7ede6 100644
index ca5c08ca..e8d394ef 100644
--- a/src/common.h
+++ b/src/common.h
@@ -479,6 +479,17 @@ sr_error_info_t *sr_path_yang_file(const char *mod_name, const char *mod_rev, ch
@@ -1,186 +0,0 @@
From 429d89a2254b29cd51758e4c6d2f7178d8b2120a Mon Sep 17 00:00:00 2001
From: Michal Vasko <mvasko@cesnet.cz>
Date: Thu, 15 Jun 2023 09:36:57 +0200
Subject: [PATCH 1/2] lyd mods UPDATE allow custom start data for internal
modules
Organization: Addiva Elektronik
Compile-time variable with the path to a file with the data.
NOTE: Squashed two upstream commits in backport to kkit.
Signed-off-by: Michal Vasko <mvasko@cesnet.cz>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
CMakeLists.txt | 24 +++++++++++++++-
README.md | 5 ++++
src/config.h.in | 4 +++
src/lyd_mods.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++--
4 files changed, 103 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f4b0b2f2..08480779 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -100,7 +100,29 @@ endif()
option(ENABLE_EXAMPLES "Build examples." ON)
option(ENABLE_COVERAGE "Build code coverage report from tests" OFF)
option(INSTALL_SYSCTL_CONF "Install sysctl conf file to allow shared access to SHM files." OFF)
-set(YANG_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/yang/modules/sysrepo" CACHE STRING "Directory where to copy the YANG modules to")
+set(YANG_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/yang/modules/sysrepo" CACHE STRING "Directory where to copy the YANG modules to.")
+set(INTERNAL_MODULE_DATA_PATH "" CACHE STRING "Path to a file with startup and factory-default data of internal modules. Contents of the file are compiled into the library.")
+if(INTERNAL_MODULE_DATA_PATH)
+ if(NOT EXISTS "${INTERNAL_MODULE_DATA_PATH}")
+ message(FATAL_ERROR "File \"${INTERNAL_MODULE_DATA_PATH}\" does not exist.")
+ endif()
+ string(REGEX MATCH "[.](xml|json)$" EXT ${INTERNAL_MODULE_DATA_PATH})
+ if(NOT EXT)
+ message(FATAL_ERROR "File \"${INTERNAL_MODULE_DATA_PATH}\" with an unknown extension.")
+ endif()
+
+ file(READ "${INTERNAL_MODULE_DATA_PATH}" INTERNAL_MODULE_DATA_RAW)
+ string(REPLACE "\n" "\\\n" INTERNAL_MODULE_DATA ${INTERNAL_MODULE_DATA_RAW})
+
+ if(${EXT} STREQUAL ".xml")
+ set(INTERNAL_MODULE_DATA_FORMAT LYD_XML)
+ else()
+ set(INTERNAL_MODULE_DATA_FORMAT LYD_JSON)
+ endif()
+else()
+ # empty data but the code needs a format
+ set(INTERNAL_MODULE_DATA_FORMAT LYD_XML)
+endif()
# ietf-yang-library revision
set(YANGLIB_REVISION "2019-01-04" CACHE STRING
diff --git a/README.md b/README.md
index 3d0e7aa4..39c47473 100644
--- a/README.md
+++ b/README.md
@@ -147,6 +147,11 @@ Set [NACM](#NACM) configuration data and 'sysrepo-monitoring' default permission
```
-DNACM_SRMON_DATA_PERM=000
```
+
+Set `startup` and `factory-default` datastore data for internal modules (such as `ietf-netconf-acm`):
+```
+-DINTERNAL_MODULE_DATA_PATH=/etc/config/factory_default_config.xml
+```
### Useful CMake Build Options
#### Changing Compiler
diff --git a/src/config.h.in b/src/config.h.in
index 92040b0e..7f7b915c 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -76,6 +76,10 @@
/** if not set, defaults to "SR_REPO_PATH/yang" */
#define SR_YANG_PATH "@YANG_MODULE_PATH@"
+/** internal module startup and factory-default data and their format */
+#define SR_INT_MOD_DATA "@INTERNAL_MODULE_DATA@"
+#define SR_INT_MOD_DATA_FORMAT @INTERNAL_MODULE_DATA_FORMAT@
+
/** where SHM files are stored */
#define SR_SHM_DIR "@SHM_DIR@"
diff --git a/src/lyd_mods.c b/src/lyd_mods.c
index 13397fa8..94e97b97 100644
--- a/src/lyd_mods.c
+++ b/src/lyd_mods.c
@@ -4,8 +4,8 @@
* @brief Sysrepo module data routines
*
* @copyright
- * Copyright (c) 2018 - 2022 Deutsche Telekom AG.
- * Copyright (c) 2018 - 2022 CESNET, z.s.p.o.
+ * Copyright (c) 2018 - 2023 Deutsche Telekom AG.
+ * Copyright (c) 2018 - 2023 CESNET, z.s.p.o.
*
* This source code is licensed under BSD 3-Clause License (the "License").
* You may not use this file except in compliance with the License.
@@ -943,6 +943,70 @@ sr_lydmods_print(struct lyd_node **sr_mods)
return NULL;
}
+/**
+ * @brief Set startup and factory-default datastore data for implemented internal modules.
+ *
+ * @param[in] ly_ctx Context with the internal modules.
+ * @return err_info, NULL on success.
+ */
+static sr_error_info_t *
+sr_lydmods_create_data(const struct ly_ctx *ly_ctx)
+{
+ sr_error_info_t *err_info = NULL;
+ const struct lys_module *ly_mod;
+ struct lyd_node *data = NULL, *mod_data = NULL, *mod_diff = NULL;
+ uint32_t idx = 0;
+ int rc;
+
+ if (!strlen(SR_INT_MOD_DATA)) {
+ /* no data to set */
+ goto cleanup;
+ }
+
+ /* parse and validate the data */
+ if (lyd_parse_data_mem(ly_ctx, SR_INT_MOD_DATA, SR_INT_MOD_DATA_FORMAT, 0, LYD_VALIDATE_NO_STATE, &data)) {
+ sr_errinfo_new_ly(&err_info, ly_ctx, NULL);
+ goto cleanup;
+ }
+
+ while ((ly_mod = ly_ctx_get_module_iter(ly_ctx, &idx))) {
+ if (!ly_mod->implemented) {
+ continue;
+ }
+
+ /* get the data for this module */
+ lyd_free_siblings(mod_data);
+ mod_data = sr_module_data_unlink(&data, ly_mod);
+ if (!mod_data) {
+ continue;
+ }
+
+ /* generate a diff */
+ lyd_free_siblings(mod_diff);
+ if (lyd_diff_siblings(NULL, mod_data, LYD_DIFF_DEFAULTS, &mod_diff)) {
+ sr_errinfo_new_ly(&err_info, ly_ctx, mod_data);
+ goto cleanup;
+ }
+ assert(mod_diff);
+
+ /* store the data using the internal JSON plugin */
+ if ((rc = srpds_json.store_cb(ly_mod, SR_DS_STARTUP, mod_diff, mod_data))) {
+ SR_ERRINFO_DSPLUGIN(&err_info, rc, "store", srpds_json.name, ly_mod->name);
+ goto cleanup;
+ }
+ if ((rc = srpds_json.store_cb(ly_mod, SR_DS_FACTORY_DEFAULT, mod_diff, mod_data))) {
+ SR_ERRINFO_DSPLUGIN(&err_info, rc, "store", srpds_json.name, ly_mod->name);
+ goto cleanup;
+ }
+ }
+
+cleanup:
+ lyd_free_siblings(mod_data);
+ lyd_free_siblings(mod_diff);
+ lyd_free_siblings(data);
+ return err_info;
+}
+
/**
* @brief Create default sysrepo module data. All libyang internal implemented modules
* are installed into sysrepo. Sysrepo internal modules ietf-netconf, ietf-netconf-with-defaults,
@@ -1042,6 +1106,11 @@ sr_lydmods_create(struct ly_ctx *ly_ctx, struct lyd_node **sr_mods_p)
goto cleanup;
}
+ /* set the startup and factory-default data, if any */
+ if ((err_info = sr_lydmods_create_data(ly_ctx))) {
+ goto cleanup;
+ }
+
cleanup:
free(new_mods);
if (err_info) {
--
2.34.1
@@ -1,18 +1,18 @@
From 1d5954d87cdc8a180d917a1d807000e0b4a3a2de Mon Sep 17 00:00:00 2001
From 7726017815243818f07936e4ff3bb979e9291f04 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Fri, 16 Jun 2023 16:17:27 +0200
Subject: [PATCH] sysrepoctl: add support for -Cfactory -d running
Subject: [PATCH 4/4] sysrepoctl: add support for -Cfactory -d running
Organization: Addiva Elektronik
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/common.h | 3 +++
src/executables/sysrepocfg.c | 2 ++
src/executables/sysrepocfg.c | 2 +-
src/sysrepo.c | 2 +-
3 files changed, 6 insertions(+), 1 deletion(-)
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/common.h b/src/common.h
index 37f7ede6..a092728f 100644
index e8d394ef..39fcce3a 100644
--- a/src/common.h
+++ b/src/common.h
@@ -42,6 +42,9 @@ struct srplg_ntf_s;
@@ -26,23 +26,23 @@ index 37f7ede6..a092728f 100644
#define SR_IS_STANDARD_DS(ds) (SR_IS_CONVENTIONAL_DS(ds) || (ds == SR_DS_OPERATIONAL))
diff --git a/src/executables/sysrepocfg.c b/src/executables/sysrepocfg.c
index 4067063c..839f093b 100644
index 0c719e2c..65e56696 100644
--- a/src/executables/sysrepocfg.c
+++ b/src/executables/sysrepocfg.c
@@ -647,6 +647,8 @@ arg_get_ds(const char *optarg, sr_datastore_t *ds)
@@ -730,7 +730,7 @@ arg_get_ds(const char *optarg, sr_datastore_t *ds)
*ds = SR_DS_CANDIDATE;
} else if (!strcmp(optarg, "operational")) {
*ds = SR_DS_OPERATIONAL;
+ } else if (!strcmp(optarg, "factory")) {
+ *ds = SR_DS_FACTORY_DEFAULT;
- } else if (!strcmp(optarg, "factory-default")) {
+ } else if (!strcmp(optarg, "factory-default") || !strcmp(optarg, "factory")) {
*ds = SR_DS_FACTORY_DEFAULT;
} else {
error_print(0, "Unknown datastore \"%s\"", optarg);
return -1;
diff --git a/src/sysrepo.c b/src/sysrepo.c
index 2c0d61fd..26c65851 100644
index ee30c462..ca2a20b7 100644
--- a/src/sysrepo.c
+++ b/src/sysrepo.c
@@ -4012,7 +4012,7 @@ sr_copy_config(sr_session_ctx_t *session, const char *module_name, sr_datastore_
@@ -4037,7 +4037,7 @@ sr_copy_config(sr_session_ctx_t *session, const char *module_name, sr_datastore_
struct sr_mod_info_s mod_info;
const struct lys_module *ly_mod = NULL;
-1
View File
@@ -712,5 +712,4 @@ UseTab: Always
#
ColumnLimit: 0
ForEachMacros: ['LYX_LIST_FOR_EACH', 'TAILQ_FOREACH', 'LY_LIST_FOR', 'json_array_foreach']
UseTab: AlignWithSpaces
...
+1 -1
View File
@@ -1,2 +1,2 @@
pkglibexec_SCRIPTS = bootstrap error load \
gen-hostkeys gen-admin-auth gen-hostname gen-interfaces
gen-hostkeys gen-admin-auth gen-hostname gen-interfaces gen-motd
+11 -4
View File
@@ -97,11 +97,12 @@ factory()
# Create an overlay for /etc/hostname to change the default in an br2-external
gen-hostname >"$FACTORY_D/20-hostname.json"
gen-motd >"$FACTORY_D/20-motd.json"
# shellcheck disable=SC2086
gen-interfaces $GEN_IFACE_OPTS >"$FACTORY_D/20-interfaces.json"
# Extract password for admin user from VPD
if ! gen-admin-auth infix-shell-type:clish >"$FACTORY_D/20-authentication.json"; then
if ! gen-admin-auth infix-shell-type:bash >"$FACTORY_D/20-authentication.json"; then
console_error "Unable to create factory-config, gen-admin-auth failed"
return
fi
@@ -205,21 +206,27 @@ sysrepoctl -s $SEARCH \
-i ietf-routing@2018-03-13.yang -g wheel -p 0660 \
-i ietf-ipv6-unicast-routing@2018-03-13.yang -g wheel -p 0660 \
-i ietf-ipv4-unicast-routing@2018-03-13.yang -g wheel -p 0660 \
-i ietf-ospf@2022-10-19.yang -g wheel -p 0660 \
-e bfd \
-e explicit-router-id \
-i iana-if-type@2023-01-26.yang -g wheel -p 0660 \
-i iana-hardware@2018-03-13.yang -g wheel -p 0660 \
-i ietf-hardware@2018-03-13.yang -g wheel -p 0660 \
-i infix-hardware@2024-01-18.yang -g wheel -p 0660 \
-i ieee802-dot1q-types@2022-10-29.yang -g wheel -p 0660 \
-i infix-ip@2023-09-14.yang -g wheel -p 0660 \
-i infix-if-type@2023-08-21.yang -g wheel -p 0660 \
-i infix-routing@2023-11-23.yang -g wheel -p 0660 \
-i infix-routing@2024-01-09.yang -g wheel -p 0660 \
-i infix-interfaces@2023-09-19.yang -g wheel -p 0660 \
-e vlan-filtering \
-i ieee802-dot1ab-lldp@2022-03-15.yang -g wheel -p 0660 \
-i infix-lldp@2023-08-23.yang -g wheel -p 0660 \
-i infix-dhcp-client@2023-05-22.yang -g wheel -p 0660 \
-i infix-dhcp-client@2024-01-30.yang -g wheel -p 0660 \
-i infix-shell-type@2023-08-21.yang -g wheel -p 0660 \
-i infix-system@2023-10-19.yang -g wheel -p 0660 \
-i infix-services@2023-10-16.yang -g wheel -p 0660 \
-i ieee802-ethernet-interface@2019-06-21.yang -g wheel -p 0660 \
-i infix-ethernet-interface@2023-11-22.yang -g wheel -p 0660 \
-i infix-ethernet-interface@2024-01-22.yang -g wheel -p 0660 \
-I "${INIT_DATA}"
rc=$?
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
set -e
if [ -f /etc/motd ]; then
cat <<EOF
{
"ietf-system:system": {
"infix-system:motd": "$(sed ':a;N;$!ba;s/\n/\\n/g;s/\t/\\t/g' /etc/motd)"
}
}
EOF
else
echo "{}"
fi
+217 -29
View File
@@ -7,19 +7,149 @@
#include "core.h"
#define XPATH_BASE_ "/ietf-routing:routing"
#define XPATH_STATIC_ROUTES_ XPATH_BASE_ "/control-plane-protocols/control-plane-protocol"
#define XPATH_BASE_ "/ietf-routing:routing/control-plane-protocols/control-plane-protocol"
#define XPATH_OSPF_ XPATH_BASE_ "/ietf-ospf:ospf"
#define STATICD_CONF "/etc/frr/staticd.conf"
#define STATICD_CONF_NEXT STATICD_CONF "+"
#define STATICD_CONF_PREV STATICD_CONF "-"
#define FRR_STATIC_CONFIG "! Generated by Infix\n\
frr defaults traditional\n \
hostname Router \n\
password zebra \n \
enable password zebra \n \
log syslog informational \n"
#define OSPFD_CONF "/etc/frr/ospfd.conf"
#define OSPFD_CONF_NEXT OSPFD_CONF "+"
#define OSPFD_CONF_PREV OSPFD_CONF "-"
#define BFDD_CONF "/etc/frr/bfd_enabled" /* Just signal that bfd should be enabled*/
static int parse_route(struct lyd_node *parent, FILE *fp)
#define FRR_STATIC_CONFIG "! Generated by Infix\n\
frr defaults traditional\n\
hostname Router\n\
password zebra \n\
enable password zebra\n\
log syslog informational\n"
int parse_ospf_interfaces(sr_session_ctx_t *session, struct lyd_node *areas, FILE *fp)
{
struct lyd_node *interface, *interfaces, *area;
int bfd_enabled = 0;
LY_LIST_FOR(lyd_child(areas), area) {
interfaces = lydx_get_child(area, "interfaces");
const char *area_id = lydx_get_cattr(area, "area-id");
LY_LIST_FOR(lyd_child(interfaces), interface) {
const char *hello, *dead, *retransmit, *transmit, *interface_type, *cost;
if (lydx_get_bool(interface, "enabled")) {
struct lyd_node *bfd;
int passive = 0;
bfd = lydx_get_child(interface, "bfd");
bfd_enabled += lydx_get_bool(bfd, "enabled");
passive = lydx_get_bool(interface, "passive");
fprintf(fp, "interface %s\n", lydx_get_cattr(interface, "name"));
hello = lydx_get_cattr(interface, "hello-interval");
dead = lydx_get_cattr(interface, "dead-interval");
retransmit = lydx_get_cattr(interface, "retransmit-interval");
transmit = lydx_get_cattr(interface, "transmit-delay");
interface_type = lydx_get_cattr(interface, "interface-type");
cost = lydx_get_cattr(interface, "cost");
fprintf(fp, " ip ospf area %s\n", area_id);
if (dead)
fprintf(fp, " ip ospf dead-interval %s\n", dead);
if (hello)
fprintf(fp, " ip ospf hello-interval %s\n", hello);
if (retransmit)
fprintf(fp, " ip ospf retransmit-interval %s\n", retransmit);
if (transmit)
fprintf(fp, " ip ospf transmit-delay %s\n", transmit);
if (bfd_enabled)
fputs(" ip ospf bfd\n", fp);
if (passive)
fputs(" ip ospf passive\n", fp);
if (interface_type)
fprintf(fp, " ip ospf network %s\n", interface_type);
if (cost)
fprintf(fp, " ip ospf cost %s\n", cost);
}
}
}
return bfd_enabled;
}
int parse_ospf_redistribute(sr_session_ctx_t *session, struct lyd_node *redistributes, FILE *fp)
{
struct lyd_node *tmp;
LY_LIST_FOR(lyd_child(redistributes), tmp) {
const char *protocol = lydx_get_cattr(tmp, "protocol");
fprintf(fp, " redistribute %s\n", protocol);
}
return 0;
}
int parse_ospf_areas(sr_session_ctx_t *session, struct lyd_node *areas, FILE *fp)
{
struct lyd_node *area;
int areas_configured = 0;
LY_LIST_FOR(lyd_child(areas), area) {
const char *area_id, *area_type, *default_cost;
int summary;
area_id = lydx_get_cattr(area, "area-id");
area_type = lydx_get_cattr(area, "area-type");
default_cost = lydx_get_cattr(area, "default-cost");
summary = lydx_get_bool(area, "summary");
if (area_type) {
int stub_or_nssa = 0;
if (!strcmp(area_type, "nssa-area")) {
stub_or_nssa = 1;
fprintf(fp, " area %s nssa %s\n", area_id, !summary ? "no-summary" : "");
} else if (!strcmp(area_type, "stub-area")) {
stub_or_nssa = 1;
fprintf(fp, " area %s stub %s\n", area_id, !summary ? "no-summary" : "");
}
if (stub_or_nssa && default_cost)
fprintf(fp, " area %s default-cost %s\n", area_id, default_cost);
}
areas_configured++;
}
return areas_configured;
}
int parse_ospf(sr_session_ctx_t *session, struct lyd_node *ospf)
{
struct lyd_node *areas, *default_route;
int num_areas = 0;
int bfd_enabled = 0;
const char *router_id;
FILE *fp;
fp = fopen(OSPFD_CONF_NEXT, "w");
if (!fp) {
ERROR("Failed to open %s", OSPFD_CONF_NEXT);
return SR_ERR_INTERNAL;
}
fputs(FRR_STATIC_CONFIG, fp);
areas = lydx_get_child(ospf, "areas");
router_id = lydx_get_cattr(ospf, "explicit-router-id");
bfd_enabled = parse_ospf_interfaces(session, areas, fp);
fputs("router ospf\n", fp);
num_areas = parse_ospf_areas(session, areas, fp);
parse_ospf_redistribute(session, lydx_get_child(ospf, "redistribute"), fp);
default_route = lydx_get_child(ospf, "default-route-advertise");
if (default_route) {
if (lydx_get_bool(default_route, "enable")) {
fputs(" default-information originate", fp);
if (lydx_get_bool(default_route, "always"))
fputs(" always", fp);
fputs("\n", fp);
}
}
if (router_id)
fprintf(fp, " ospf router-id %s\n", router_id);
fclose(fp);
if (!bfd_enabled)
(void)remove(BFDD_CONF);
if (!num_areas) {
(void)remove(OSPFD_CONF_NEXT);
return 0;
}
if (bfd_enabled)
touch(BFDD_CONF);
return 0;
}
static int parse_route(struct lyd_node *parent, FILE *fp, char *ip)
{
const char *outgoing_interface, *next_hop_address, *special_next_hop, *destination_prefix;
struct lyd_node *next_hop;
@@ -30,7 +160,7 @@ static int parse_route(struct lyd_node *parent, FILE *fp)
next_hop_address = lydx_get_cattr(next_hop, "next-hop-address");
special_next_hop = lydx_get_cattr(next_hop, "special-next-hop");
fprintf(fp, "ip route %s ", destination_prefix);
fprintf(fp, "%s route %s ", ip, destination_prefix);
/* There can only be one */
if (outgoing_interface)
@@ -50,13 +180,21 @@ static int parse_route(struct lyd_node *parent, FILE *fp)
static int parse_static_routes(sr_session_ctx_t *session, struct lyd_node *parent, FILE *fp)
{
struct lyd_node *ipv4, *v4routes, *route;
struct lyd_node *ipv4, *v4routes, *ipv6, *v6routes, *route;
int num_routes = 0;
ipv4 = lydx_get_child(parent, "ipv4");
ipv6 = lydx_get_child(parent, "ipv6");
ipv4 = lydx_get_child(parent, "ipv4");
ipv6 = lydx_get_child(parent, "ipv6");
v4routes = lydx_get_child(ipv4, "route");
v6routes = lydx_get_child(ipv6, "route");
LY_LIST_FOR(v4routes, route) {
parse_route(route, fp);
parse_route(route, fp, "ip");
num_routes++;
}
LY_LIST_FOR(v6routes, route) {
parse_route(route, fp, "ipv6");
num_routes++;
}
@@ -67,8 +205,10 @@ static int parse_static_routes(sr_session_ctx_t *session, struct lyd_node *paren
static int change_control_plane_protocols(sr_session_ctx_t *session, uint32_t sub_id, const char *module,
const char *xpath, sr_event_t event, unsigned request_id, void *priv)
{
int staticd_enabled = 0, ospfd_enabled = 0, bfdd_enabled = 0;
bool ospfd_running, staticd_running, bfdd_running;
struct lyd_node *cplane, *tmp;
int staticd_enabled = 0;
bool restart_zebra = false;
int rc = SR_ERR_OK;
sr_data_t *cfg;
FILE *fp;
@@ -91,8 +231,12 @@ static int change_control_plane_protocols(sr_session_ctx_t *session, uint32_t su
case SR_EV_DONE:
/* Check if passed validation in previous event */
staticd_enabled = fexist(STATICD_CONF_NEXT);
if (!staticd_enabled) {
ospfd_enabled = fexist(OSPFD_CONF_NEXT);
bfdd_enabled = fexist(BFDD_CONF);
staticd_running = !systemf("initctl -bfq status staticd");
ospfd_running = !systemf("initctl -bfq status ospfd");
bfdd_running = !systemf("initctl -bfq status bfdd");
if (staticd_running && !staticd_enabled) {
if (systemf("initctl -bfq disable staticd")) {
ERROR("Failed to disable static routing daemon");
rc = SR_ERR_INTERNAL;
@@ -100,23 +244,67 @@ static int change_control_plane_protocols(sr_session_ctx_t *session, uint32_t su
}
/* Remove all generated files */
(void)remove(STATICD_CONF);
return SR_ERR_OK;
}
(void)remove(STATICD_CONF_PREV);
(void)rename(STATICD_CONF, STATICD_CONF_PREV);
(void)rename(STATICD_CONF_NEXT, STATICD_CONF);
if (systemf("initctl -bfq status staticd")) {
if (staticd_enabled) {
if (bfdd_running && !bfdd_enabled) {
if (systemf("initctl -bfq disable bfdd")) {
ERROR("Failed to disable BFD routing daemon");
rc = SR_ERR_INTERNAL;
goto err_abandon;
}
/* Remove all generated files */
(void)remove(BFDD_CONF);
}
if (ospfd_running && !ospfd_enabled) {
if (systemf("initctl -bfq disable ospfd")) {
ERROR("Failed to disable OSPF routing daemon");
rc = SR_ERR_INTERNAL;
goto err_abandon;
}
/* Remove all generated files */
(void)remove(OSPFD_CONF);
}
if (bfdd_enabled) {
if (!bfdd_running) {
if (systemf("initctl -bfq enable bfdd")) {
ERROR("Failed to enable OSPF routing daemon");
rc = SR_ERR_INTERNAL;
goto err_abandon;
}
}
}
if (ospfd_enabled) {
(void)remove(OSPFD_CONF_PREV);
(void)rename(OSPFD_CONF, OSPFD_CONF_PREV);
(void)rename(OSPFD_CONF_NEXT, OSPFD_CONF);
if (!ospfd_running) {
if (ospfd_enabled) {
if (systemf("initctl -bfq enable ospfd")) {
ERROR("Failed to enable OSPF routing daemon");
rc = SR_ERR_INTERNAL;
goto err_abandon;
}
}
} else {
restart_zebra = true;
}
}
if (staticd_enabled) {
(void)remove(STATICD_CONF_PREV);
(void)rename(STATICD_CONF, STATICD_CONF_PREV);
(void)rename(STATICD_CONF_NEXT, STATICD_CONF);
if (!staticd_running) {
if (systemf("initctl -bfq enable staticd")) {
ERROR("Failed to enable static routing daemon");
rc = SR_ERR_INTERNAL;
goto err_abandon;
}
} else {
restart_zebra = true;
}
} else {
}
if (restart_zebra) {
if (systemf("initctl -bfq restart zebra")) {
ERROR("Failed to restart static routing daemon");
ERROR("Failed to restart zebra routing daemon");
rc = SR_ERR_INTERNAL;
goto err_abandon;
}
@@ -128,15 +316,15 @@ static int change_control_plane_protocols(sr_session_ctx_t *session, uint32_t su
}
rc = sr_get_data(session, "/ietf-routing:routing/control-plane-protocols//.", 0, 0, 0, &cfg);
LY_LIST_FOR(lyd_child(cfg->tree), tmp)
{
LY_LIST_FOR(lyd_child(tmp), cplane)
{
LY_LIST_FOR(lyd_child(cfg->tree), tmp) {
LY_LIST_FOR(lyd_child(tmp), cplane) {
const char *type;
type = lydx_get_cattr(cplane, "type");
if (!strcmp(type, "ietf-routing:static")) {
if (!strcmp(type, "static")) {
staticd_enabled = parse_static_routes(session, lydx_get_child(cplane, "static-routes"), fp);
} else if (!strcmp(type, "ietf-ospf:ospfv2")) {
parse_ospf(session, lydx_get_child(cplane, "ospf"));
}
}
}
+59 -52
View File
@@ -361,19 +361,14 @@ static int change_clock(sr_session_ctx_t *session, uint32_t sub_id, const char *
return SR_ERR_OK;
}
#define CHRONY_CONF "/etc/chrony.conf"
#define CHRONY_PREV CHRONY_CONF "-"
#define CHRONY_NEXT CHRONY_CONF "+"
static int change_ntp(sr_session_ctx_t *session, uint32_t sub_id, const char *module,
const char *xpath, sr_event_t event, unsigned request_id, void *priv)
{
const char *fn = CHRONY_NEXT;
int valid = -1;
sr_change_iter_t *iter = NULL;
int rc, err = SR_ERR_OK;
int changes = 0;
sr_val_t *val;
size_t cnt;
FILE *fp;
int rc;
switch (event) {
case SR_EV_ENABLED: /* first time, on register. */
@@ -382,26 +377,20 @@ static int change_ntp(sr_session_ctx_t *session, uint32_t sub_id, const char *mo
break;
case SR_EV_ABORT: /* User abort, or other plugin failed */
(void)remove(CHRONY_NEXT);
return SR_ERR_OK;
case SR_EV_DONE:
/* Check if passed validation in previous event */
if (access(CHRONY_NEXT, F_OK))
return SR_ERR_OK;
(void)remove(CHRONY_PREV);
(void)rename(CHRONY_CONF, CHRONY_PREV);
(void)rename(CHRONY_NEXT, CHRONY_CONF);
if (!srx_enabled(session, XPATH_BASE_"/ntp/enabled")) {
systemf("rm -rf /etc/chrony/conf.d/* /etc/chrony/sources.d/*");
systemf("initctl -nbq disable chronyd");
return SR_ERR_OK;
}
/*
* If chrony is alrady enabled we tell Finit it's been
* modified , so Finit restarts it, otherwise enable it.
*/
systemf("initctl -nbq touch chronyd");
if (fexist("/run/chrony/.changes")) {
systemf("chronyc reload sources >/dev/null");
erase("/run/chrony/.changes");
}
systemf("initctl -nbq enable chronyd");
return SR_ERR_OK;
@@ -409,30 +398,57 @@ static int change_ntp(sr_session_ctx_t *session, uint32_t sub_id, const char *mo
return SR_ERR_OK;
}
rc = sr_get_items(session, XPATH_BASE_"/ntp/server", 0, 0, &val, &cnt);
if (rc) {
(void)remove(CHRONY_NEXT);
return rc;
/*
* First remove .sources files for all deleted servers
*/
sr_get_changes_iter(session, XPATH_BASE_"/ntp/server[name=*]/name", &iter);
if (iter) {
sr_change_oper_t op;
sr_val_t *old, *new;
while (!sr_get_change_next(session, iter, &op, &old, &new)) {
char *name;
if (op != SR_OP_DELETED)
continue;
name = sr_val_to_str(old);
DEBUG("Removing NTP server %s\n", name);
erasef("/etc/chrony/sources.d/%s.sources", name);
free(name);
changes++;
}
sr_free_change_iter(iter);
}
fp = fopen(fn, "w");
if (!fp) {
ERROR("failed updating %s: %s", fn, strerror(errno));
sr_free_values(val, cnt);
return SR_ERR_SYS;
/*
* Then add or recreate any new or modified sources
*/
rc = sr_get_items(session, XPATH_BASE_"/ntp/server", 0, 0, &val, &cnt);
if (rc) {
return SR_ERR_OK;
}
for (size_t i = 0; i < cnt; i++) {
const char *xpath = val[i].xpath;
char *type, *ptr;
char *type, *ptr, *name;
int server = 0;
FILE *fp;
/*
* Handle empty startup-config on SR_EV_ENABLED,
* prevents subscribe failure due to false invalid.
*/
if (i == 0)
valid = 0;
name = srx_get_str(session, "%s/name", xpath);
if (!name) {
ERROR("no name for xpath %s", xpath);
continue;
}
fp = fopenf("w", "/etc/chrony/sources.d/%s.sources", name);
if (!fp) {
ERROR("failed saving /etc/chrony/sources.d/%s.sources: %s",
name, strerror(errno));
free(name);
continue;
}
/* Get /ietf-system:system/ntp/server[name='foo'] */
ptr = srx_get_str(session, "%s/udp/address", xpath);
@@ -456,26 +472,17 @@ static int change_ntp(sr_session_ctx_t *session, uint32_t sub_id, const char *mo
fprintf(fp, " iburst");
if (srx_enabled(session, "%s/prefer", xpath) > 0)
fprintf(fp, " prefer");
fprintf(fp, "\n");
valid++;
}
fprintf(fp, "\n");
fclose(fp);
changes++;
}
sr_free_values(val, cnt);
fprintf(fp, "driftfile /var/lib/chrony/drift\n");
fprintf(fp, "makestep 1.0 3\n");
fprintf(fp, "maxupdateskew 100.0\n");
fprintf(fp, "dumpdir /var/lib/chrony\n");
fprintf(fp, "rtcfile /var/lib/chrony/rtc\n");
fclose(fp);
if (changes)
touch("/run/chrony/.changes");
if (!valid) {
(void)remove(fn);
return SR_ERR_VALIDATION_FAILED;
}
return SR_ERR_OK;
return err;
}
#define RESOLV_CONF "/etc/resolv.conf.head"
+326 -24
View File
@@ -13,35 +13,268 @@
#include <srx/srx_val.h>
#include "core.h"
#define ARPING_MSEC 1000
#define MODULE "infix-dhcp-client"
#define XPATH "/infix-dhcp-client:dhcp-client"
static const struct srx_module_requirement infix_dhcp_reqs[] = {
{ .dir = YANG_PATH_, .name = "infix-dhcp-client", .rev = "2023-05-22" },
static const struct srx_module_requirement reqs[] = {
{ .dir = YANG_PATH_, .name = MODULE, .rev = "2024-01-30" },
{ NULL }
};
static void add(const char *ifname, const char *client_id)
static char *ip_cache(const char *ifname, char *str, size_t len)
{
char *args = NULL;
const char *fn = "/var/lib/misc/%s.cache";
struct in_addr ina;
char buf[128];
FILE *fp;
fp = fopenf("w", "/etc/finit.d/available/dhcp-%s.conf", ifname);
if (!fp) {
ERROR("failed creating DHCP client service for %s: %s",
ifname, strerror(errno));
return;
if (!fexistf(fn, ifname))
return NULL;
fp = fopenf("r", fn, ifname);
if (!fp)
return NULL;
if (!fgets(buf, sizeof(buf), fp)) {
fclose(fp);
return NULL;
}
fclose(fp);
chomp(buf);
if (!inet_aton(buf, &ina)) {
erasef(fn, ifname);
return NULL;
}
snprintf(str, len, "-r %.15s ", buf);
return str;
}
static char *hostname(const char *ifname, char *str, size_t len)
{
FILE *fp;
int pos;
(void)ifname;
fp = fopen("/etc/hostname", "r");
if (!fp)
return NULL;
pos = snprintf(str, len, "-x hostname:");
if (!fgets(&str[pos], len - pos, fp))
str[0] = 0;
fclose(fp);
chomp(str);
strlcat(str, " ", len);
return str;
}
static char *fqdn(const char *value, char *str, size_t len)
{
snprintf(str, len, "-F \"%s\" ", value);
return str;
}
static char *unquote(char *buf)
{
char q = buf[0];
char *ptr;
if (q != '"' && q != '\'')
return buf;
ptr = &buf[strlen(buf) - 1];
if (*ptr == q) {
*ptr = 0;
buf++;
}
return buf;
}
static char *os_name_version(char *str, size_t len)
{
char buf[256];
FILE *fp;
if (!str || !len)
return NULL;
fp = fopen("/etc/os-release", "r");
if (!fp)
return NULL;
str[0] = 0;
while (fgets(buf, sizeof(buf), fp)) {
chomp(buf);
if (!strncmp(buf, "NAME=", 5))
snprintf(str, len, "-V \"%.32s ", unquote(&buf[5]));
if (!strncmp(buf, "VERSION=", 8)) {
strlcat(str, unquote(&buf[8]), len);
strlcat(str, "\"", len);
break;
}
}
fclose(fp);
if (strlen(str) > 0 && str[strlen(str) - 1] != '"') {
str[0] = 0;
return NULL;
}
return str;
}
static char *compose_option(const char *ifname, const char *name, const char *value,
char *option, size_t len)
{
if (value) {
if (isdigit(name[0])) {
unsigned long opt = strtoul(name, NULL, 0);
switch (opt) {
case 81:
return fqdn(value, option, len);
default:
break;
}
snprintf(option, len, "-x %s:%s ", name, value);
} else {
if (!strcmp(name, "fqdn"))
fqdn(value, option, len);
else if (!strcmp(name, "hostname"))
snprintf(option, len, "-x %s:%s ", name, value);
else
snprintf(option, len, "-x %s:'\"%s\"' ", name, value);
}
} else {
struct { char *name; char *(*cb)(const char *, char *, size_t); } opt[] = {
{ "hostname", hostname },
{ "address", ip_cache },
{ "fqdn", NULL },
{ NULL, NULL }
};
for (size_t i = 0; opt[i].name; i++) {
if (strcmp(name, opt[i].name))
continue;
if (!opt[i].cb || !opt[i].cb(ifname, option, len))
return NULL;
return option;
}
snprintf(option, len, "-O %s ", name);
}
return option;
}
static char *compose_options(const char *ifname, char **options, const char *name, const char *value)
{
char opt[300];
compose_option(ifname, name, value, opt, sizeof(opt));
if (*options) {
char *opts;
opts = realloc(*options, strlen(*options) + strlen(opt) + 1);
if (!opts) {
ERROR("failed reallocating options: %s", strerror(errno));
free(*options);
return NULL;
}
*options = strcat(opts, opt);
} else
*options = strdup(opt);
return *options;
}
static char *dhcp_options(const char *ifname, struct lyd_node *cfg)
{
struct lyd_node *option;
char *options = NULL;
LYX_LIST_FOR_EACH(lyd_child(cfg), option, "option") {
const char *value = lydx_get_cattr(option, "value");
const char *name = lydx_get_cattr(option, "name");
options = compose_options(ifname, &options, name, value);
}
if (!options) {
const char *defaults[] = {
"router", "dns", "domain", "broadcast", "ntpsrv", "search",
"address", "staticroutes", "msstaticroutes"
};
for (size_t i = 0; i < NELEMS(defaults); i++)
options = compose_options(ifname, &options, defaults[i], NULL);
}
return options ?: strdup("-O subnet -O router -O domain");
}
static void add(const char *ifname, struct lyd_node *cfg)
{
const char *metric = lydx_get_cattr(cfg, "route-preference");
const char *client_id = lydx_get_cattr(cfg, "client-id");
char vendor[128] = { 0 }, do_arp[20] = { 0 };
char *args = NULL, *options = NULL;
const char *action = "disable";
bool arping;
FILE *fp;
arping = lydx_is_enabled(cfg, "arping");
if (arping)
snprintf(do_arp, sizeof(do_arp), "-a%d", ARPING_MSEC);
if (client_id && client_id[0]) {
args = alloca(strlen(client_id) + 12);
if (args)
sprintf(args, "-C -x 61:'\"%s\"'", client_id);
}
fprintf(fp, "service name:dhcp :%s udhcpc -f -S -R -i %s %s -- DHCP client @%s\n",
ifname, ifname, args ?: "", ifname);
fclose(fp);
if (systemf("initctl -bfq enable dhcp-%s", ifname))
ERROR("failed enabling DHCP client on %s", ifname);
options = dhcp_options(ifname, cfg);
if (!options) {
ERROR("failed extracting DHCP options for client %s, aborting!", ifname);
goto err;
}
os_name_version(vendor, sizeof(vendor));
fp = fopenf("w", "/etc/finit.d/available/dhcp-%s.conf", ifname);
if (!fp) {
ERROR("failed creating DHCP client %s: %s", ifname, strerror(errno));
goto err;
}
fprintf(fp, "# Generated by Infix confd\n");
fprintf(fp, "metric=%s\n", metric);
fprintf(fp, "service <!> name:dhcp :%s <net/%s/running> \\\n"
" [2345] udhcpc -f -p /run/dhcp-%s.pid -t 10 -T 3 -A 10 %s -S -R \\\n"
" -o %s \\\n"
" -i %s %s %s \\\n"
" -- DHCP client @%s\n",
ifname, ifname, ifname, do_arp,
options,
ifname, args ?: "", vendor, ifname);
fclose(fp);
action = "enable";
err:
systemf("initctl -bfqn %s dhcp-%s", action, ifname);
if (options)
free(options);
}
static void del(const char *ifname)
@@ -49,8 +282,8 @@ static void del(const char *ifname)
systemf("initctl -bfq delete dhcp-%s", ifname);
}
static int client_change(sr_session_ctx_t *session, uint32_t sub_id, const char *module,
const char *xpath, sr_event_t event, unsigned request_id, void *_confd)
static int change(sr_session_ctx_t *session, uint32_t sub_id, const char *module,
const char *xpath, sr_event_t event, unsigned request_id, void *_confd)
{
struct lyd_node *global, *diff, *cifs, *difs, *cif, *dif;
sr_error_t err = 0;
@@ -66,11 +299,9 @@ static int client_change(sr_session_ctx_t *session, uint32_t sub_id, const char
return SR_ERR_OK;
}
err = sr_get_data(session, "/infix-dhcp-client:dhcp-client//.", 0, 0, 0, &cfg);
if (err) {
ERROR("DHCP client fail 1");
err = sr_get_data(session, XPATH "//.", 0, 0, 0, &cfg);
if (err)
goto err_abandon;
}
err = srx_get_diff(session, &diff);
if (err)
@@ -98,7 +329,7 @@ static int client_change(sr_session_ctx_t *session, uint32_t sub_id, const char
if (!ena || !lydx_is_enabled(cif, "enabled"))
del(ifname);
else
add(ifname, lydx_get_cattr(cif, "client-id"));
add(ifname, cif);
break;
}
}
@@ -111,16 +342,87 @@ err_abandon:
return err;
}
/*
* Default DHCP options for udhcpc, from networking/udhcp/common.c OPTION_REQ
*/
static void infer_options(sr_session_ctx_t *session, const char *xpath)
{
const char *opt[] = {
"subnet",
"router",
"dns",
"hostname", /* server may use this to register our current name */
"domain",
"broadcast",
"ntpsrv" /* will not be activated unless ietf-system also is */
};
size_t i;
for (i = 0; i < NELEMS(opt); i++)
srx_set_item(session, NULL, 0, "%s/option[name='%s']", xpath, opt[i]);
}
static int cand(sr_session_ctx_t *session, uint32_t sub_id, const char *module,
const char *xpath, sr_event_t event, unsigned request_id, void *priv)
{
sr_change_iter_t *iter;
sr_change_oper_t op;
sr_val_t *old, *new;
sr_error_t err;
switch (event) {
case SR_EV_UPDATE:
case SR_EV_CHANGE:
break;
default:
return SR_ERR_OK;
}
err = sr_dup_changes_iter(session, XPATH "/client-if//*", &iter);
if (err)
return err;
while (sr_get_change_next(session, iter, &op, &old, &new) == SR_ERR_OK) {
char xpath[strlen(new->xpath) + 42];
size_t cnt = 0;
char *ptr;
switch (op) {
case SR_OP_CREATED:
case SR_OP_MODIFIED:
break;
default:
continue;
}
strlcpy(xpath, new->xpath, sizeof(xpath));
if ((ptr = strstr(xpath, "]/")) == NULL)
continue;
ptr[1] = 0;
err = srx_nitems(session, &cnt, "%s/option", xpath);
if (err || cnt) {
continue;
}
infer_options(session, xpath);
}
sr_free_change_iter(iter);
return SR_ERR_OK;
}
int infix_dhcp_init(struct confd *confd)
{
int rc;
rc = srx_require_modules(confd->conn, infix_dhcp_reqs);
rc = srx_require_modules(confd->conn, reqs);
if (rc)
goto fail;
REGISTER_CHANGE(confd->session, "infix-dhcp-client", "/infix-dhcp-client:dhcp-client",
0, client_change, confd, &confd->sub);
REGISTER_CHANGE(confd->session, MODULE, XPATH, 0, change, confd, &confd->sub);
REGISTER_CHANGE(confd->cand, MODULE, XPATH"//.", SR_SUBSCR_UPDATE, cand, confd, &confd->sub);
return SR_ERR_OK;
fail:
ERROR("init failed: %s", sr_strerror(rc));
@@ -0,0 +1,159 @@
module iana-bfd-types {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:iana-bfd-types";
prefix iana-bfd-types;
organization
"IANA";
contact
"Internet Assigned Numbers Authority
Postal: ICANN
12025 Waterfront Drive, Suite 300
Los Angeles, CA 90094-2536
United States of America
Tel: +1 310 301 5800
<mailto:iana@iana.org>";
description
"This module defines YANG data types for IANA-registered
BFD parameters.
This YANG module is maintained by IANA and reflects the
'BFD Diagnostic Codes' and 'BFD Authentication Types'
registries.
Copyright (c) 2021 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject to
the license terms contained in, the Simplified BSD License set
forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC 9127; see the
RFC itself for full legal notices.";
reference
"RFC 9127: YANG Data Model for Bidirectional Forwarding
Detection (BFD)";
revision 2021-10-21 {
description
"Initial revision.";
reference
"RFC 9127: YANG Data Model for Bidirectional Forwarding
Detection (BFD)";
}
/*
* Type definitions
*/
typedef diagnostic {
type enumeration {
enum none {
value 0;
description
"No Diagnostic.";
}
enum control-expiry {
value 1;
description
"Control Detection Time Expired.";
}
enum echo-failed {
value 2;
description
"Echo Function Failed.";
}
enum neighbor-down {
value 3;
description
"Neighbor Signaled Session Down.";
}
enum forwarding-reset {
value 4;
description
"Forwarding Plane Reset.";
}
enum path-down {
value 5;
description
"Path Down.";
}
enum concatenated-path-down {
value 6;
description
"Concatenated Path Down.";
}
enum admin-down {
value 7;
description
"Administratively Down.";
}
enum reverse-concatenated-path-down {
value 8;
description
"Reverse Concatenated Path Down.";
}
enum mis-connectivity-defect {
value 9;
description
"Mis-connectivity defect.";
reference
"RFC 5880: Bidirectional Forwarding Detection (BFD)
RFC 6428: Proactive Connectivity Verification, Continuity
Check, and Remote Defect Indication for the MPLS Transport
Profile";
}
}
description
"BFD diagnostic codes as defined in RFC 5880. Values are
maintained in the 'BFD Diagnostic Codes' IANA registry.
Range is 0 to 31.";
reference
"RFC 5880: Bidirectional Forwarding Detection (BFD)";
}
typedef auth-type {
type enumeration {
enum reserved {
value 0;
description
"Reserved.";
}
enum simple-password {
value 1;
description
"Simple Password.";
}
enum keyed-md5 {
value 2;
description
"Keyed MD5.";
}
enum meticulous-keyed-md5 {
value 3;
description
"Meticulous Keyed MD5.";
}
enum keyed-sha1 {
value 4;
description
"Keyed SHA1.";
}
enum meticulous-keyed-sha1 {
value 5;
description
"Meticulous Keyed SHA1.";
}
}
description
"BFD authentication type as defined in RFC 5880. Values are
maintained in the 'BFD Authentication Types' IANA registry.
Range is 0 to 255.";
reference
"RFC 5880: Bidirectional Forwarding Detection (BFD)";
}
}
@@ -0,0 +1,187 @@
module iana-hardware {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:iana-hardware";
prefix ianahw;
organization "IANA";
contact
" Internet Assigned Numbers Authority
Postal: ICANN
12025 Waterfront Drive, Suite 300
Los Angeles, CA 90094-2536
United States of America
Tel: +1 310 301 5800
E-Mail: iana@iana.org>";
description
"IANA-defined identities for hardware class.
The latest revision of this YANG module can be obtained from
the IANA website.
Requests for new values should be made to IANA via
email (iana@iana.org).
Copyright (c) 2018 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
The initial version of this YANG module is part of RFC 8348;
see the RFC itself for full legal notices.";
reference
"https://www.iana.org/assignments/yang-parameters";
revision 2018-03-13 {
description
"Initial revision.";
reference
"RFC 8348: A YANG Data Model for Hardware Management";
}
/*
* Identities
*/
identity hardware-class {
description
"This identity is the base for all hardware class
identifiers.";
}
identity unknown {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is unknown
to the server.";
}
identity chassis {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is an
overall container for networking equipment. Any class of
physical component, except a stack, may be contained within a
chassis; a chassis may only be contained within a stack.";
}
identity backplane {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is some sort
of device for aggregating and forwarding networking traffic,
such as a shared backplane in a modular ethernet switch. Note
that an implementation may model a backplane as a single
physical component, which is actually implemented as multiple
discrete physical components (within a chassis or stack).";
}
identity container {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is capable
of containing one or more removable physical entities,
possibly of different types. For example, each (empty or
full) slot in a chassis will be modeled as a container. Note
that all removable physical components should be modeled
within a container component, such as field-replaceable
modules, fans, or power supplies. Note that all known
containers should be modeled by the agent, including empty
containers.";
}
identity power-supply {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is a
power-supplying component.";
}
identity fan {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is a fan or
other heat-reduction component.";
}
identity sensor {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is some sort
of sensor, such as a temperature sensor within a router
chassis.";
}
identity module {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is some sort
of self-contained sub-system. If a module component is
removable, then it should be modeled within a container
component; otherwise, it should be modeled directly within
another physical component (e.g., a chassis or another
module).";
}
identity port {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is some sort
of networking port capable of receiving and/or transmitting
networking traffic.";
}
identity stack {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is some sort
of super-container (possibly virtual) intended to group
together multiple chassis entities. A stack may be realized
by a virtual cable, a real interconnect cable attached to
multiple chassis, or multiple interconnect cables. A stack
should not be modeled within any other physical components,
but a stack may be contained within another stack. Only
chassis components should be contained within a stack.";
}
identity cpu {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is some sort
of central processing unit.";
}
identity energy-object {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is some sort
of energy object, i.e., it is a piece of equipment that is
part of or attached to a communications network that is
monitored, it is controlled, or it aids in the management of
another device for Energy Management.";
}
identity battery {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is some sort
of battery.";
}
identity storage-drive {
base ianahw:hardware-class;
description
"This identity is applicable if the hardware class is some sort
of component with data storage capability as its main
functionality, e.g., hard disk drive (HDD), solid-state device
(SSD), solid-state hybrid drive (SSHD), object storage device
(OSD), or other.";
}
}
@@ -0,0 +1,471 @@
module iana-routing-types {
namespace "urn:ietf:params:xml:ns:yang:iana-routing-types";
prefix iana-rt-types;
organization
"IANA";
contact
"Internet Assigned Numbers Authority
Postal: ICANN
12025 Waterfront Drive, Suite 300
Los Angeles, CA 90094-2536
United States of America
Tel: +1 310 301 5800
<mailto:iana@iana.org>";
description
"This module contains a collection of YANG data types
considered defined by IANA and used for routing
protocols.
Copyright (c) 2017 IETF Trust and the persons
identified as authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC 8294; see
the RFC itself for full legal notices.";
revision 2017-12-04 {
description "Initial revision.";
reference
"RFC 8294: Common YANG Data Types for the Routing Area.
Section 4.";
}
/*** Collection of IANA types related to routing ***/
/*** IANA Address Family enumeration ***/
typedef address-family {
type enumeration {
enum ipv4 {
value 1;
description
"IPv4 Address Family.";
}
enum ipv6 {
value 2;
description
"IPv6 Address Family.";
}
enum nsap {
value 3;
description
"OSI Network Service Access Point (NSAP) Address Family.";
}
enum hdlc {
value 4;
description
"High-Level Data Link Control (HDLC) Address Family.";
}
enum bbn1822 {
value 5;
description
"Bolt, Beranek, and Newman Report 1822 (BBN 1822)
Address Family.";
}
enum ieee802 {
value 6;
description
"IEEE 802 Committee Address Family
(aka Media Access Control (MAC) address).";
}
enum e163 {
value 7;
description
"ITU-T E.163 Address Family.";
}
enum e164 {
value 8;
description
"ITU-T E.164 (Switched Multimegabit Data Service (SMDS),
Frame Relay, ATM) Address Family.";
}
enum f69 {
value 9;
description
"ITU-T F.69 (Telex) Address Family.";
}
enum x121 {
value 10;
description
"ITU-T X.121 (X.25, Frame Relay) Address Family.";
}
enum ipx {
value 11;
description
"Novell Internetwork Packet Exchange (IPX)
Address Family.";
}
enum appletalk {
value 12;
description
"Apple AppleTalk Address Family.";
}
enum decnet-iv {
value 13;
description
"Digital Equipment DECnet Phase IV Address Family.";
}
enum vines {
value 14;
description
"Banyan Vines Address Family.";
}
enum e164-nsap {
value 15;
description
"ITU-T E.164 with NSAP sub-address Address Family.";
}
enum dns {
value 16;
description
"Domain Name System (DNS) Address Family.";
}
enum distinguished-name {
value 17;
description
"Distinguished Name Address Family.";
}
enum as-num {
value 18;
description
"Autonomous System (AS) Number Address Family.";
}
enum xtp-v4 {
value 19;
description
"Xpress Transport Protocol (XTP) over IPv4
Address Family.";
}
enum xtp-v6 {
value 20;
description
"XTP over IPv6 Address Family.";
}
enum xtp-native {
value 21;
description
"XTP native mode Address Family.";
}
enum fc-port {
value 22;
description
"Fibre Channel (FC) World-Wide Port Name Address Family.";
}
enum fc-node {
value 23;
description
"FC World-Wide Node Name Address Family.";
}
enum gwid {
value 24;
description
"ATM Gateway Identifier (GWID) Number Address Family.";
}
enum l2vpn {
value 25;
description
"Layer 2 VPN (L2VPN) Address Family.";
}
enum mpls-tp-section-eid {
value 26;
description
"MPLS Transport Profile (MPLS-TP) Section Endpoint
Identifier Address Family.";
}
enum mpls-tp-lsp-eid {
value 27;
description
"MPLS-TP Label Switched Path (LSP) Endpoint Identifier
Address Family.";
}
enum mpls-tp-pwe-eid {
value 28;
description
"MPLS-TP Pseudowire Endpoint Identifier Address Family.";
}
enum mt-v4 {
value 29;
description
"Multi-Topology IPv4 Address Family.";
}
enum mt-v6 {
value 30;
description
"Multi-Topology IPv6 Address Family.";
}
enum eigrp-common-sf {
value 16384;
description
"Enhanced Interior Gateway Routing Protocol (EIGRP)
Common Service Family Address Family.";
}
enum eigrp-v4-sf {
value 16385;
description
"EIGRP IPv4 Service Family Address Family.";
}
enum eigrp-v6-sf {
value 16386;
description
"EIGRP IPv6 Service Family Address Family.";
}
enum lcaf {
value 16387;
description
"Locator/ID Separation Protocol (LISP)
Canonical Address Format (LCAF) Address Family.";
}
enum bgp-ls {
value 16388;
description
"Border Gateway Protocol - Link State (BGP-LS)
Address Family.";
}
enum mac-48 {
value 16389;
description
"IEEE 48-bit MAC Address Family.";
}
enum mac-64 {
value 16390;
description
"IEEE 64-bit MAC Address Family.";
}
enum trill-oui {
value 16391;
description
"Transparent Interconnection of Lots of Links (TRILL)
IEEE Organizationally Unique Identifier (OUI)
Address Family.";
}
enum trill-mac-24 {
value 16392;
description
"TRILL final 3 octets of 48-bit MAC Address Family.";
}
enum trill-mac-40 {
value 16393;
description
"TRILL final 5 octets of 64-bit MAC Address Family.";
}
enum ipv6-64 {
value 16394;
description
"First 8 octets (64 bits) of IPv6 address
Address Family.";
}
enum trill-rbridge-port-id {
value 16395;
description
"TRILL Routing Bridge (RBridge) Port ID Address Family.";
}
enum trill-nickname {
value 16396;
description
"TRILL Nickname Address Family.";
}
}
description
"Enumeration containing all the IANA-defined
Address Families.";
}
/*** Subsequent Address Family Identifiers (SAFIs) ***/
/*** for multiprotocol BGP enumeration ***/
typedef bgp-safi {
type enumeration {
enum unicast-safi {
value 1;
description
"Unicast SAFI.";
}
enum multicast-safi {
value 2;
description
"Multicast SAFI.";
}
enum labeled-unicast-safi {
value 4;
description
"Labeled Unicast SAFI.";
}
enum multicast-vpn-safi {
value 5;
description
"Multicast VPN SAFI.";
}
enum pseudowire-safi {
value 6;
description
"Multi-segment Pseudowire VPN SAFI.";
}
enum tunnel-encap-safi {
value 7;
description
"Tunnel Encap SAFI.";
}
enum mcast-vpls-safi {
value 8;
description
"Multicast Virtual Private LAN Service (VPLS) SAFI.";
}
enum tunnel-safi {
value 64;
description
"Tunnel SAFI.";
}
enum vpls-safi {
value 65;
description
"VPLS SAFI.";
}
enum mdt-safi {
value 66;
description
"Multicast Distribution Tree (MDT) SAFI.";
}
enum v4-over-v6-safi {
value 67;
description
"IPv4 over IPv6 SAFI.";
}
enum v6-over-v4-safi {
value 68;
description
"IPv6 over IPv4 SAFI.";
}
enum l1-vpn-auto-discovery-safi {
value 69;
description
"Layer 1 VPN Auto-Discovery SAFI.";
}
enum evpn-safi {
value 70;
description
"Ethernet VPN (EVPN) SAFI.";
}
enum bgp-ls-safi {
value 71;
description
"BGP-LS SAFI.";
}
enum bgp-ls-vpn-safi {
value 72;
description
"BGP-LS VPN SAFI.";
}
enum sr-te-safi {
value 73;
description
"Segment Routing - Traffic Engineering (SR-TE) SAFI.";
}
enum labeled-vpn-safi {
value 128;
description
"MPLS Labeled VPN SAFI.";
}
enum multicast-mpls-vpn-safi {
value 129;
description
"Multicast for BGP/MPLS IP VPN SAFI.";
}
enum route-target-safi {
value 132;
description
"Route Target SAFI.";
}
enum ipv4-flow-spec-safi {
value 133;
description
"IPv4 Flow Specification SAFI.";
}
enum vpnv4-flow-spec-safi {
value 134;
description
"IPv4 VPN Flow Specification SAFI.";
}
enum vpn-auto-discovery-safi {
value 140;
description
"VPN Auto-Discovery SAFI.";
}
}
description
"Enumeration for BGP SAFI.";
reference
"RFC 4760: Multiprotocol Extensions for BGP-4.";
}
}
@@ -0,0 +1,690 @@
module ietf-bfd-types {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-bfd-types";
prefix bfd-types;
import iana-bfd-types {
prefix iana-bfd-types;
reference
"RFC 9127: YANG Data Model for Bidirectional Forwarding
Detection (BFD)";
}
import ietf-inet-types {
prefix inet;
reference
"RFC 6991: Common YANG Data Types";
}
import ietf-yang-types {
prefix yang;
reference
"RFC 6991: Common YANG Data Types";
}
import ietf-routing {
prefix rt;
reference
"RFC 8349: A YANG Data Model for Routing Management
(NMDA Version)";
}
import ietf-key-chain {
prefix key-chain;
reference
"RFC 8177: YANG Data Model for Key Chains";
}
organization
"IETF BFD Working Group";
contact
"WG Web: <https://datatracker.ietf.org/wg/bfd/>
WG List: <mailto:rtg-bfd@ietf.org>
Editor: Reshad Rahman
<mailto:reshad@yahoo.com>
Editor: Lianshu Zheng
<mailto:veronique_cheng@hotmail.com>
Editor: Mahesh Jethanandani
<mailto:mjethanandani@gmail.com>";
description
"This module contains a collection of BFD-specific YANG data type
definitions, as per RFC 5880, and also groupings that are common
to other BFD YANG modules.
Copyright (c) 2022 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Revised BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC 9314; see the
RFC itself for full legal notices.";
reference
"RFC 5880: Bidirectional Forwarding Detection (BFD)
RFC 9314: YANG Data Model for Bidirectional Forwarding
Detection (BFD)";
revision 2022-09-22 {
description
"This revision is not backwards compatible with the
previous version of this model.
This revision adds an 'if-feature' statement called
'client-base-cfg-parms' for client configuration parameters.
Clients expecting to use those parameters now need to
verify that the server declares support of the feature
before depending on the presence of the parameters.
The change was introduced for clients that do not need
them and have to deviate to prevent them from being
included.";
reference
"RFC 9314: YANG Data Model for Bidirectional Forwarding
Detection (BFD).";
}
revision 2021-10-21 {
description
"Initial revision.";
reference
"RFC 9127: YANG Data Model for Bidirectional Forwarding
Detection (BFD)";
}
/*
* Feature definitions
*/
feature single-minimum-interval {
description
"This feature indicates that the server supports configuration
of one minimum interval value that is used for both transmit
and receive minimum intervals.";
}
feature authentication {
description
"This feature indicates that the server supports BFD
authentication.";
reference
"RFC 5880: Bidirectional Forwarding Detection (BFD),
Section 6.7";
}
feature demand-mode {
description
"This feature indicates that the server supports BFD Demand
mode.";
reference
"RFC 5880: Bidirectional Forwarding Detection (BFD),
Section 6.6";
}
feature echo-mode {
description
"This feature indicates that the server supports BFD Echo
mode.";
reference
"RFC 5880: Bidirectional Forwarding Detection (BFD),
Section 6.4";
}
feature client-base-cfg-parms {
description
"This feature allows protocol models to configure BFD client
session parameters.";
reference
"RFC 9314: YANG Data Model for Bidirectional Forwarding
Detection (BFD).";
}
/*
* Identity definitions
*/
identity bfdv1 {
base rt:control-plane-protocol;
description
"BFD protocol version 1.";
reference
"RFC 5880: Bidirectional Forwarding Detection (BFD)";
}
identity path-type {
description
"Base identity for the BFD path type. The path type indicates
the type of path on which BFD is running.";
}
identity path-ip-sh {
base path-type;
description
"BFD on IP single-hop.";
reference
"RFC 5881: Bidirectional Forwarding Detection (BFD)
for IPv4 and IPv6 (Single Hop)";
}
identity path-ip-mh {
base path-type;
description
"BFD on IP multihop paths.";
reference
"RFC 5883: Bidirectional Forwarding Detection (BFD) for
Multihop Paths";
}
identity path-mpls-te {
base path-type;
description
"BFD on MPLS Traffic Engineering.";
reference
"RFC 5884: Bidirectional Forwarding Detection (BFD)
for MPLS Label Switched Paths (LSPs)";
}
identity path-mpls-lsp {
base path-type;
description
"BFD on an MPLS Label Switched Path.";
reference
"RFC 5884: Bidirectional Forwarding Detection (BFD)
for MPLS Label Switched Paths (LSPs)";
}
identity path-lag {
base path-type;
description
"Micro-BFD on LAG member links.";
reference
"RFC 7130: Bidirectional Forwarding Detection (BFD) on
Link Aggregation Group (LAG) Interfaces";
}
identity encap-type {
description
"Base identity for BFD encapsulation type.";
}
identity encap-ip {
base encap-type;
description
"BFD with IP encapsulation.";
}
/*
* Type definitions
*/
typedef discriminator {
type uint32;
description
"BFD Discriminator as described in RFC 5880.";
reference
"RFC 5880: Bidirectional Forwarding Detection (BFD)";
}
typedef state {
type enumeration {
enum adminDown {
value 0;
description
"'adminDown' state.";
}
enum down {
value 1;
description
"'Down' state.";
}
enum init {
value 2;
description
"'Init' state.";
}
enum up {
value 3;
description
"'Up' state.";
}
}
description
"BFD states as defined in RFC 5880.";
}
typedef multiplier {
type uint8 {
range "1..255";
}
description
"BFD multiplier as described in RFC 5880.";
}
typedef hops {
type uint8 {
range "1..255";
}
description
"This corresponds to Time To Live for IPv4 and corresponds to
the hop limit for IPv6.";
}
/*
* Groupings
*/
grouping auth-parms {
description
"Grouping for BFD authentication parameters
(see Section 6.7 of RFC 5880).";
container authentication {
if-feature "authentication";
presence "Enables BFD authentication (see Section 6.7
of RFC 5880).";
description
"Parameters for BFD authentication.";
reference
"RFC 5880: Bidirectional Forwarding Detection (BFD),
Section 6.7";
leaf key-chain {
type key-chain:key-chain-ref;
description
"Name of the 'key-chain' as per RFC 8177.";
}
leaf meticulous {
type boolean;
description
"Enables a meticulous mode as per Section 6.7 of
RFC 5880.";
}
}
}
grouping base-cfg-parms {
description
"BFD grouping for base configuration parameters.";
leaf local-multiplier {
type multiplier;
default "3";
description
"Multiplier transmitted by the local system.";
}
choice interval-config-type {
default "tx-rx-intervals";
description
"Two interval values or one value used for both transmit and
receive.";
case tx-rx-intervals {
leaf desired-min-tx-interval {
type uint32;
units "microseconds";
default "1000000";
description
"Desired minimum transmit interval of control packets.";
}
leaf required-min-rx-interval {
type uint32;
units "microseconds";
default "1000000";
description
"Required minimum receive interval of control packets.";
}
}
case single-interval {
if-feature "single-minimum-interval";
leaf min-interval {
type uint32;
units "microseconds";
default "1000000";
description
"Desired minimum transmit interval and required
minimum receive interval of control packets.";
}
}
}
}
grouping client-cfg-parms {
description
"BFD grouping for configuration parameters
used by BFD clients, e.g., IGP or MPLS.";
leaf enabled {
type boolean;
default "false";
description
"Indicates whether BFD is enabled.";
}
uses base-cfg-parms {
if-feature "client-base-cfg-parms";
}
}
grouping common-cfg-parms {
description
"BFD grouping for common configuration parameters.";
uses base-cfg-parms;
leaf demand-enabled {
if-feature "demand-mode";
type boolean;
default "false";
description
"To enable Demand mode.";
}
leaf admin-down {
type boolean;
default "false";
description
"Indicates whether the BFD session is administratively
down.";
}
uses auth-parms;
}
grouping all-session {
description
"BFD session operational information.";
leaf path-type {
type identityref {
base path-type;
}
config false;
description
"BFD path type. This indicates the path type that BFD is
running on.";
}
leaf ip-encapsulation {
type boolean;
config false;
description
"Indicates whether BFD encapsulation uses IP.";
}
leaf local-discriminator {
type discriminator;
config false;
description
"Local discriminator.";
}
leaf remote-discriminator {
type discriminator;
config false;
description
"Remote discriminator.";
}
leaf remote-multiplier {
type multiplier;
config false;
description
"Remote multiplier.";
}
leaf demand-capability {
if-feature "demand-mode";
type boolean;
config false;
description
"Local Demand mode capability.";
}
leaf source-port {
when "../ip-encapsulation = 'true'" {
description
"Source port valid only when IP encapsulation is used.";
}
type inet:port-number;
config false;
description
"Source UDP port.";
}
leaf dest-port {
when "../ip-encapsulation = 'true'" {
description
"Destination port valid only when IP encapsulation
is used.";
}
type inet:port-number;
config false;
description
"Destination UDP port.";
}
container session-running {
config false;
description
"BFD 'session-running' information.";
leaf session-index {
type uint32;
description
"An index used to uniquely identify BFD sessions.";
}
leaf local-state {
type state;
description
"Local state.";
}
leaf remote-state {
type state;
description
"Remote state.";
}
leaf local-diagnostic {
type iana-bfd-types:diagnostic;
description
"Local diagnostic.";
}
leaf remote-diagnostic {
type iana-bfd-types:diagnostic;
description
"Remote diagnostic.";
}
leaf remote-authenticated {
type boolean;
description
"Indicates whether incoming BFD control packets are
authenticated.";
}
leaf remote-authentication-type {
when "../remote-authenticated = 'true'" {
description
"Only valid when incoming BFD control packets are
authenticated.";
}
if-feature "authentication";
type iana-bfd-types:auth-type;
description
"Authentication type of incoming BFD control packets.";
}
leaf detection-mode {
type enumeration {
enum async-with-echo {
value 1;
description
"Async with echo.";
}
enum async-without-echo {
value 2;
description
"Async without echo.";
}
enum demand-with-echo {
value 3;
description
"Demand with echo.";
}
enum demand-without-echo {
value 4;
description
"Demand without echo.";
}
}
description
"Detection mode.";
}
leaf negotiated-tx-interval {
type uint32;
units "microseconds";
description
"Negotiated transmit interval.";
}
leaf negotiated-rx-interval {
type uint32;
units "microseconds";
description
"Negotiated receive interval.";
}
leaf detection-time {
type uint32;
units "microseconds";
description
"Detection time.";
}
leaf echo-tx-interval-in-use {
when "../../path-type = 'bfd-types:path-ip-sh'" {
description
"Echo is supported for IP single-hop only.";
}
if-feature "echo-mode";
type uint32;
units "microseconds";
description
"Echo transmit interval in use.";
}
}
container session-statistics {
config false;
description
"BFD per-session statistics.";
leaf create-time {
type yang:date-and-time;
description
"Time and date when this session was created.";
}
leaf last-down-time {
type yang:date-and-time;
description
"Time and date of the last time this session went down.";
}
leaf last-up-time {
type yang:date-and-time;
description
"Time and date of the last time this session went up.";
}
leaf down-count {
type yang:counter32;
description
"The number of times this session has transitioned to the
'down' state.";
}
leaf admin-down-count {
type yang:counter32;
description
"The number of times this session has transitioned to the
'admin-down' state.";
}
leaf receive-packet-count {
type yang:counter64;
description
"Count of received packets in this session. This includes
valid and invalid received packets.";
}
leaf send-packet-count {
type yang:counter64;
description
"Count of sent packets in this session.";
}
leaf receive-invalid-packet-count {
type yang:counter64;
description
"Count of invalid received packets in this session.";
}
leaf send-failed-packet-count {
type yang:counter64;
description
"Count of packets that failed to be sent in this session.";
}
}
}
grouping session-statistics-summary {
description
"Grouping for session statistics summary.";
container summary {
config false;
description
"BFD session statistics summary.";
leaf number-of-sessions {
type yang:gauge32;
description
"Number of BFD sessions.";
}
leaf number-of-sessions-up {
type yang:gauge32;
description
"Number of BFD sessions currently in the 'Up' state
(as defined in RFC 5880).";
}
leaf number-of-sessions-down {
type yang:gauge32;
description
"Number of BFD sessions currently in the 'Down' or 'Init'
state but not 'adminDown' (as defined in RFC 5880).";
}
leaf number-of-sessions-admin-down {
type yang:gauge32;
description
"Number of BFD sessions currently in the 'adminDown' state
(as defined in RFC 5880).";
}
}
}
grouping notification-parms {
description
"This group describes common parameters that will be sent
as part of BFD notifications.";
leaf local-discr {
type discriminator;
description
"BFD local discriminator.";
}
leaf remote-discr {
type discriminator;
description
"BFD remote discriminator.";
}
leaf new-state {
type state;
description
"Current BFD state.";
}
leaf state-change-reason {
type iana-bfd-types:diagnostic;
description
"Reason for the BFD state change.";
}
leaf time-of-last-state-change {
type yang:date-and-time;
description
"Calendar time of the most recent previous state change.";
}
leaf dest-addr {
type inet:ip-address;
description
"BFD peer address.";
}
leaf source-addr {
type inet:ip-address;
description
"BFD local address.";
}
leaf session-index {
type uint32;
description
"An index used to uniquely identify BFD sessions.";
}
leaf path-type {
type identityref {
base path-type;
}
description
"BFD path type.";
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,382 @@
module ietf-key-chain {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-key-chain";
prefix key-chain;
import ietf-yang-types {
prefix yang;
}
import ietf-netconf-acm {
prefix nacm;
}
organization
"IETF RTGWG - Routing Area Working Group";
contact
"WG Web: <https://datatracker.ietf.org/group/rtgwg>
WG List: <mailto:rtgwg@ietf.org>
Editor: Acee Lindem
<mailto:acee@cisco.com>
Yingzhen Qu
<mailto:yingzhen.qu@huawei.com>
Derek Yeung
<mailto:derek@arrcus.com>
Ing-Wher Chen
<mailto:Ing-Wher_Chen@jabail.com>
Jeffrey Zhang
<mailto:zzhang@juniper.net>";
description
"This YANG module defines the generic configuration
data for key chains. It is intended that the module
will be extended by vendors to define vendor-specific
key chain configuration parameters.
Copyright (c) 2017 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC 8177;
see the RFC itself for full legal notices.";
reference "RFC 8177";
revision 2017-06-15 {
description
"Initial RFC Revision";
reference "RFC 8177: YANG Data Model for Key Chains";
}
feature hex-key-string {
description
"Support hexadecimal key string.";
}
feature accept-tolerance {
description
"Support the tolerance or acceptance limit.";
}
feature independent-send-accept-lifetime {
description
"Support for independent send and accept key lifetimes.";
}
feature crypto-hmac-sha-1-12 {
description
"Support for TCP HMAC-SHA-1 12-byte digest hack.";
}
feature cleartext {
description
"Support for cleartext algorithm. Usage is
NOT RECOMMENDED.";
}
feature aes-cmac-prf-128 {
description
"Support for AES Cipher-based Message Authentication
Code Pseudorandom Function.";
}
feature aes-key-wrap {
description
"Support for Advanced Encryption Standard (AES) Key Wrap.";
}
feature replay-protection-only {
description
"Provide replay protection without any authentication
as required by protocols such as Bidirectional
Forwarding Detection (BFD).";
}
identity crypto-algorithm {
description
"Base identity of cryptographic algorithm options.";
}
identity hmac-sha-1-12 {
base crypto-algorithm;
if-feature "crypto-hmac-sha-1-12";
description
"The HMAC-SHA1-12 algorithm.";
}
identity aes-cmac-prf-128 {
base crypto-algorithm;
if-feature "aes-cmac-prf-128";
description
"The AES-CMAC-PRF-128 algorithm - required by
RFC 5926 for TCP-AO key derivation functions.";
}
identity md5 {
base crypto-algorithm;
description
"The MD5 algorithm.";
}
identity sha-1 {
base crypto-algorithm;
description
"The SHA-1 algorithm.";
}
identity hmac-sha-1 {
base crypto-algorithm;
description
"HMAC-SHA-1 authentication algorithm.";
}
identity hmac-sha-256 {
base crypto-algorithm;
description
"HMAC-SHA-256 authentication algorithm.";
}
identity hmac-sha-384 {
base crypto-algorithm;
description
"HMAC-SHA-384 authentication algorithm.";
}
identity hmac-sha-512 {
base crypto-algorithm;
description
"HMAC-SHA-512 authentication algorithm.";
}
identity cleartext {
base crypto-algorithm;
if-feature "cleartext";
description
"cleartext.";
}
identity replay-protection-only {
base crypto-algorithm;
if-feature "replay-protection-only";
description
"Provide replay protection without any authentication as
required by protocols such as Bidirectional Forwarding
Detection (BFD).";
}
typedef key-chain-ref {
type leafref {
path
"/key-chain:key-chains/key-chain:key-chain/key-chain:name";
}
description
"This type is used by data models that need to reference
configured key chains.";
}
grouping lifetime {
description
"Key lifetime specification.";
choice lifetime {
default "always";
description
"Options for specifying key accept or send lifetimes";
case always {
leaf always {
type empty;
description
"Indicates key lifetime is always valid.";
}
}
case start-end-time {
leaf start-date-time {
type yang:date-and-time;
description
"Start time.";
}
choice end-time {
default "infinite";
description
"End-time setting.";
case infinite {
leaf no-end-time {
type empty;
description
"Indicates key lifetime end-time is infinite.";
}
}
case duration {
leaf duration {
type uint32 {
range "1..2147483646";
}
units "seconds";
description
"Key lifetime duration, in seconds";
}
}
case end-date-time {
leaf end-date-time {
type yang:date-and-time;
description
"End time.";
}
}
}
}
}
}
container key-chains {
description
"All configured key-chains on the device.";
list key-chain {
key "name";
description
"List of key-chains.";
leaf name {
type string;
description
"Name of the key-chain.";
}
leaf description {
type string;
description
"A description of the key-chain";
}
container accept-tolerance {
if-feature "accept-tolerance";
description
"Tolerance for key lifetime acceptance (seconds).";
leaf duration {
type uint32;
units "seconds";
default "0";
description
"Tolerance range, in seconds.";
}
}
leaf last-modified-timestamp {
type yang:date-and-time;
config false;
description
"Timestamp of the most recent update to the key-chain";
}
list key {
key "key-id";
description
"Single key in key chain.";
leaf key-id {
type uint64;
description
"Numeric value uniquely identifying the key";
}
container lifetime {
description
"Specify a key's lifetime.";
choice lifetime {
description
"Options for specification of send and accept
lifetimes.";
case send-and-accept-lifetime {
description
"Send and accept key have the same lifetime.";
container send-accept-lifetime {
description
"Single lifetime specification for both
send and accept lifetimes.";
uses lifetime;
}
}
case independent-send-accept-lifetime {
if-feature "independent-send-accept-lifetime";
description
"Independent send and accept key lifetimes.";
container send-lifetime {
description
"Separate lifetime specification for send
lifetime.";
uses lifetime;
}
container accept-lifetime {
description
"Separate lifetime specification for accept
lifetime.";
uses lifetime;
}
}
}
}
leaf crypto-algorithm {
type identityref {
base crypto-algorithm;
}
mandatory true;
description
"Cryptographic algorithm associated with key.";
}
container key-string {
description
"The key string.";
nacm:default-deny-all;
choice key-string-style {
description
"Key string styles";
case keystring {
leaf keystring {
type string;
description
"Key string in ASCII format.";
}
}
case hexadecimal {
if-feature "hex-key-string";
leaf hexadecimal-string {
type yang:hex-string;
description
"Key in hexadecimal string format. When compared
to ASCII, specification in hexadecimal affords
greater key entropy with the same number of
internal key-string octets. Additionally, it
discourages usage of well-known words or
numbers.";
}
}
}
}
leaf send-lifetime-active {
type boolean;
config false;
description
"Indicates if the send lifetime of the
key-chain key is currently active.";
}
leaf accept-lifetime-active {
type boolean;
config false;
description
"Indicates if the accept lifetime of the
key-chain key is currently active.";
}
}
}
container aes-key-wrap {
if-feature "aes-key-wrap";
description
"AES Key Wrap encryption for key-chain key-strings. The
encrypted key-strings are encoded as hexadecimal key
strings using the hex-key-string leaf.";
leaf enable {
type boolean;
default "false";
description
"Enable AES Key Wrap encryption.";
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,771 @@
module ietf-routing-types {
namespace "urn:ietf:params:xml:ns:yang:ietf-routing-types";
prefix rt-types;
import ietf-yang-types {
prefix yang;
}
import ietf-inet-types {
prefix inet;
}
organization
"IETF RTGWG - Routing Area Working Group";
contact
"WG Web: <https://datatracker.ietf.org/wg/rtgwg/>
WG List: <mailto:rtgwg@ietf.org>
Editors: Xufeng Liu
<mailto:Xufeng_Liu@jabail.com>
Yingzhen Qu
<mailto:yingzhen.qu@huawei.com>
Acee Lindem
<mailto:acee@cisco.com>
Christian Hopps
<mailto:chopps@chopps.org>
Lou Berger
<mailto:lberger@labn.com>";
description
"This module contains a collection of YANG data types
considered generally useful for routing protocols.
Copyright (c) 2017 IETF Trust and the persons
identified as authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC 8294; see
the RFC itself for full legal notices.";
revision 2017-12-04 {
description "Initial revision.";
reference
"RFC 8294: Common YANG Data Types for the Routing Area.
Section 3.";
}
/*** Identities related to MPLS/GMPLS ***/
identity mpls-label-special-purpose-value {
description
"Base identity for deriving identities describing
special-purpose Multiprotocol Label Switching (MPLS) label
values.";
reference
"RFC 7274: Allocating and Retiring Special-Purpose MPLS
Labels.";
}
identity ipv4-explicit-null-label {
base mpls-label-special-purpose-value;
description
"This identity represents the IPv4 Explicit NULL Label.";
reference
"RFC 3032: MPLS Label Stack Encoding. Section 2.1.";
}
identity router-alert-label {
base mpls-label-special-purpose-value;
description
"This identity represents the Router Alert Label.";
reference
"RFC 3032: MPLS Label Stack Encoding. Section 2.1.";
}
identity ipv6-explicit-null-label {
base mpls-label-special-purpose-value;
description
"This identity represents the IPv6 Explicit NULL Label.";
reference
"RFC 3032: MPLS Label Stack Encoding. Section 2.1.";
}
identity implicit-null-label {
base mpls-label-special-purpose-value;
description
"This identity represents the Implicit NULL Label.";
reference
"RFC 3032: MPLS Label Stack Encoding. Section 2.1.";
}
identity entropy-label-indicator {
base mpls-label-special-purpose-value;
description
"This identity represents the Entropy Label Indicator.";
reference
"RFC 6790: The Use of Entropy Labels in MPLS Forwarding.
Sections 3 and 10.1.";
}
identity gal-label {
base mpls-label-special-purpose-value;
description
"This identity represents the Generic Associated Channel
(G-ACh) Label (GAL).";
reference
"RFC 5586: MPLS Generic Associated Channel.
Sections 4 and 10.";
}
identity oam-alert-label {
base mpls-label-special-purpose-value;
description
"This identity represents the OAM Alert Label.";
reference
"RFC 3429: Assignment of the 'OAM Alert Label' for
Multiprotocol Label Switching Architecture (MPLS)
Operation and Maintenance (OAM) Functions.
Sections 3 and 6.";
}
identity extension-label {
base mpls-label-special-purpose-value;
description
"This identity represents the Extension Label.";
reference
"RFC 7274: Allocating and Retiring Special-Purpose MPLS
Labels. Sections 3.1 and 5.";
}
/*** Collection of types related to routing ***/
typedef router-id {
type yang:dotted-quad;
description
"A 32-bit number in the dotted-quad format assigned to each
router. This number uniquely identifies the router within
an Autonomous System.";
}
/*** Collection of types related to VPNs ***/
typedef route-target {
type string {
pattern
'(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
+ '42949672[0-8][0-9]|'
+ '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
+ '42949[0-5][0-9]{4}|'
+ '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
+ '42[0-8][0-9]{7}|4[01][0-9]{8}|'
+ '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
+ '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
+ '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
+ '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
+ '655[0-2][0-9]|'
+ '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
+ '(2:(429496729[0-5]|42949672[0-8][0-9]|'
+ '4294967[01][0-9]{2}|'
+ '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
+ '4294[0-8][0-9]{5}|'
+ '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
+ '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
+ '(6(:[a-fA-F0-9]{2}){6})|'
+ '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
+ '[0-9a-fA-F]{1,12})';
}
description
"A Route Target is an 8-octet BGP extended community
initially identifying a set of sites in a BGP VPN
(RFC 4364). However, it has since taken on a more general
role in BGP route filtering. A Route Target consists of two
or three fields: a 2-octet Type field, an administrator
field, and, optionally, an assigned number field.
According to the data formats for types 0, 1, 2, and 6 as
defined in RFC 4360, RFC 5668, and RFC 7432, the encoding
pattern is defined as:
0:2-octet-asn:4-octet-number
1:4-octet-ipv4addr:2-octet-number
2:4-octet-asn:2-octet-number
6:6-octet-mac-address
Additionally, a generic pattern is defined for future
Route Target types:
2-octet-other-hex-number:6-octet-hex-number
Some valid examples are 0:100:100, 1:1.1.1.1:100,
2:1234567890:203, and 6:26:00:08:92:78:00.";
reference
"RFC 4360: BGP Extended Communities Attribute.
RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
RFC 5668: 4-Octet AS Specific BGP Extended Community.
RFC 7432: BGP MPLS-Based Ethernet VPN.";
}
typedef ipv6-route-target {
type string {
pattern
'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
+ '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
+ '(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}'
+ '(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))'
+ ':'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+ '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))'
+ ':'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
}
description
"An IPv6 Route Target is a 20-octet BGP IPv6 Address
Specific Extended Community serving the same function
as a standard 8-octet Route Target, except that it only
allows an IPv6 address as the global administrator.
The format is <ipv6-address:2-octet-number>.
Two valid examples are 2001:db8::1:6544 and
2001:db8::5eb1:791:6b37:17958.";
reference
"RFC 5701: IPv6 Address Specific BGP Extended Community
Attribute.";
}
typedef route-target-type {
type enumeration {
enum import {
value 0;
description
"The Route Target applies to route import.";
}
enum export {
value 1;
description
"The Route Target applies to route export.";
}
enum both {
value 2;
description
"The Route Target applies to both route import and
route export.";
}
}
description
"Indicates the role a Route Target takes in route filtering.";
reference
"RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).";
}
typedef route-distinguisher {
type string {
pattern
'(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
+ '42949672[0-8][0-9]|'
+ '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
+ '42949[0-5][0-9]{4}|'
+ '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
+ '42[0-8][0-9]{7}|4[01][0-9]{8}|'
+ '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
+ '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
+ '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
+ '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
+ '655[0-2][0-9]|'
+ '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
+ '(2:(429496729[0-5]|42949672[0-8][0-9]|'
+ '4294967[01][0-9]{2}|'
+ '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
+ '4294[0-8][0-9]{5}|'
+ '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
+ '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
+ '(6(:[a-fA-F0-9]{2}){6})|'
+ '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
+ '[0-9a-fA-F]{1,12})';
}
description
"A Route Distinguisher is an 8-octet value used to
distinguish routes from different BGP VPNs (RFC 4364).
A Route Distinguisher will have the same format as a
Route Target as per RFC 4360 and will consist of
two or three fields: a 2-octet Type field, an administrator
field, and, optionally, an assigned number field.
According to the data formats for types 0, 1, 2, and 6 as
defined in RFC 4360, RFC 5668, and RFC 7432, the encoding
pattern is defined as:
0:2-octet-asn:4-octet-number
1:4-octet-ipv4addr:2-octet-number
2:4-octet-asn:2-octet-number
6:6-octet-mac-address
Additionally, a generic pattern is defined for future
route discriminator types:
2-octet-other-hex-number:6-octet-hex-number
Some valid examples are 0:100:100, 1:1.1.1.1:100,
2:1234567890:203, and 6:26:00:08:92:78:00.";
reference
"RFC 4360: BGP Extended Communities Attribute.
RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
RFC 5668: 4-Octet AS Specific BGP Extended Community.
RFC 7432: BGP MPLS-Based Ethernet VPN.";
}
typedef route-origin {
type string {
pattern
'(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
+ '42949672[0-8][0-9]|'
+ '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
+ '42949[0-5][0-9]{4}|'
+ '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
+ '42[0-8][0-9]{7}|4[01][0-9]{8}|'
+ '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
+ '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
+ '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
+ '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
+ '655[0-2][0-9]|'
+ '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
+ '(2:(429496729[0-5]|42949672[0-8][0-9]|'
+ '4294967[01][0-9]{2}|'
+ '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
+ '4294[0-8][0-9]{5}|'
+ '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
+ '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
+ '(6(:[a-fA-F0-9]{2}){6})|'
+ '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
+ '[0-9a-fA-F]{1,12})';
}
description
"A Route Origin is an 8-octet BGP extended community
identifying the set of sites where the BGP route
originated (RFC 4364). A Route Origin will have the same
format as a Route Target as per RFC 4360 and will consist
of two or three fields: a 2-octet Type field, an
administrator field, and, optionally, an assigned number
field.
According to the data formats for types 0, 1, 2, and 6 as
defined in RFC 4360, RFC 5668, and RFC 7432, the encoding
pattern is defined as:
0:2-octet-asn:4-octet-number
1:4-octet-ipv4addr:2-octet-number
2:4-octet-asn:2-octet-number
6:6-octet-mac-address
Additionally, a generic pattern is defined for future
Route Origin types:
2-octet-other-hex-number:6-octet-hex-number
Some valid examples are 0:100:100, 1:1.1.1.1:100,
2:1234567890:203, and 6:26:00:08:92:78:00.";
reference
"RFC 4360: BGP Extended Communities Attribute.
RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
RFC 5668: 4-Octet AS Specific BGP Extended Community.
RFC 7432: BGP MPLS-Based Ethernet VPN.";
}
typedef ipv6-route-origin {
type string {
pattern
'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
+ '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
+ '(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}'
+ '(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))'
+ ':'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+ '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))'
+ ':'
+ '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
+ '6[0-4][0-9]{3}|'
+ '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
}
description
"An IPv6 Route Origin is a 20-octet BGP IPv6 Address
Specific Extended Community serving the same function
as a standard 8-octet route, except that it only allows
an IPv6 address as the global administrator. The format
is <ipv6-address:2-octet-number>.
Two valid examples are 2001:db8::1:6544 and
2001:db8::5eb1:791:6b37:17958.";
reference
"RFC 5701: IPv6 Address Specific BGP Extended Community
Attribute.";
}
/*** Collection of types common to multicast ***/
typedef ipv4-multicast-group-address {
type inet:ipv4-address {
pattern '(2((2[4-9])|(3[0-9]))\.).*';
}
description
"This type represents an IPv4 multicast group address,
which is in the range of 224.0.0.0 to 239.255.255.255.";
reference
"RFC 1112: Host Extensions for IP Multicasting.";
}
typedef ipv6-multicast-group-address {
type inet:ipv6-address {
pattern '(([fF]{2}[0-9a-fA-F]{2}):).*';
}
description
"This type represents an IPv6 multicast group address,
which is in the range of ff00::/8.";
reference
"RFC 4291: IP Version 6 Addressing Architecture. Section 2.7.
RFC 7346: IPv6 Multicast Address Scopes.";
}
typedef ip-multicast-group-address {
type union {
type ipv4-multicast-group-address;
type ipv6-multicast-group-address;
}
description
"This type represents a version-neutral IP multicast group
address. The format of the textual representation implies
the IP version.";
}
typedef ipv4-multicast-source-address {
type union {
type enumeration {
enum * {
description
"Any source address.";
}
}
type inet:ipv4-address;
}
description
"Multicast source IPv4 address type.";
}
typedef ipv6-multicast-source-address {
type union {
type enumeration {
enum * {
description
"Any source address.";
}
}
type inet:ipv6-address;
}
description
"Multicast source IPv6 address type.";
}
/*** Collection of types common to protocols ***/
typedef bandwidth-ieee-float32 {
type string {
pattern
'0[xX](0((\.0?)?[pP](\+)?0?|(\.0?))|'
+ '1(\.([0-9a-fA-F]{0,5}[02468aAcCeE]?)?)?[pP](\+)?(12[0-7]|'
+ '1[01][0-9]|0?[0-9]?[0-9])?)';
}
description
"Bandwidth in IEEE 754 floating-point 32-bit binary format:
(-1)**(S) * 2**(Exponent-127) * (1 + Fraction),
where Exponent uses 8 bits and Fraction uses 23 bits.
The units are octets per second.
The encoding format is the external hexadecimal-significant
character sequences specified in IEEE 754 and ISO/IEC C99.
The format is restricted to be normalized, non-negative, and
non-fraction: 0x1.hhhhhhp{+}d, 0X1.HHHHHHP{+}D, or 0x0p0,
where 'h' and 'H' are hexadecimal digits and 'd' and 'D' are
integers in the range of [0..127].
When six hexadecimal digits are used for 'hhhhhh' or
'HHHHHH', the least significant digit must be an even
number. 'x' and 'X' indicate hexadecimal; 'p' and 'P'
indicate a power of two. Some examples are 0x0p0, 0x1p10,
and 0x1.abcde2p+20.";
reference
"IEEE Std 754-2008: IEEE Standard for Floating-Point
Arithmetic.
ISO/IEC C99: Information technology - Programming
Languages - C.";
}
typedef link-access-type {
type enumeration {
enum broadcast {
description
"Specify broadcast multi-access network.";
}
enum non-broadcast-multiaccess {
description
"Specify Non-Broadcast Multi-Access (NBMA) network.";
}
enum point-to-multipoint {
description
"Specify point-to-multipoint network.";
}
enum point-to-point {
description
"Specify point-to-point network.";
}
}
description
"Link access type.";
}
typedef timer-multiplier {
type uint8;
description
"The number of timer value intervals that should be
interpreted as a failure.";
}
typedef timer-value-seconds16 {
type union {
type uint16 {
range "1..65535";
}
type enumeration {
enum infinity {
description
"The timer is set to infinity.";
}
enum not-set {
description
"The timer is not set.";
}
}
}
units "seconds";
description
"Timer value type, in seconds (16-bit range).";
}
typedef timer-value-seconds32 {
type union {
type uint32 {
range "1..4294967295";
}
type enumeration {
enum infinity {
description
"The timer is set to infinity.";
}
enum not-set {
description
"The timer is not set.";
}
}
}
units "seconds";
description
"Timer value type, in seconds (32-bit range).";
}
typedef timer-value-milliseconds {
type union {
type uint32 {
range "1..4294967295";
}
type enumeration {
enum infinity {
description
"The timer is set to infinity.";
}
enum not-set {
description
"The timer is not set.";
}
}
}
units "milliseconds";
description
"Timer value type, in milliseconds.";
}
typedef percentage {
type uint8 {
range "0..100";
}
description
"Integer indicating a percentage value.";
}
typedef timeticks64 {
type uint64;
description
"This type is based on the timeticks type defined in
RFC 6991, but with 64-bit width. It represents the time,
modulo 2^64, in hundredths of a second between two epochs.";
reference
"RFC 6991: Common YANG Data Types.";
}
typedef uint24 {
type uint32 {
range "0..16777215";
}
description
"24-bit unsigned integer.";
}
/*** Collection of types related to MPLS/GMPLS ***/
typedef generalized-label {
type binary;
description
"Generalized Label. Nodes sending and receiving the
Generalized Label are aware of the link-specific
label context and type.";
reference
"RFC 3471: Generalized Multi-Protocol Label Switching (GMPLS)
Signaling Functional Description. Section 3.2.";
}
typedef mpls-label-special-purpose {
type identityref {
base mpls-label-special-purpose-value;
}
description
"This type represents the special-purpose MPLS label values.";
reference
"RFC 3032: MPLS Label Stack Encoding.
RFC 7274: Allocating and Retiring Special-Purpose MPLS
Labels.";
}
typedef mpls-label-general-use {
type uint32 {
range "16..1048575";
}
description
"The 20-bit label value in an MPLS label stack as specified
in RFC 3032. This label value does not include the
encodings of Traffic Class and TTL (Time to Live).
The label range specified by this type is for general use,
with special-purpose MPLS label values excluded.";
reference
"RFC 3032: MPLS Label Stack Encoding.";
}
typedef mpls-label {
type union {
type mpls-label-special-purpose;
type mpls-label-general-use;
}
description
"The 20-bit label value in an MPLS label stack as specified
in RFC 3032. This label value does not include the
encodings of Traffic Class and TTL.";
reference
"RFC 3032: MPLS Label Stack Encoding.";
}
/*** Groupings **/
grouping mpls-label-stack {
description
"This grouping specifies an MPLS label stack. The label
stack is encoded as a list of label stack entries. The
list key is an identifier that indicates the relative
ordering of each entry, with the lowest-value identifier
corresponding to the top of the label stack.";
container mpls-label-stack {
description
"Container for a list of MPLS label stack entries.";
list entry {
key "id";
description
"List of MPLS label stack entries.";
leaf id {
type uint8;
description
"Identifies the entry in a sequence of MPLS label
stack entries. An entry with a smaller identifier
value precedes an entry with a larger identifier
value in the label stack. The value of this ID has
no semantic meaning other than relative ordering
and referencing the entry.";
}
leaf label {
type rt-types:mpls-label;
description
"Label value.";
}
leaf ttl {
type uint8;
description
"Time to Live (TTL).";
reference
"RFC 3032: MPLS Label Stack Encoding.";
}
leaf traffic-class {
type uint8 {
range "0..7";
}
description
"Traffic Class (TC).";
reference
"RFC 5462: Multiprotocol Label Switching (MPLS) Label
Stack Entry: 'EXP' Field Renamed to 'Traffic Class'
Field.";
}
}
}
}
grouping vpn-route-targets {
description
"A grouping that specifies Route Target import-export rules
used in BGP-enabled VPNs.";
reference
"RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
RFC 4664: Framework for Layer 2 Virtual Private Networks
(L2VPNs).";
list vpn-target {
key "route-target";
description
"List of Route Targets.";
leaf route-target {
type rt-types:route-target;
description
"Route Target value.";
}
leaf route-target-type {
type rt-types:route-target-type;
mandatory true;
description
"Import/export type of the Route Target.";
}
}
}
}
@@ -1,49 +0,0 @@
module infix-dhcp-client {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:infix-dhcp-client";
prefix dhc4-clnt;
import ietf-interfaces {
prefix "if";
}
contact "kernelkit@googlegroups.com";
description "This module implements an IPv4 DHCP client";
revision 2023-05-22 {
description "Initial revision.";
reference "rfc2131 rfc7950";
}
/*
* Data Nodes
*/
container dhcp-client {
description
"DHCPv4 client configuration";
leaf enabled {
type boolean;
default "true";
description "Globally enables the DHCP client function.";
}
list client-if {
key "if-name";
description "List of interfaces requesting DHCPv4 configuration.";
leaf if-name {
type if:interface-ref;
mandatory true;
description "Name of the interface.";
}
leaf enabled {
type boolean;
default "true";
description "Enable DHCP client for this interface.";
}
leaf client-id {
type string;
description "Optional Client ID, option 61, default: MAC address.";
}
}
}
}
@@ -0,0 +1,158 @@
module infix-dhcp-client {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:infix-dhcp-client";
prefix dhc4-clnt;
import ietf-interfaces {
prefix "if";
}
contact "kernelkit@googlegroups.com";
description "This module implements an IPv4 DHCP client";
revision 2024-01-30 {
description "Add DHCP client options, arping, and route preference.";
reference "internal";
}
revision 2023-05-22 {
description "Initial revision.";
reference "rfc2131 rfc7950";
}
/*
* Typedefs
*/
typedef route-preference {
type uint32;
description "This type is used for route preferences (metric).";
}
typedef dhcp-options {
type union {
type string;
type enumeration {
enum subnet {
value 1;
description "Subnet (IP address and netmask)";
}
enum router {
value 3;
description "Default route(s)";
}
enum dns {
value 6;
description "DNS server";
}
enum hostname {
value 12;
description "Hostname";
}
enum domain {
value 15;
description "Domain name";
}
enum broadcast {
value 28;
description "Broadcast address";
}
enum ntpsrv {
value 42;
description "NTP server";
}
enum address {
value 50;
description "Requested (previously cached) address";
}
enum clientid {
value 61;
description "Client ID (default MAC, and option 12)";
}
enum fqdn {
value 81;
description "Request DNS update of client FQDN argument";
}
enum search {
value 119;
description "Domain search list";
}
enum staticroutes {
value 121;
description "Classless static routes";
}
enum msstaticroutes {
value 249;
description "Microsoft classless static routes";
}
}
}
description "Supported DHCP client request options";
}
/*
* Data Nodes
*/
container dhcp-client {
description
"DHCPv4 client configuration";
leaf enabled {
type boolean;
default "true";
description "Globally enables the DHCP client function.";
}
list client-if {
key "if-name";
description "List of interfaces requesting DHCPv4 configuration.";
leaf if-name {
type if:interface-ref;
mandatory true;
description "Name of the interface.";
}
leaf enabled {
type boolean;
default "true";
description "Enable DHCP client for this interface.";
}
leaf client-id {
type string;
description "Optional Client ID, option 61, default: MAC address.";
}
leaf arping {
type boolean;
default "true";
description "ARP for lease to check for IP address collisions (slow).";
}
list option {
key "name";
description
"List of DHCP options to request (and accept). The default is an
empty list, meaning all supported options. To restrict the
client to only get IP address and default route, set this to:
'subnet router'";
leaf name {
type dhcp-options;
description "DHCP option to request from, or inform server of.";
}
leaf value {
type string;
description "Optional value, only used for non-flag request options.
Example: option:hostname, value:xyzzy
option:clientid, value:01:02:03:04:05:06:07:08:09:0a
option:0x51, value:xyzzy.example.com";
must "../name != 'hostname' or re-match(., '[a-zA-Z0-9\\-_]{0,253}')";
}
}
leaf route-preference {
type route-preference;
default 100;
description
"The metric any route is installed with, both option 33 and 121.
The default (100) is based on a plain Ethernet interface, the
interface type determines this, e.g. a WiFi interface would be
metric 500.";
}
}
}
}
@@ -14,6 +14,11 @@ module infix-ethernet-interface {
contact "kernelkit@googlegroups.com";
description "Extensions and deviations to ieee802-ethernet-interface.yang";
revision 2024-01-22 {
description "Support ethernet but not negotiation-status";
reference "internal";
}
revision 2023-11-22 {
description "Initial revision.";
reference "internal";
@@ -25,18 +30,6 @@ module infix-ethernet-interface {
/* Deviations for config and status */
/* The following works with yanglint but is not supported by pyang.
Actually, the same error message is shown also by NETCONFc, so
we drop this for the v23.11 release. Despite not supporting
writing to any of these nodes.
deviation "/if:interfaces/if:interface/eth:ethernet" {
deviate add {
config false;
}
}
*/
deviation "/if:interfaces/if:interface/eth:ethernet/eth:flow-control" {
deviate not-supported;
}
@@ -52,6 +45,9 @@ module infix-ethernet-interface {
deviation "/if:interfaces/if:interface/eth:ethernet/eth:capabilities" {
deviate not-supported;
}
deviation "/if:interfaces/if:interface/eth:ethernet/eth:auto-negotiation/eth:negotiation-status" {
deviate not-supported;
}
/* Deviations for statistics */
deviation "/if:interfaces/if:interface/eth:ethernet/eth:statistics/eth:frame/eth:in-total-frames" {

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