Skip to content
Draft

New frr #1384

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions board/common/rootfs/etc/default/mgmtd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MGMTD_ARGS="-A 127.0.0.1 -u frr -g frr --log syslog --log-level err -M grpc"
3 changes: 3 additions & 0 deletions board/common/rootfs/etc/finit.d/available/netd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#set DEBUG=1

service <!pid/mgmtd> name:netd log [S12345] netd -p /run/netd.pid -- Network route daemon
1 change: 1 addition & 0 deletions board/common/rootfs/etc/finit.d/enabled/netd.conf
Empty file.
8 changes: 5 additions & 3 deletions board/common/rootfs/usr/share/udhcpc/default.script
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ACTION="$1"
IP_CACHE="/var/lib/misc/${interface}.cache"
RESOLV_CONF="/run/resolvconf/interfaces/${interface}.conf"
NTPFILE="/run/chrony/dhcp-sources.d/${interface}.sources"
NAME="/etc/frr/static.d/${interface}-dhcp.conf"
NAME="/etc/netd/conf.d/${interface}-dhcp.conf"
NEXT="${NAME}+"

[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
Expand Down Expand Up @@ -102,7 +102,8 @@ set_dhcp_routes()
cmp -s "$NAME" "$NEXT" && return
mv "$NEXT" "$NAME"

initctl -nbq restart staticd
killall -SIGHUP netd
killall staticd
}

clr_dhcp_routes()
Expand All @@ -111,7 +112,8 @@ clr_dhcp_routes()
[ -f "$NAME" ] || return
rm "$NAME"

initctl -nbq restart staticd
killall -SIGHUP netd
killall staticd
}

