Skip to contentSkip to conversation

add frr package

PATCH Superseded Vadim Kochan 2 participants 14 messages Feb 24, 2020 – Feb 25, 2020

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover add frr package

FRR is free software that implements and manages various IPv4 and IPv6 routing protocols. It runs on nearly all distributions of Linux and BSD as well as Solaris and supports all modern CPU architectures.

FRR currently supports the following protocols:

BGP
OSPFv2
OSPFv3
RIPv1
RIPv2
RIPng
IS-IS
PIM-SM/MSDP
LDP
BFD
Babel
PBR
OpenFabric
VRRP
EIGRP (alpha)
NHRP (alpha)

FRR package requires rtrlib which is added in separate patch. There was issues on target 'make install' which I could not fix otherway than adding half-custom install hook to install binaries and configs.

RTRLib package requires LYD_PRIV option to be enabled in libyang package, hence enabled it in separate patch.

Vadim Kochan (3):
package/libyang: enable LYD_PRIV option
package/rtrlib: new package
package/frr: new package

 DEVELOPERS                 |   2 +
 package/Config.in          |   2 +
 package/frr/Config.in      |  23 ++++++++
 package/frr/S50frr         |  38 ++++++++++++++
 package/frr/frr.hash       |   2 +
 package/frr/frr.mk         | 105 +++++++++++++++++++++++++++++++++++++
 package/libyang/libyang.mk |   3 +-
 package/rtrlib/Config.in   |  13 +++++
 package/rtrlib/rtrlib.hash |   2 +
 package/rtrlib/rtrlib.mk   |  20 +++++++
 10 files changed, 209 insertions(+), 1 deletion(-)
 create mode 100644 package/frr/Config.in
 create mode 100644 package/frr/S50frr
 create mode 100644 package/frr/frr.hash
 create mode 100644 package/frr/frr.mk
 create mode 100644 package/rtrlib/Config.in
 create mode 100644 package/rtrlib/rtrlib.hash
 create mode 100644 package/rtrlib/rtrlib.mk
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 package/libyang: enable LYD_PRIV option

This option is required by frr package, so enable it by default.

---
 package/libyang/libyang.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/libyang/libyang.mk +2 -1
index 648ffeb6a3..e701c6f448 100644
@@ -15,7 +15,8 @@ HOST_LIBYANG_DEPENDENCIES = host-pcre
 
 LIBYANG_CONF_OPTS = \
 	-DENABLE_VALGRIND_TESTS=OFF \
-	-DGEN_PYTHON_BINDINGS=OFF
+	-DGEN_PYTHON_BINDINGS=OFF \
+	-DENABLE_LYD_PRIV=ON
 
 HOST_LIBYANG_CONF_OPTS = \
 	-DENABLE_VALGRIND_TESTS=OFF \
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/3 package/libyang: enable LYD_PRIV option

Quoted 3 lines · On Mon, 24 Feb 2020 19:26:50 +0200 Vadim Kochan <[email protected]> wrote:

This option is required by frr package, so enable it by default.

What is this option doing? How much more space does it require? In other words, do we want to enable it unconditionally, or do we want to make it optional ?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 1/3 package/libyang: enable LYD_PRIV option

Quoted 11 lines · Thomas Petazzoni
Quoted 3 lines · On Mon, 24 Feb 2020 19:26:50 +0200 Vadim Kochan <[email protected]> wrote:

This option is required by frr package, so enable it by default.

What is this option doing? How much more space does it require? In other words, do we want to enable it unconditionally, or do we want to make it optional ?

Sorry, I did not compare it, actually this option might be turned on if rtrlib is selected. Moreover rtrlib adding might be dropped from this series because (my mistake I missed this) frr requires rtrlib for rpki support only, which might be not enabled by default.

Regards,
Vadim Kochan

#4 lore raw

PATCH 2/3 package/rtrlib: new package

In reply to Vadim Kochan

The RTRlib implements the client-side of the RPKI-RTR protocol (RFC 6810), (RFC 8210) and BGP Prefix Origin Validation (RFC 6811). This also enables the maintenance of router keys. Router keys are required to deploy BGPSEC.

It is required by frr package.

---
 DEVELOPERS                 |  1 +
 package/Config.in          |  1 +
 package/rtrlib/Config.in   | 13 +++++++++++++
 package/rtrlib/rtrlib.hash |  2 ++
 package/rtrlib/rtrlib.mk   | 20 ++++++++++++++++++++
 5 files changed, 37 insertions(+)
 create mode 100644 package/rtrlib/Config.in
 create mode 100644 package/rtrlib/rtrlib.hash
 create mode 100644 package/rtrlib/rtrlib.mk
DEVELOPERS +1 -0
index 7d3d1ca11a..e07236937b 100644
@@ -2479,6 +2479,7 @@ N:	Vadim Kochan <[email protected]>
 F:	package/brcm-patchram-plus/
 F:	package/gettext-tiny/
 F:	package/tinyssh/
+F:	package/rtrlib/
 
 N:	Valentin Korenblit <[email protected]>
 F:	package/clang/
package/Config.in +1 -0
index dfa3f34b9d..60bf9aac10 100644
@@ -1724,6 +1724,7 @@ menu "Networking"
 	source "package/rabbitmq-c/Config.in"
 	source "package/restclient-cpp/Config.in"
 	source "package/rtmpdump/Config.in"
+	source "package/rtrlib/Config.in"
 	source "package/slirp/Config.in"
 	source "package/snmppp/Config.in"
 	source "package/sofia-sip/Config.in"
