Skip to contentSkip to conversation

add frr package

PATCH New Vadim Kochan 2 participants 5 messages Feb 25, 2020 – Aug 26, 2020

lore
Share & tools
lore
#0 lore raw

v3 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 LYD_PRIV option to be enabled in libyang package, so enabled it in separate patch if frr is selected.

Disabled some options for frr package like:

- POSIX capabilities
- RPKi

v3:
1) Remove hook with bootsrap running, autoreconf handles everything

2) Remove _SOURCE var, it is auto-generated

3) Remove --disable-exampledir which causes install config samples into "$(TARGET_DIR)no" folder, but remove them from $(TARGET_DIR)/etc/frr in POST_INSTALL hook.

4) Enable LYD_PRIV option for libyang by default because there is no size difference with or without this option.

v2:
1) fixed TAB indent on multiline var assignment

2) fixed ABC ordering

3) add missing 'depends on' from selected libs by frr

4) directly call /usr/sbin/frrinit.sh S50frr init script w/o start-stop-daemon tool, frr cares of daemons stopping/ running.

5) Removed not-needed empty daemons *.conf files installation, it was taken from building instructions in frr docs, but really it is not required.

6) Use 0644 mask for conf files.

7) Enable LYD_PRIV option for libyang only if frr selected.

8) Drop patch with rtrlib package which is needed only for RPKi support which is disabled by default.

9) Add AUTORECONF for bootstrap invocation.

10) Get rid of manual binaries target invocation. After frr.mk cleanup it starts to work.

11) Install var/log/frr and /var/run/frr at runtime from init.

Vadim Kochan (2):
package/libyang: enable LYD_PRIV option for frr package package/frr: new package

 DEVELOPERS                 |  1 +
 package/Config.in          |  1 +
 package/frr/Config.in      | 25 ++++++++++++++
 package/frr/S50frr         | 46 +++++++++++++++++++++++++
 package/frr/frr.hash       |  2 ++
 package/frr/frr.mk         | 69 ++++++++++++++++++++++++++++++++++++++
 package/libyang/libyang.mk |  3 +-
 7 files changed, 146 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
Signature · 1 line
2.17.1
#1 lore raw

PATCH v3 1/2 package/libyang: enable LYD_PRIV option for frr package

This option is required by frr package, so enable it by default as there is no size difference with or without this option enabled.

---
 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 v3 1/2 package/libyang: enable LYD_PRIV option for frr package

Quoted 7 lines · On Tue, 25 Feb 2020 17:53:21 +0200 Vadim Kochan <[email protected]> wrote:

This option is required by frr package, so enable it by default as there is no size difference with or without this option enabled.

---
 package/libyang/libyang.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied to next, thanks.

Thomas

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

PATCH v3 2/2 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)

Some not-needed features were disabled to minimize package dependencies:

- POSIX capabilities
- RPKi

---
 DEVELOPERS            |  1 +
 package/Config.in     |  1 +
 package/frr/Config.in | 25 ++++++++++++++++
 package/frr/S50frr    | 46 +++++++++++++++++++++++++++++
 package/frr/frr.hash  |  2 ++
 package/frr/frr.mk    | 69 +++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 144 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 7d3d1ca11a..95ea2254de 100644
@@ -2477,6 +2477,7 @@ F:	package/tstools/
 
 N:	Vadim Kochan <[email protected]>
 F:	package/brcm-patchram-plus/
+F:	package/frr/
 F:	package/gettext-tiny/
 F:	package/tinyssh/
 
package/Config.in +1 -0
index dfa3f34b9d..3e6b51a745 100644
@@ -1998,6 +1998,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 +25 -0
new file mode 100644
index 0000000000..c0c3bdd693
@@ -0,0 +1,25 @@
+config BR2_PACKAGE_FRR
+	bool "frr"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_STATIC_LIBS # libyang
+	depends on BR2_USE_MMU # fork()
+	depends on BR2_PACKAGE_BASH # init
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # json-c
+	select BR2_PACKAGE_C_ARES
+	select BR2_PACKAGE_LIBYANG
+	select BR2_PACKAGE_LIBNL
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_JSON_C
+	help
+	  The FRRouting Protocol Suite.
+
+	  FRR is free software that implements and manages various IPv4 and
+	  IPv6 routing protocols.
+
+	  https://frrouting.org
+
+comment "frr needs BASH, threads, dynamic library"
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
+	depends on BR2_USE_MMU
+	depends on !BR2_PACKAGE_BASH || !BR2_TOOLCHAIN_HAS_THREADS || \
+		BR2_STATIC_LIBS
package/frr/S50frr new file +46 -0