clr_dhcp_addresses()
Expand Down
2 changes: 1 addition & 1 deletion buildroot
1 change: 1 addition & 0 deletions configs/aarch64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ INFIX_SUPPORT="mailto:kernelkit@googlegroups.com"
BR2_PACKAGE_FEATURE_WIFI_MEDIATEK=y
BR2_PACKAGE_FEATURE_WIFI_REALTEK=y
BR2_PACKAGE_CONFD=y
BR2_PACKAGE_NETD=y
BR2_PACKAGE_CONFD_TEST_MODE=y
BR2_PACKAGE_CURIOS_HTTPD=y
BR2_PACKAGE_CURIOS_NFTABLES=y
Expand Down
1 change: 1 addition & 0 deletions configs/aarch64_minimal_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ INFIX_HOME="https://github.com/kernelkit/infix/"
INFIX_DOC="https://kernelkit.org/infix/"
INFIX_SUPPORT="mailto:kernelkit@googlegroups.com"
BR2_PACKAGE_CONFD=y
BR2_PACKAGE_NETD=y
BR2_PACKAGE_CONFD_TEST_MODE=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
Expand Down
1 change: 1 addition & 0 deletions configs/arm_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ INFIX_SUPPORT="mailto:kernelkit@googlegroups.com"
BR2_PACKAGE_FEATURE_WIFI_MEDIATEK=y
BR2_PACKAGE_FEATURE_WIFI_REALTEK=y
BR2_PACKAGE_CONFD=y
BR2_PACKAGE_NETD=y
BR2_PACKAGE_CONFD_TEST_MODE=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
Expand Down
1 change: 1 addition & 0 deletions configs/arm_minimal_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ INFIX_HOME="https://github.com/kernelkit/infix/"
INFIX_DOC="https://kernelkit.org/infix/"
INFIX_SUPPORT="mailto:kernelkit@googlegroups.com"
BR2_PACKAGE_CONFD=y
BR2_PACKAGE_NETD=y
BR2_PACKAGE_CONFD_TEST_MODE=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
Expand Down
1 change: 1 addition & 0 deletions configs/riscv64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ BR2_PACKAGE_FEATURE_WIFI=y
BR2_PACKAGE_FEATURE_WIFI_MEDIATEK=y
BR2_PACKAGE_FEATURE_WIFI_REALTEK=y
BR2_PACKAGE_CONFD=y
BR2_PACKAGE_NETD=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
BR2_PACKAGE_FACTORY=y
Expand Down
1 change: 1 addition & 0 deletions configs/x86_64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ BR2_PACKAGE_FEATURE_WIFI=y
BR2_PACKAGE_FEATURE_WIFI_MEDIATEK=y
BR2_PACKAGE_FEATURE_WIFI_REALTEK=y
BR2_PACKAGE_CONFD=y
BR2_PACKAGE_NETD=y
BR2_PACKAGE_CONFD_TEST_MODE=y
BR2_PACKAGE_CURIOS_HTTPD=y
BR2_PACKAGE_CURIOS_NFTABLES=y
Expand Down
1 change: 1 addition & 0 deletions configs/x86_64_minimal_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ INFIX_HOME="https://github.com/kernelkit/infix/"
INFIX_DOC="https://kernelkit.org/infix/"
INFIX_SUPPORT="mailto:kernelkit@googlegroups.com"
BR2_PACKAGE_CONFD=y
BR2_PACKAGE_NETD=y
BR2_PACKAGE_CONFD_TEST_MODE=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
Expand Down
1 change: 1 addition & 0 deletions package/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ source "$BR2_EXTERNAL_INFIX_PATH/package/feature-wifi/Config.in"
comment "Software Packages"
source "$BR2_EXTERNAL_INFIX_PATH/package/bin/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/confd/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/netd/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/confd-test-mode/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/curios-httpd/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/curios-nftables/Config.in"
Expand Down
30 changes: 30 additions & 0 deletions package/netd/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
config BR2_PACKAGE_NETD
bool "netd"
select BR2_PACKAGE_LIBITE
help
Network route daemon. Manages static routes and RIP routing.
Reads configuration from /etc/netd/conf.d/*.conf.

With FRR: Full routing via gRPC (static routes, RIP, OSPF).
Without FRR: Standalone Linux backend via rtnetlink.

https://github.com/kernelkit/infix

if BR2_PACKAGE_NETD

config BR2_PACKAGE_NETD_FRR
bool "FRR integration"
default y if BR2_PACKAGE_FRR
depends on BR2_PACKAGE_FRR
select BR2_PACKAGE_PROTOBUF
select BR2_PACKAGE_GRPC
select BR2_PACKAGE_HOST_PROTOBUF
select BR2_PACKAGE_HOST_GRPC
help
Enable FRR integration via gRPC northbound API.
Provides full routing support (static routes, RIP, OSPF).

If disabled, netd uses Linux kernel backend (rtnetlink)
with static routes only.

endif
3 changes: 3 additions & 0 deletions package/netd/netd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#set DEBUG=1

service name:netd log [S12345] netd -p /run/netd.pid -- Network route daemon
32 changes: 32 additions & 0 deletions package/netd/netd.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
################################################################################
#
# netd
#
################################################################################

NETD_VERSION = 1.0
NETD_SITE_METHOD = local
NETD_SITE = $(BR2_EXTERNAL_INFIX_PATH)/src/netd
NETD_LICENSE = BSD-3-Clause
NETD_LICENSE_FILES = LICENSE
NETD_REDISTRIBUTE = NO
NETD_DEPENDENCIES = libite
NETD_AUTORECONF = YES

NETD_CONF_ENV = CFLAGS="$(INFIX_CFLAGS)"

NETD_CONF_OPTS = --prefix= --disable-silent-rules

# FRR integration (gRPC backend) or standalone Linux backend
ifeq ($(BR2_PACKAGE_NETD_FRR),y)
NETD_DEPENDENCIES += frr grpc host-grpc protobuf
NETD_CONF_ENV += \
PROTOC="$(HOST_DIR)/bin/protoc" \
GRPC_CPP_PLUGIN="$(HOST_DIR)/bin/grpc_cpp_plugin"
else
NETD_CONF_OPTS += --without-frr
endif

NETD_TARGET_FINALIZE_HOOKS += NETD_INSTALL_EXTRA

$(eval $(autotools-package))
5 changes: 3 additions & 2 deletions package/skeleton-init-finit/skeleton-init-finit.mk
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ endif

ifeq ($(BR2_PACKAGE_FRR),y)
define SKELETON_INIT_FINIT_SET_FRR
for svc in babeld bfdd bgpd eigrpd isisd ldpd ospfd ospf6d pathd ripd ripng staticd vrrpd zebra; do \
for svc in babeld bfdd bgpd mgmtd eigrpd isisd ldpd ospfd ospf6d pathd ripd ripng staticd vrrpd zebra; do \
cp $(SKELETON_INIT_FINIT_AVAILABLE)/frr/$$svc.conf $(FINIT_D)/available/$$svc.conf; \
done
ln -sf ../available/staticd.conf $(FINIT_D)/enabled/staticd.conf
ln -sf ../available/zebra.conf $(FINIT_D)/enabled/zebra.conf
ln -sf ../available/staticd.conf $(FINIT_D)/enabled/staticd.conf
ln -sf ../available/mgmtd.conf $(FINIT_D)/enabled/mgmtd.conf
endef
SKELETON_INIT_FINIT_POST_INSTALL_TARGET_HOOKS += SKELETON_INIT_FINIT_SET_FRR
endif # BR2_PACKAGE_FRR
Expand Down
2 changes: 1 addition & 1 deletion package/skeleton-init-finit/skeleton/etc/default/ripd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# --log-level debug
RIPD_ARGS="-A 127.0.0.1 -u frr -g frr -f /etc/frr/ripd.conf --log syslog"
RIPD_ARGS="-A 127.0.0.1 -u frr -g frr --log syslog"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
service <!> pid:!/run/frr/mgmtd.pid env:-/etc/default/mgmtd \
[2345] mgmtd $MGMTD_ARGS -- FRR MGMT daemon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Run staticd-helper to collate /etc/static.d/*.conf before starting staticd
service log:null <!pid/zebra> pre:/usr/sbin/staticd-helper \
[2345] staticd -A 127.0.0.1 -u frr -g frr -f /etc/frr/staticd.conf \
service log:null <!pid/zebra> \
[2345] staticd -A 127.0.0.1 -u frr -g frr \
-- Static routing daemon
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
service <!> pid:!/run/frr/zebra.pid env:-/etc/default/zebra \
service <!pid/netd> pid:!/run/frr/zebra.pid env:-/etc/default/zebra \
[2345] zebra $ZEBRA_ARGS -- Zebra routing daemon
128 changes: 128 additions & 0 deletions patches/frr/10.5.1/0001-Libyang4-compat.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
From 597cf064f6076e3859f72b0da4dc0ab98ca2e1d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= <lazzer@gmail.com>
Date: Tue, 27 Jan 2026 22:54:59 +0100
Subject: [PATCH 1/2] Libyang4 compat
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires

libyang4 had breaking changes needs to be adapded for it.

Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
lib/northbound.c | 7 ++++++-
lib/yang.c | 24 +++++++++++++++++++++---
lib/yang.h | 6 ++++++
3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/lib/northbound.c b/lib/northbound.c
index c21436804f..4de63f9b2d 100644
--- a/lib/northbound.c
+++ b/lib/northbound.c
@@ -2299,7 +2299,12 @@ bool nb_cb_operation_is_valid(enum nb_cb_operation operation,
if (sleaf->when)
return true;
if (CHECK_FLAG(sleaf->flags, LYS_MAND_TRUE)
- || sleaf->dflt)
+#if (LY_VERSION_MAJOR < 4)
+ || sleaf->dflt
+#else
+ || sleaf->dflt.str
+#endif
+ )
return false;
break;
case LYS_CONTAINER:
diff --git a/lib/yang.c b/lib/yang.c
index a8f66dce6e..aef0468a68 100644
--- a/lib/yang.c
+++ b/lib/yang.c
@@ -401,9 +401,13 @@ const char *yang_snode_get_default(const struct lysc_node *snode)
switch (snode->nodetype) {
case LYS_LEAF:
sleaf = (const struct lysc_node_leaf *)snode;
- return sleaf->dflt ? lyd_value_get_canonical(sleaf->module->ctx,
- sleaf->dflt)
+#if (LY_VERSION_MAJOR < 4)
+ return sleaf->dflt ? lyd_value_get_canonical(sleaf->module->ctx, sleaf->dflt)
: NULL;
+#else
+ /* NOTE: this is value in the schema, not necessarily the canonical form */
+ return sleaf->dflt.str;
+#endif
case LYS_LEAFLIST:
/* TODO: check leaf-list default values */
return NULL;
@@ -954,6 +958,9 @@ LY_ERR yang_parse_notification(const char *xpath, LYD_FORMAT format,
}