package/rtrlib/Config.in new file +13 -0
new file mode 100644
index 0000000000..440eeb5d63
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_RTRLIB
+	bool "rtrlib"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_HAS_SSP
+	help
+	  An open-source C implementation of the RPKI/Router Protocol client.
+
+	  http://rtrlib.realmv6.org
+
+comment "rtrlib requires toolchain w/ threads, SSP"
+	  depends on !BR2_TOOLCHAIN_HAS_THREADS || \
+		  !BR2_TOOLCHAIN_HAS_SSP
+
package/rtrlib/rtrlib.hash new file +2 -0
new file mode 100644
index 0000000000..3fb590bceb
@@ -0,0 +1,2 @@
+sha256 f6e825cedadac970f681e3714dad396fd62cb811b98a94d8e8e02e0c5abe765a  LICENSE
+sha256 79fbfaa624dd4b53b304cd7c755ee31219b53558a5ee21eb81ca796356190af6  rtrlib-0.7.0.tar.gz
package/rtrlib/rtrlib.mk new file +20 -0
new file mode 100644
index 0000000000..4385484bf1
@@ -0,0 +1,20 @@
+################################################################################
+#
+# rtrlib
+#
+################################################################################
+
+RTRLIB_VERSION = 0.7.0
+RTRLIB_SITE = $(call github,rtrlib,rtrlib,v$(RTRLIB_VERSION))
+RTRLIB_LICENSE = MIT
+RTRLIB_LICENSE_FILES = LICENSE
+RTRLIB_INSTALL_STAGING = YES
+
+ifeq ($(BR2_PACKAGE_LIBSSH),y)
+RTRLIB_CONF_OPTS += -DRTRLIB_TRANSPORT_SSH=Yes
+RTRLIB_DEPENDENCIES += libssh
+else
+RTRLIB_CONF_OPTS += -DRTRLIB_TRANSPORT_SSH=No
+endif
+
+$(eval $(cmake-package))
Signature · 1 line
2.17.1
#5 lore raw

PATCH 2/3 package/rtrlib: new package

Hello Vadim,

package/rtrlib/Config.in line 4

Quoted 10 lines · On Mon, 24 Feb 2020 19:26:51 +0200 Vadim Kochan <[email protected]> wrote:
package/rtrlib/Config.in new file +4 -0
new file mode 100644
index 0000000000..440eeb5d63
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_RTRLIB
+	bool "rtrlib"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_HAS_SSP

It's pretty uncommon for a package to require SSP support. Can you tell it instead to not pass -fstack-protector when building, and let Buildroot decide when to pass it ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

PATCH 2/3 package/rtrlib: new package

Hi Thomas,

Quoted 5 lines · Thomas Petazzoni

Hello Vadim,

On Mon, 24 Feb 2020 19:26:51 +0200
Vadim Kochan <[email protected]> wrote:

Quoted 15 lines

package/rtrlib/Config.in line 4

Quoted 10 lines
package/rtrlib/Config.in new file +4 -0
new file mode 100644
index 0000000000..440eeb5d63
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_RTRLIB
+	bool "rtrlib"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_HAS_SSP

It's pretty uncommon for a package to require SSP support. Can you tell it instead to not pass -fstack-protector when building, and let Buildroot decide when to pass it ?

I will try, but actually actually I was wrong that this package is required by ffr, it is required but optionally for rpki support. So, this patch might be dropped with not enabled rpki feature in frr.

Thanks,
Vadim Kochan

#7 lore raw

PATCH 3/3 package/frr: new package

In reply to Vadim Kochan

FRR is free software that implements and manages various IPv4 and IPv6 routing protocols. It runs on nearly all distributions of Linux and BSD as well as Solaris and supports all modern CPU architectures.

FRR currently supports the following protocols:

BGP
OSPFv2
OSPFv3
RIPv1
RIPv2
RIPng
IS-IS
PIM-SM/MSDP
LDP
BFD
Babel
PBR
OpenFabric
VRRP
EIGRP (alpha)
NHRP (alpha)

---
 DEVELOPERS            |   1 +
 package/Config.in     |   1 +
 package/frr/Config.in |  23 +++++++++
 package/frr/S50frr    |  38 +++++++++++++++
 package/frr/frr.hash  |   2 +
 package/frr/frr.mk    | 105 ++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 170 insertions(+)
 create mode 100644 package/frr/Config.in
 create mode 100644 package/frr/S50frr
 create mode 100644 package/frr/frr.hash
 create mode 100644 package/frr/frr.mk
DEVELOPERS +1 -0
index e07236937b..ef6592afa0 100644
@@ -2480,6 +2480,7 @@ F:	package/brcm-patchram-plus/
 F:	package/gettext-tiny/
 F:	package/tinyssh/
 F:	package/rtrlib/
+F:	package/frr/
 
 N:	Valentin Korenblit <[email protected]>
 F:	package/clang/
package/Config.in +1 -0
index 60bf9aac10..51dc3480f4 100644
@@ -1999,6 +1999,7 @@ menu "Networking applications"
 	source "package/fping/Config.in"
 	source "package/freeswitch/Config.in"
 	source "package/freeswitch-mod-bcg729/Config.in"
+	source "package/frr/Config.in"
 	source "package/gerbera/Config.in"
 	source "package/gesftpserver/Config.in"
 	source "package/glorytun/Config.in"