46 lines not on this page · raw message

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 +69 -0

69 lines not on this page · raw message

Signature · 1 line
2.17.1
#4 lore raw

PATCH v3 2/2 package/frr: new package

Quoted 23 lines · On Tue, 25 Feb 2020 17:53:22 +0200 Vadim Kochan <[email protected]> wrote:

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)

Quoted 6 lines

Some not-needed features were disabled to minimize package dependencies:

- POSIX capabilities
- RPKi

I've applied to next, with a few changes, see below.

package/frr/Config.in line 6

Quoted 12 lines
package/frr/Config.in new file +6 -0
new file mode 100644
index 0000000000..c0c3bdd693
@@ -0,0 +1,25 @@
+config BR2_PACKAGE_FRR
+	bool "frr"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_STATIC_LIBS # libyang
+	depends on BR2_USE_MMU # fork()
+	depends on BR2_PACKAGE_BASH # init

I've selected bash instead of depending on it.

Quoted 9 lines
package/frr/Config.in new file +9 -0
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # json-c
+	select BR2_PACKAGE_C_ARES
+	select BR2_PACKAGE_LIBYANG
+	select BR2_PACKAGE_LIBNL
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_JSON_C
+	help
+	  The FRRouting Protocol Suite.
+

package/frr/Config.in line 25

Quoted 10 lines
package/frr/Config.in new file +10 -0
+	  FRR is free software that implements and manages various IPv4 and
+	  IPv6 routing protocols.
+
+	  https://frrouting.org
+
+comment "frr needs BASH, threads, dynamic library"
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
+	depends on BR2_USE_MMU
+	depends on !BR2_PACKAGE_BASH || !BR2_TOOLCHAIN_HAS_THREADS || \
+		BR2_STATIC_LIBS

And so I dropped the "bash" part of this comment.

package/frr/Config.in

Quoted 6 lines
package/frr/Config.in new file +6 -0
+start() {
+	install -m 755 -o frr -g frr -d /var/run/frr
+	install -m 755 -o frr -g frr -d /var/log/frr
+
+	printf 'Starting %s: ' "$DAEMON"
+	/usr/sbin/frrinit.sh start

It's not really great to have the Buildroot init script call another sort of init script. But looking into the frrinit.sh and ffrcommon.sh stuff, we can't really re-invent all this in Buildroot, it would be a nightmare to maintain, so we really have to re-use what upstream provides, like you did.

package/frr/frr.mk line 7

Quoted 13 lines
package/frr/frr.mk new file +7 -0
new file mode 100644
index 0000000000..2add98542a
@@ -0,0 +1,69 @@
+################################################################################
+#
+# frr
+#
+################################################################################
+
+FRR_VERSION = 7.3

I've updated to 7.4, as 7.3 didn't build for me with uClibc-ng, due to the use of non-standard TRUE/FALSE. This was fixed in 7.4, which uses the standard true/false definitions.

package/frr/frr.mk line 8

Quoted 1 line
package/frr/frr.mk new file +1 -0
+FRR_SITE = https://github.com/FRRouting/frr/archive

Changed to use the github macro we have.

package/frr/frr.mk line 16

Quoted 4 lines
package/frr/frr.mk new file +4 -0
+FRR_DEPENDENCIES = host-frr readline json-c \
+	libyang libnl c-ares
+
+HOST_FRR_DEPENDENCIES = host-flex host-bison host-python

Changed to use host-python3. We generally try to use host-python3 whenever possible nowadays.

package/frr/frr.mk line 40

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

Not needed, as you're using $(INSTALL) -D below

package/frr/frr.mk line 44

Quoted 4 lines
package/frr/frr.mk new file +4 -0
+
+	$(foreach f,daemons daemons.conf frr.conf vtysh.conf support_bundle_commands.conf,\
+		$(INSTALL) -D -m 0640 $(@D)/tools/etc/frr/$(f) \
+		$(TARGET_DIR)/etc/frr/$(f)

Indented with one more tab the last line.

That's it!

Thomas

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