err = lyd_parse_op(ly_native_ctx, NULL, in, format, LYD_TYPE_NOTIF_YANG,
+#if (LY_VERSION_MAJOR >= 4)
+ LYD_PARSE_LYB_SKIP_CTX_CHECK /* parse_options */,
+#endif
&tree, NULL);
ly_in_free(in, 0);
if (err) {
@@ -1025,6 +1032,9 @@ LY_ERR yang_parse_rpc(const char *xpath, LYD_FORMAT format, const char *data,

err = lyd_parse_op(ly_native_ctx, parent, in, format,
reply ? LYD_TYPE_REPLY_YANG : LYD_TYPE_RPC_YANG,
+#if (LY_VERSION_MAJOR >= 4)
+ LYD_PARSE_LYB_SKIP_CTX_CHECK /* parse_options */,
+#endif
NULL, rpc);
ly_in_free(in, 0);
if (err) {
@@ -1072,6 +1082,7 @@ char *yang_convert_lyd_format(const char *data, size_t data_len,
bool shrink)
{
struct lyd_node *tree = NULL;
+ uint32_t parse_options = LYD_PARSE_ONLY;
uint32_t options = LYD_PRINT_WD_EXPLICIT | LYD_PRINT_WITHSIBLINGS;
uint8_t *result = NULL;
LY_ERR err;
@@ -1086,8 +1097,12 @@ char *yang_convert_lyd_format(const char *data, size_t data_len,
if (in_format == out_format)
return darr_strdup((const char *)data);

+#ifdef LYD_PARSE_LYB_SKIP_CTX_CHECK
+ if (in_format == LYD_LYB)
+ parse_options |= LYD_PARSE_LYB_SKIP_CTX_CHECK;
+#endif
err = lyd_parse_data_mem(ly_native_ctx, (const char *)data, in_format,
- LYD_PARSE_ONLY, 0, &tree);
+ parse_options, 0, &tree);

if (err) {
flog_err_sys(EC_LIB_LIBYANG,
@@ -1171,6 +1186,9 @@ struct ly_ctx *yang_ctx_new_setup(bool embedded_modules, bool explicit_compile,
}

options = LY_CTX_DISABLE_SEARCHDIR_CWD;
+#if (LY_VERSION_MAJOR >= 4)
+ options |= LY_CTX_LYB_HASHES;
+#endif
if (!load_library)
options |= LY_CTX_NO_YANGLIBRARY;
if (explicit_compile)
diff --git a/lib/yang.h b/lib/yang.h
index 3877a421c5..7942573158 100644
--- a/lib/yang.h
+++ b/lib/yang.h
@@ -16,6 +16,12 @@

#include "yang_wrappers.h"

+/* libyang4 renamed LYD_PRINT_WITHSIBLINGS to LYD_PRINT_SIBLINGS */
+#include <libyang/version.h>
+#if (LY_VERSION_MAJOR >= 4)
+#define LYD_PRINT_WITHSIBLINGS LYD_PRINT_SIBLINGS
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
--
2.43.0

Loading