package/frr/Config.in new file +23 -0
new file mode 100644
index 0000000000..01673eb837
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_FRR
+	bool "frr"
+	depends on BR2_USE_MMU # fork()
+	depends on BR2_PACKAGE_BASH # init
+	select BR2_PACKAGE_RTRLIB
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_JSON_C
+	select BR2_PACKAGE_LIBYANG
+	select BR2_PACKAGE_LIBCAP
+	select BR2_PACKAGE_LIBNL
+	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_NETSNMP
+	select BR2_PACKAGE_C_ARES
+	help
+	  The FRRouting Protocol Suite.
+
+	  FRR is free software that implements and manages various IPv4 and
+	  IPv6 routing protocols.
+
+	  https://frrouting.org
+
+comment "frr requires BASH for init service"
+	depends on !BR2_PACKAGE_BASH
package/frr/S50frr new file +38 -0
new file mode 100644
index 0000000000..dec7d82a88
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# Starts frr.
+#
+
+start() {
+	printf "Starting frr: "
+	start-stop-daemon -S -q -b \
+		--exec /usr/sbin/frrinit.sh -- start
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+stop() {
+	printf "Stopping frr: "
+	/usr/sbin/frrinit.sh stop
+	start-stop-daemon -K -q -p /run/frr.pid
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+restart() {
+	stop
+	start
+}
+
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart|reload)
+	restart
+	;;
+  *)
+	echo "Usage: $0 {start|stop|restart}"
+	exit 1
+esac
+
+exit $?
package/frr/frr.hash new file +2 -0
new file mode 100644
index 0000000000..7d9ff7ea04
@@ -0,0 +1,2 @@
+sha256 c209ed66a0331221649b8c21dc8c6704ce1696e2017ef4d48f8c2ac6b1fa01b7  frr-7.3.tar.gz
+sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
package/frr/frr.mk new file +105 -0

105 lines not on this page · raw message

Signature · 1 line
2.17.1
#8 lore raw

PATCH 3/3 package/frr: new package

Hello Vadim,

DEVELOPERS F: package/brcm-patchram-plus/ · line 2483

Quoted 9 lines · On Mon, 24 Feb 2020 19:26:52 +0200 Vadim Kochan <[email protected]> wrote:
DEVELOPERS +1 -0
index e07236937b..ef6592afa0 100644
@@ -2480,6 +2480,7 @@ F:	package/brcm-patchram-plus/
 F:	package/gettext-tiny/
 F:	package/tinyssh/
 F:	package/rtrlib/
+F:	package/frr/

Alphabetic ordering is not good here.

Quoted 9 lines
package/frr/Config.in new file +3 -0
new file mode 100644
index 0000000000..01673eb837
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_FRR
+	bool "frr"
+	depends on BR2_USE_MMU # fork()

package/frr/Config.in line 13

Quoted 10 lines
package/frr/Config.in new file +10 -0
+	depends on BR2_PACKAGE_BASH # init
+	select BR2_PACKAGE_RTRLIB
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_JSON_C
+	select BR2_PACKAGE_LIBYANG
+	select BR2_PACKAGE_LIBCAP
+	select BR2_PACKAGE_LIBNL
+	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_NETSNMP
+	select BR2_PACKAGE_C_ARES

That's a lot of packages that you select here, are you sure you properly propagated the "depends on" of all those packages in this Config.in ?

For example, rtrlib depends on threads and SSP, so these need to be propagated here (of course, except if you get rid of the SSP dependency in rtrlib, as suggested in my review of PATCH 2/3).

package/frr/Config.in line 23

Quoted 10 lines
package/frr/Config.in new file +10 -0
+	help
+	  The FRRouting Protocol Suite.
+
+	  FRR is free software that implements and manages various IPv4 and
+	  IPv6 routing protocols.
+
+	  https://frrouting.org
+
+comment "frr requires BASH for init service"
+	depends on !BR2_PACKAGE_BASH

So it's the frrinit.sh script that requires bash ?

This comment also need a BR2_USE_MMU dependency, so that it doesn't show up on noMMU systems.

Quoted 11 lines
package/frr/S50frr new file +5 -0
new file mode 100644
index 0000000000..dec7d82a88
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# Starts frr.
+#
+

package/frr/S50frr line 15

Quoted 10 lines
package/frr/S50frr new file +10 -0
+start() {
+	printf "Starting frr: "
+	start-stop-daemon -S -q -b \
+		--exec /usr/sbin/frrinit.sh -- start
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+stop() {
+	printf "Stopping frr: "
+	/usr/sbin/frrinit.sh stop
+	start-stop-daemon -K -q -p /run/frr.pid

This looks odd. Why do you need to call frrinit.sh stop and then use start-stop-daemon ?

Also, make sure to use package/busybox/S01sysklogd as a template for your init scripts.

Quoted 10 lines
package/frr/frr.mk new file +4 -0
new file mode 100644
index 0000000000..c53e9bb4b0
@@ -0,0 +1,105 @@
+################################################################################
+#
+# frr
+#

package/frr/frr.mk line 14

Quoted 10 lines
package/frr/frr.mk new file +10 -0
+################################################################################
+
+FRR_VERSION = 7.3
+FRR_SOURCE = frr-$(FRR_VERSION).tar.gz
+FRR_SITE = https://github.com/FRRouting/frr/archive
+FRR_LICENSE = GPL-2.0
+FRR_LICENSE_FILES = COPYING
+
+FRR_DEPENDENCIES = rtrlib readline json-c libyang libcap libnl \
+		   ncurses host-frr c-ares

Only one tab to indent the second line.

Quoted 8 lines
package/frr/frr.mk new file +8 -0
+
+HOST_FRR_DEPENDENCIES = host-flex host-bison host-python
+
+FRR_CONF_OPTS = --with-clippy=$(HOST_DIR)/bin/clippy \
+		--sysconfdir=/etc/frr \
+		--localstatedir=/var/run/frr \
+		--with-moduledir=/usr/lib/frr/modules \
+		--enable-configfile-mask=0640 \

package/frr/frr.mk line 32

Quoted 10 lines
package/frr/frr.mk new file +10 -0
+		--enable-logfile-mask=0640 \
+		--enable-multipath=256 \
+		--disable-ospfclient \
+		--enable-shell-access \
+		--enable-user=frr \
+		--enable-group=frr \
+		--enable-vty-group=frrvty \
+		--disable-exampledir \
+		--enable-rpki \
+		--enable-fpm

Ditto, only one tab to indent the continuation lines.

package/frr/frr.mk line 40

Quoted 8 lines
package/frr/frr.mk new file +8 -0
+
+HOST_FRR_CONF_OPTS = --enable-clippy-only
+
+define FRR_RUN_BOOTSTRAP
+	(cd $(@D) && PATH=$(BR_PATH) ./bootstrap.sh)
+endef
+FRR_PRE_CONFIGURE_HOOKS += FRR_RUN_BOOTSTRAP
+HOST_FRR_PRE_CONFIGURE_HOOKS += FRR_RUN_BOOTSTRAP

This won't work as you don't have any guarantee that host-autoconf and host-automake will be built before. Can you use FRR_AUTORECONF = YES, as this is really the best solution ? If not, you need to keep your hooks, but explicitly add host-autoconf and host-automake to the package dependencies.

package/frr/frr.mk line 47

Quoted 6 lines
package/frr/frr.mk new file +6 -0
+define HOST_FRR_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/lib/clippy $(HOST_DIR)/bin/clippy
+endef
+
+
+# for some reason the normal 'install' target fails

Why? Can it be fixed? At least reported to the upstream developers?

package/frr/frr.mk line 52

Quoted 5 lines
package/frr/frr.mk new file +5 -0
+FRR_INSTALL_TARGET_OPTS = DESTDIR="$(TARGET_DIR)" libdir="/usr/lib" \
+			  install-binPROGRAMS \
+			  install-sbinPROGRAMS \
+			  install-sbinSCRIPTS \
+			  installdirs

Only one tab to indent the continuation lines.

package/frr/frr.mk line 55

Quoted 3 lines
package/frr/frr.mk new file +3 -0
+
+define FRR_INSTALL_CONFIG_FILES
+	(cd $(@D) && PATH=$(BR_PATH) ./bootstrap.sh)

Calling bootstrap.sh during the installation? Why?

package/frr/frr.mk line 57

Quoted 2 lines
package/frr/frr.mk new file +2 -0
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/var/log/frr
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/var/run/frr

I'm not sure this is going to work well, as /var/log and /var/run are symlinks to /tmp by default, and a tmpfs is mounted to /tmp.

These directories need to be created at runtime.

package/frr/frr.mk line 59

Quoted 1 line
package/frr/frr.mk new file +1 -0
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/frr

Not needed, as the -D option to the $(INSTALL) commands above will create this folder.

package/frr/frr.mk line 64

Quoted 5 lines
package/frr/frr.mk new file +5 -0
+	$(INSTALL) -D -m 0644 $(@D)/tools/etc/frr/daemons $(TARGET_DIR)/etc/frr/daemons
+	$(INSTALL) -D -m 0644 $(@D)/tools/etc/frr/daemons.conf $(TARGET_DIR)/etc/frr/daemons.conf
+	$(INSTALL) -D -m 0644 $(@D)/tools/etc/frr/frr.conf $(TARGET_DIR)/etc/frr/frr.conf
+	$(INSTALL) -D -m 0644 $(@D)/tools/etc/frr/vtysh.conf $(TARGET_DIR)/etc/frr/vtysh.conf
+	$(INSTALL) -D -m 0644 $(@D)/tools/etc/frr/support_bundle_commands.conf $(TARGET_DIR)/etc/frr/support_bundle_commands.conf

This probably calls for a for loop:

	$(foreach f,daemons daemons.conf frr.conf vtysh.conf support_bundle_commands.conf,\
		$(INSTALL) -D -m 0644 $(@D)/tools/etc/frr/$(f) \
			$(TARGET_DIR)/etc/frr/$(f)
	)

package/frr/frr.mk line 75

Quoted 10 lines
package/frr/frr.mk new file +10 -0
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/zebra.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/bgpd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/ospfd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/ospf6d.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/isisd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/ripd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/ripngd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/pimd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/ldpd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/nhrpd.conf

Installing /dev/null ? Here is just creates an empty regular file. Does it really makes sense? What are you trying to do here ?

package/frr/frr.mk line 81

Quoted 6 lines
package/frr/frr.mk new file +6 -0
+endef
+FRR_POST_INSTALL_TARGET_HOOKS += FRR_INSTALL_CONFIG_FILES
+
+define FRR_PERMISSIONS
+	/var/log/frr d 755 frr frr - - - - -
+	/var/run/frr d 755 frr frr - - - - -

This is not going to work, as explained above.

package/frr/frr.mk line 91

Quoted 10 lines
package/frr/frr.mk new file +10 -0
+	/etc/frr/zebra.conf f 644 frr frr - - - - -
+	/etc/frr/bgpd.conf f 644 frr frr - - - - -
+	/etc/frr/ospfd.conf f 644 frr frr - - - - -
+	/etc/frr/ospf6d.conf f 644 frr frr - - - - -
+	/etc/frr/isisd.conf f 644 frr frr - - - - -
+	/etc/frr/ripd.conf f 644 frr frr - - - - -
+	/etc/frr/ripngd.conf f 644 frr frr - - - - -
+	/etc/frr/pimd.conf f 644 frr frr - - - - -
+	/etc/frr/ldpd.conf f 644 frr frr - - - - -
+	/etc/frr/nhrpd.conf f 644 frr frr - - - - -

So all these empty files need to be writable ?

Quoted 4 lines
package/frr/frr.mk new file +4 -0
+	/etc/frr/vtysh.conf f 644 frr frrvty - - - - -
+endef
+
+define FRR_USERS

package/frr/frr.mk line 105

Quoted 10 lines
package/frr/frr.mk new file +10 -0
+	frr -1 frr -1 * /var/run/frr - frrvty FRR user priv
+endef
+
+define FRR_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 755 $(FRR_PKGDIR)/S50frr \
+		$(TARGET_DIR)/etc/init.d/S50frr
+endef
+
+$(eval $(autotools-package))
+$(eval $(host-autotools-package))

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#9 lore raw

PATCH 3/3 package/frr: new package

Quoted 5 lines · Thomas Petazzoni

Hello Vadim,

On Mon, 24 Feb 2020 19:26:52 +0200
Vadim Kochan <[email protected]> wrote:

Quoted 11 lines

DEVELOPERS F: package/brcm-patchram-plus/ · line 2483

Quoted 9 lines
DEVELOPERS +1 -0
index e07236937b..ef6592afa0 100644
@@ -2480,6 +2480,7 @@ F:	package/brcm-patchram-plus/
 F:	package/gettext-tiny/
 F:	package/tinyssh/
 F:	package/rtrlib/
+F:	package/frr/

Alphabetic ordering is not good here.

OK

Quoted 16 lines
Quoted 16 lines
package/frr/Config.in new file +9 -0
new file mode 100644
index 0000000000..01673eb837
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_FRR
+	bool "frr"
+	depends on BR2_USE_MMU # fork()
+	depends on BR2_PACKAGE_BASH # init
+	select BR2_PACKAGE_RTRLIB
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_JSON_C
+	select BR2_PACKAGE_LIBYANG
+	select BR2_PACKAGE_LIBCAP
Quoted 8 lines

package/frr/Config.in line 13

Quoted 4 lines
package/frr/Config.in new file +4 -0
+	select BR2_PACKAGE_LIBNL
+	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_NETSNMP
+	select BR2_PACKAGE_C_ARES

That's a lot of packages that you select here, are you sure you properly propagated the "depends on" of all those packages in this Config.in ?

will try to check by disabling one by one.

Quoted 5 lines

For example, rtrlib depends on threads and SSP, so these need to be propagated here (of course, except if you get rid of the SSP dependency in rtrlib, as suggested in my review of PATCH 2/3).

Quoted 12 lines

package/frr/Config.in line 23

Quoted 10 lines
package/frr/Config.in new file +10 -0
+	help
+	  The FRRouting Protocol Suite.
+
+	  FRR is free software that implements and manages various IPv4 and
+	  IPv6 routing protocols.
+
+	  https://frrouting.org
+
+comment "frr requires BASH for init service"
+	depends on !BR2_PACKAGE_BASH

So it's the frrinit.sh script that requires bash ?

Yes, this is runtime dependency.

Quoted 20 lines

This comment also need a BR2_USE_MMU dependency, so that it doesn't show up on noMMU systems.

Quoted 16 lines
package/frr/S50frr new file +10 -0
new file mode 100644
index 0000000000..dec7d82a88
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# Starts frr.
+#
+
+start() {
+	printf "Starting frr: "
+	start-stop-daemon -S -q -b \
+		--exec /usr/sbin/frrinit.sh -- start
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
Quoted 8 lines

package/frr/S50frr line 15

Quoted 5 lines
package/frr/S50frr new file +5 -0
+}
+stop() {
+	printf "Stopping frr: "
+	/usr/sbin/frrinit.sh stop
+	start-stop-daemon -K -q -p /run/frr.pid

This looks odd. Why do you need to call frrinit.sh stop and then use start-stop-daemon ?

Sorry, I thought to call 'frrinit.sh stop' to first stop all the daemons executed by 'frrinit.sh start' and then stop the main daemon process.

Quoted 3 lines

Also, make sure to use package/busybox/S01sysklogd as a template for your init scripts.

OK

Quoted 37 lines
Quoted 12 lines
package/frr/frr.mk new file +4 -0
new file mode 100644
index 0000000000..c53e9bb4b0
@@ -0,0 +1,105 @@
+################################################################################
+#
+# frr
+#

package/frr/frr.mk line 14

Quoted 10 lines
package/frr/frr.mk new file +10 -0
+################################################################################
+
+FRR_VERSION = 7.3
+FRR_SOURCE = frr-$(FRR_VERSION).tar.gz
+FRR_SITE = https://github.com/FRRouting/frr/archive
+FRR_LICENSE = GPL-2.0
+FRR_LICENSE_FILES = COPYING
+
+FRR_DEPENDENCIES = rtrlib readline json-c libyang libcap libnl \
+		   ncurses host-frr c-ares

Only one tab to indent the second line.

Quoted 12 lines
package/frr/frr.mk new file +12 -0
+
+HOST_FRR_DEPENDENCIES = host-flex host-bison host-python
+
+FRR_CONF_OPTS = --with-clippy=$(HOST_DIR)/bin/clippy \
+		--sysconfdir=/etc/frr \
+		--localstatedir=/var/run/frr \
+		--with-moduledir=/usr/lib/frr/modules \
+		--enable-configfile-mask=0640 \
+		--enable-logfile-mask=0640 \
+		--enable-multipath=256 \
+		--disable-ospfclient \
+		--enable-shell-access \
Quoted 8 lines

package/frr/frr.mk line 32

Quoted 6 lines
package/frr/frr.mk new file +6 -0
+		--enable-user=frr \
+		--enable-group=frr \
+		--enable-vty-group=frrvty \
+		--disable-exampledir \
+		--enable-rpki \
+		--enable-fpm

Ditto, only one tab to indent the continuation lines.

OK

Quoted 15 lines

package/frr/frr.mk line 40

Quoted 9 lines
package/frr/frr.mk new file +8 -0
+
+HOST_FRR_CONF_OPTS = --enable-clippy-only
+
+define FRR_RUN_BOOTSTRAP
+	(cd $(@D) && PATH=$(BR_PATH) ./bootstrap.sh)
+endef
+FRR_PRE_CONFIGURE_HOOKS += FRR_RUN_BOOTSTRAP
+HOST_FRR_PRE_CONFIGURE_HOOKS += FRR_RUN_BOOTSTRAP

This won't work as you don't have any guarantee that host-autoconf and host-automake will be built before. Can you use FRR_AUTORECONF = YES, as this is really the best solution ? If not, you need to keep your hooks, but explicitly add host-autoconf and host-automake to the package dependencies.

Thanks, will check.

Quoted 9 lines

package/frr/frr.mk line 47

Quoted 7 lines
package/frr/frr.mk new file +6 -0
+define HOST_FRR_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/lib/clippy $(HOST_DIR)/bin/clippy
+endef
+
+
+# for some reason the normal 'install' target fails

Why? Can it be fixed? At least reported to the upstream developers?

Ohhh, so, there is some miss-behave in case of cross-compilation that:
1) for some frr daemon installation uses -L/usr/lib

2) install tries to install binaries (apps & libs) to $(TARGET)/$(O) path which is invalid.

So, I just gave up and tried to do a bit manual way. Would be great if can suggest some generic hint with $(TARGET)$(O) issue.

Quoted 8 lines

package/frr/frr.mk line 52

Quoted 6 lines
package/frr/frr.mk new file +5 -0
+FRR_INSTALL_TARGET_OPTS = DESTDIR="$(TARGET_DIR)" libdir="/usr/lib" \
+			  install-binPROGRAMS \
+			  install-sbinPROGRAMS \
+			  install-sbinSCRIPTS \
+			  installdirs

Only one tab to indent the continuation lines.

OK

Quoted 6 lines

package/frr/frr.mk line 55

Quoted 4 lines
package/frr/frr.mk new file +3 -0
+
+define FRR_INSTALL_CONFIG_FILES
+	(cd $(@D) && PATH=$(BR_PATH) ./bootstrap.sh)

Calling bootstrap.sh during the installation? Why?

OK, might be some copy&paste issue.

Quoted 8 lines

package/frr/frr.mk line 57

Quoted 3 lines
package/frr/frr.mk new file +2 -0
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/var/log/frr
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/var/run/frr

I'm not sure this is going to work well, as /var/log and /var/run are symlinks to /tmp by default, and a tmpfs is mounted to /tmp.

These directories need to be created at runtime.

So in case of systemd it can be handled by tmpfs file, but in case of sysv is it OK to do it in init script ?

Quoted 14 lines

package/frr/frr.mk line 59

Quoted 2 lines
package/frr/frr.mk new file +1 -0
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/frr

Not needed, as the -D option to the $(INSTALL) commands above will create this folder.

package/frr/frr.mk line 64

Quoted 5 lines
package/frr/frr.mk new file +5 -0
+	$(INSTALL) -D -m 0644 $(@D)/tools/etc/frr/daemons $(TARGET_DIR)/etc/frr/daemons
+	$(INSTALL) -D -m 0644 $(@D)/tools/etc/frr/daemons.conf $(TARGET_DIR)/etc/frr/daemons.conf
+	$(INSTALL) -D -m 0644 $(@D)/tools/etc/frr/frr.conf $(TARGET_DIR)/etc/frr/frr.conf
+	$(INSTALL) -D -m 0644 $(@D)/tools/etc/frr/vtysh.conf $(TARGET_DIR)/etc/frr/vtysh.conf
+	$(INSTALL) -D -m 0644 $(@D)/tools/etc/frr/support_bundle_commands.conf $(TARGET_DIR)/etc/frr/support_bundle_commands.conf

This probably calls for a for loop:

Quoted 4 lines
	$(foreach f,daemons daemons.conf frr.conf vtysh.conf support_bundle_commands.conf,\
		$(INSTALL) -D -m 0644 $(@D)/tools/etc/frr/$(f) \
			$(TARGET_DIR)/etc/frr/$(f)
	)

Thanks, will use it.

Quoted 15 lines

package/frr/frr.mk line 75

Quoted 11 lines
package/frr/frr.mk new file +10 -0
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/zebra.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/bgpd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/ospfd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/ospf6d.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/isisd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/ripd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/ripngd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/pimd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/ldpd.conf
+	$(INSTALL) -m 0644 /dev/null $(TARGET_DIR)/etc/frr/nhrpd.conf

Installing /dev/null ? Here is just creates an empty regular file. Does it really makes sense? What are you trying to do here ?

Will check if these files are needed, I followed of build instructions for several distros on frr docs site.

Quoted 44 lines

package/frr/frr.mk line 81

Quoted 6 lines
package/frr/frr.mk new file +6 -0
+endef
+FRR_POST_INSTALL_TARGET_HOOKS += FRR_INSTALL_CONFIG_FILES
+
+define FRR_PERMISSIONS
+	/var/log/frr d 755 frr frr - - - - -
+	/var/run/frr d 755 frr frr - - - - -

This is not going to work, as explained above.

package/frr/frr.mk line 91

Quoted 10 lines
package/frr/frr.mk new file +10 -0
+	/etc/frr/zebra.conf f 644 frr frr - - - - -
+	/etc/frr/bgpd.conf f 644 frr frr - - - - -
+	/etc/frr/ospfd.conf f 644 frr frr - - - - -
+	/etc/frr/ospf6d.conf f 644 frr frr - - - - -
+	/etc/frr/isisd.conf f 644 frr frr - - - - -
+	/etc/frr/ripd.conf f 644 frr frr - - - - -
+	/etc/frr/ripngd.conf f 644 frr frr - - - - -
+	/etc/frr/pimd.conf f 644 frr frr - - - - -
+	/etc/frr/ldpd.conf f 644 frr frr - - - - -
+	/etc/frr/nhrpd.conf f 644 frr frr - - - - -

So all these empty files need to be writable ?

Quoted 4 lines
package/frr/frr.mk new file +4 -0
+	/etc/frr/vtysh.conf f 644 frr frrvty - - - - -
+endef
+
+define FRR_USERS

package/frr/frr.mk line 105

Quoted 10 lines
package/frr/frr.mk new file +10 -0
+	frr -1 frr -1 * /var/run/frr - frrvty FRR user priv
+endef
+
+define FRR_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 755 $(FRR_PKGDIR)/S50frr \
+		$(TARGET_DIR)/etc/init.d/S50frr
+endef
+
+$(eval $(autotools-package))
+$(eval $(host-autotools-package))

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#10 lore raw

PATCH 3/3 package/frr: new package

Quoted 23 lines · On Mon, 24 Feb 2020 23:14:27 +0200 vadim4j at gmail.com wrote:
Quoted 15 lines
Quoted 15 lines
package/frr/Config.in new file +9 -0
new file mode 100644
index 0000000000..01673eb837
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_FRR
+	bool "frr"
+	depends on BR2_USE_MMU # fork()
+	depends on BR2_PACKAGE_BASH # init
+	select BR2_PACKAGE_RTRLIB
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_JSON_C
+	select BR2_PACKAGE_LIBYANG
+	select BR2_PACKAGE_LIBCAP
Quoted 8 lines

package/frr/Config.in line 13

Quoted 4 lines
package/frr/Config.in new file +4 -0
+	select BR2_PACKAGE_LIBNL
+	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_NETSNMP
+	select BR2_PACKAGE_C_ARES  

That's a lot of packages that you select here, are you sure you properly propagated the "depends on" of all those packages in this Config.in ?

Quoted 1 line

will try to check by disabling one by one.

Huh? That's not what I'm asking here. I'm just asking that you look at the definition of each of those options, and if any of them has some "depends on" dependency, you need to replicate them into the frr package Config.in file.

Of course, you have to ensure that all these packages are really useful for you.

BTW: the list should be sorted alphabetically.

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
package/frr/Config.in new file +4 -0
+	help
+	  The FRRouting Protocol Suite.
+
+	  FRR is free software that implements and manages various IPv4 and
Quoted 8 lines

package/frr/Config.in line 23

Quoted 6 lines
package/frr/Config.in new file +6 -0
+	  IPv6 routing protocols.
+
+	  https://frrouting.org
+
+comment "frr requires BASH for init service"
+	depends on !BR2_PACKAGE_BASH  

So it's the frrinit.sh script that requires bash ?

Quoted 1 line

Yes, this is runtime dependency.

And using this script is important?

Quoted 11 lines
Quoted 3 lines
Quoted 1 line

+# for some reason the normal 'install' target fails

Why? Can it be fixed? At least reported to the upstream developers?

Ohhh, so, there is some miss-behave in case of cross-compilation that:
1) for some frr daemon installation uses -L/usr/lib

2) install tries to install binaries (apps & libs) to $(TARGET)/$(O) path which is invalid.

So, I just gave up and tried to do a bit manual way. Would be great if can suggest some generic hint with $(TARGET)$(O) issue.

Would need to reproduce the issue and investigate to provide some hints, I'm not sure I'll have the time soon. Maybe someone else can help here, and provide some suggestions ?

Quoted 9 lines
Quoted 7 lines

package/frr/Config.in

Quoted 2 lines
package/frr/Config.in new file +2 -0
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/var/log/frr
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/var/run/frr  

I'm not sure this is going to work well, as /var/log and /var/run are symlinks to /tmp by default, and a tmpfs is mounted to /tmp.

These directories need to be created at runtime.

So in case of systemd it can be handled by tmpfs file, but in case of sysv is it OK to do it in init script ?

Yes, it is OK.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#11 lore raw

PATCH 3/3 package/frr: new package

Quoted 26 lines · Thomas Petazzoni
Quoted 23 lines · On Mon, 24 Feb 2020 23:14:27 +0200 vadim4j at gmail.com wrote:
Quoted 23 lines
Quoted 9 lines
package/frr/Config.in new file +3 -0
new file mode 100644
index 0000000000..01673eb837
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_FRR
+	bool "frr"
+	depends on BR2_USE_MMU # fork()

package/frr/Config.in line 13

Quoted 10 lines
package/frr/Config.in new file +10 -0
+	depends on BR2_PACKAGE_BASH # init
+	select BR2_PACKAGE_RTRLIB
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_JSON_C
+	select BR2_PACKAGE_LIBYANG
+	select BR2_PACKAGE_LIBCAP
+	select BR2_PACKAGE_LIBNL
+	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_NETSNMP
+	select BR2_PACKAGE_C_ARES  

That's a lot of packages that you select here, are you sure you properly propagated the "depends on" of all those packages in this Config.in ?

Quoted 6 lines
Quoted 1 line

will try to check by disabling one by one.

Huh? That's not what I'm asking here. I'm just asking that you look at the definition of each of those options, and if any of them has some "depends on" dependency, you need to replicate them into the frr package Config.in file.

Hmmm, you mean to add here "depends on" from selected packages ?

Quoted 18 lines

Of course, you have to ensure that all these packages are really useful for you.

BTW: the list should be sorted alphabetically.

Quoted 12 lines
Quoted 12 lines

package/frr/Config.in line 23

Quoted 10 lines
package/frr/Config.in new file +10 -0
+	help
+	  The FRRouting Protocol Suite.
+
+	  FRR is free software that implements and manages various IPv4 and
+	  IPv6 routing protocols.
+
+	  https://frrouting.org
+
+comment "frr requires BASH for init service"
+	depends on !BR2_PACKAGE_BASH  

So it's the frrinit.sh script that requires bash ?

Quoted 3 lines
Quoted 1 line

Yes, this is runtime dependency.

And using this script is important?

Well, it runs daemons on system init to handle routing protocols.

Quoted 38 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

+# for some reason the normal 'install' target fails

Why? Can it be fixed? At least reported to the upstream developers?

Quoted 8 lines

Ohhh, so, there is some miss-behave in case of cross-compilation that:
1) for some frr daemon installation uses -L/usr/lib

2) install tries to install binaries (apps & libs) to $(TARGET)/$(O) path which is invalid.

So, I just gave up and tried to do a bit manual way. Would be great if can suggest some generic hint with $(TARGET)$(O) issue.

Would need to reproduce the issue and investigate to provide some hints, I'm not sure I'll have the time soon. Maybe someone else can help here, and provide some suggestions ?

Quoted 9 lines
Quoted 7 lines

package/frr/Config.in

Quoted 2 lines
package/frr/Config.in new file +2 -0
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/var/log/frr
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/var/run/frr  

I'm not sure this is going to work well, as /var/log and /var/run are symlinks to /tmp by default, and a tmpfs is mounted to /tmp.

These directories need to be created at runtime.

So in case of systemd it can be handled by tmpfs file, but in case of sysv is it OK to do it in init script ?

Yes, it is OK.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#12 lore raw

PATCH 3/3 package/frr: new package

Quoted 5 lines · On Mon, 24 Feb 2020 23:36:54 +0200 vadim4j at gmail.com wrote:
Quoted 4 lines

Huh? That's not what I'm asking here. I'm just asking that you look at the definition of each of those options, and if any of them has some "depends on" dependency, you need to replicate them into the frr package Config.in file.

Hmmm, you mean to add here "depends on" from selected packages ?

Yes, like we do in all other Buildroot packages.

See also section "17.2.3. Choosing depends on or select" in
https://buildroot.org/downloads/manual/manual.html.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

So it's the frrinit.sh script that requires bash ?

Yes, this is runtime dependency.

And using this script is important?

Well, it runs daemons on system init to handle routing protocols.

OK, but is it complicated? Can it be replaced by some simpler Buildroot-compliant init script?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#13 lore raw

PATCH 3/3 package/frr: new package

Quoted 15 lines · Thomas Petazzoni
Quoted 5 lines · On Mon, 24 Feb 2020 23:36:54 +0200 vadim4j at gmail.com wrote:
Quoted 4 lines

Huh? That's not what I'm asking here. I'm just asking that you look at the definition of each of those options, and if any of them has some "depends on" dependency, you need to replicate them into the frr package Config.in file.

Hmmm, you mean to add here "depends on" from selected packages ?

Yes, like we do in all other Buildroot packages.

See also section "17.2.3. Choosing depends on or select" in
https://buildroot.org/downloads/manual/manual.html.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

So it's the frrinit.sh script that requires bash ?

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Yes, this is runtime dependency.

And using this script is important?

Well, it runs daemons on system init to handle routing protocols.

OK, but is it complicated? Can it be replaced by some simpler Buildroot-compliant init script?

So, I looked closer and actually frr init script does not need start-stop-daemon tool, it is enough to just call /usr/sbin/frrinit.sh {start|stop}. So I can pick S01syslogd as template but w/o using start-stop-daemon and directly call frrinit.sh, because frr handles starting/stopping of its daemons by itself.