frr: add missing build options 10545/head
authorLucian Cristian <lucian.cristian@gmail.com>
Thu, 14 Nov 2019 04:43:01 +0000 (06:43 +0200)
committerLucian Cristian <lucian.cristian@gmail.com>
Fri, 15 Nov 2019 19:26:07 +0000 (21:26 +0200)
and some backports in fixing ramips target

Signed-off-by: Lucian Cristian <lucian.cristian@gmail.com>
net/frr/Makefile
net/frr/files/frrcommon.sh
net/frr/patches/006-Revert_usage_of_asm-code.patch [new file with mode: 0644]
net/frr/patches/007-fix_memory_sanitizer_test.patch [new file with mode: 0644]

index d9d2b3115a7537e86de9750e2f9322b14eb9800f..e33ab578740c69f22d86afb3cfe155136730d7ee 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 PKG_NAME:=frr
 PKG_VERSION:=7.2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_URL:=https://github.com/FRRouting/frr/releases/download/$(PKG_NAME)-$(PKG_VERSION)/
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
@@ -177,7 +177,9 @@ define Build/Configure
        --sysconfdir=/etc/frr/ \
        $(if $(CONFIG_FRR_OPENSSL),--with-crypto=openssl,) \
        $(foreach m,$(PKG_DAEMON_AVAILABLE), \
-       $(if $(CONFIG_PACKAGE_frr-$(m)),--enable-$(m),--disable-$(m)) ) \
+       $(call autoconf_bool,CONFIG_PACKAGE_frr-$(m),$(m)) ) \
+       $(call autoconf_bool,CONFIG_PACKAGE_frr-vtysh,vtysh) \
+       $(call autoconf_bool,CONFIG_PACKAGE_frr-libfrr,zebra) \
 )
 endef
 
@@ -214,6 +216,11 @@ define Package/frr-libfrr/install
        $(INSTALL_CONF) ./files/{frr.conf,daemons} $(1)/etc/frr/
 endef
 
+define Package/frr-vtysh/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/vtysh/.libs/vtysh $(1)/usr/bin/
+endef
+
 $(eval $(call HostBuild))
 $(eval $(call BuildPackage,frr))
 $(eval $(call BuildPackage,frr-libfrr))
index c125205aeb9039e562bc5500e3d92622050b363d..d89cd891cabdd673f9122e1e4f6d50f1deb984ef 100644 (file)
@@ -144,7 +144,7 @@ daemon_start() {
        daemon_prep "$daemon" "$inst" || return 1
        if test ! -d "$V_PATH"; then
                mkdir -p "$V_PATH"
-               chown frr "$V_PATH"
+               chown $FRR_USER "$V_PATH"
        fi
 
        eval wrap="\$${daemon}_wrap"
diff --git a/net/frr/patches/006-Revert_usage_of_asm-code.patch b/net/frr/patches/006-Revert_usage_of_asm-code.patch
new file mode 100644 (file)
index 0000000..f62cf86
--- /dev/null
@@ -0,0 +1,71 @@
+From 4d8ebeddc56f49aa0b4d7cec506cab14320e1bb4 Mon Sep 17 00:00:00 2001
+From: Juergen Werner <juergen@opensourcerouting.org>
+Date: Tue, 1 Oct 2019 14:24:20 +0200
+Subject: [PATCH] lib: Revert usage of asm-code in MTYPE definitions
+
+The asm-code was interpreted inconsistently for different platforms.
+In particular for AArch64 this caused UB, if multiple static MTYPEs
+where defined in one file. All static MTYPE_* could point to the same
+memory location (namely the first defined MTYPE) OR to their respective
+(correct) locations depending on the context of their usage.
+
+Signed-off-by: Juergen Werner <juergen@opensourcerouting.org>
+---
+ doc/developer/memtypes.rst |  2 +-
+ lib/memory.h               | 16 ++++------------
+ 2 files changed, 5 insertions(+), 13 deletions(-)
+
+diff --git a/doc/developer/memtypes.rst b/doc/developer/memtypes.rst
+index 13f6b43bbf..1af871963a 100644
+--- a/doc/developer/memtypes.rst
++++ b/doc/developer/memtypes.rst
+@@ -48,7 +48,7 @@ Definition
+    should be used to create these, but in some cases it is useful to pass a
+    ``struct memtype *`` pointer to some helper function.
+-   The ``MTYPE_name`` created by the macros is declared as an array, i.e.
++   The ``MTYPE_name`` created by the macros is declared as a pointer, i.e.
+    a function taking a ``struct memtype *`` argument can be called with an
+    ``MTYPE_name`` argument (as opposed to ``&MTYPE_name``.)
+diff --git a/lib/memory.h b/lib/memory.h
+index 14cd76f2f5..8de5c4c2bf 100644
+--- a/lib/memory.h
++++ b/lib/memory.h
+@@ -101,14 +101,9 @@ struct memgroup {
+               *_mg_##mname.ref = _mg_##mname.next;                           \
+       }
+-
+-/* the array is a trick to make the "MTYPE_FOO" name work as a pointer without
+- * putting a & in front of it, so we can do "XMALLOC(MTYPE_FOO, ...)" instead
+- * of "XMALLOC(&MTYPE_FOO, ...)".
+- */
+ #define DECLARE_MTYPE(name)                                                    \
+       extern struct memtype _mt_##name;                                      \
+-      extern struct memtype MTYPE_##name[1];                                 \
++      extern struct memtype *const MTYPE_##name;                             \
+       /* end */
+ #define DEFINE_MTYPE_ATTR(group, mname, attr, desc)                            \
+@@ -138,17 +133,14 @@ struct memgroup {
+       }                                                                      \
+       /* end */
+-/* can't quite get gcc to emit the alias correctly, so asm-alias it is :/ */
+ #define DEFINE_MTYPE(group, name, desc)                                        \
+       DEFINE_MTYPE_ATTR(group, name, , desc)                                 \
+-      __asm__(".equiv MTYPE_" #name ", _mt_" #name "\n\t"                    \
+-              ".global MTYPE_" #name "\n");                                  \
++      struct memtype *const MTYPE_##name = &_mt_##name;                      \
+       /* end */
+-/* and this one's borked on clang, it drops static on aliases :/, so... asm */
++
+ #define DEFINE_MTYPE_STATIC(group, name, desc)                                 \
+       DEFINE_MTYPE_ATTR(group, name, static, desc)                           \
+-      extern struct memtype MTYPE_##name[1];                                 \
+-      __asm__(".equiv MTYPE_" #name ", _mt_" #name "\n");                    \
++      static struct memtype *const MTYPE_##name = &_mt_##name;               \
+       /* end */
+ DECLARE_MGROUP(LIB)
diff --git a/net/frr/patches/007-fix_memory_sanitizer_test.patch b/net/frr/patches/007-fix_memory_sanitizer_test.patch
new file mode 100644 (file)
index 0000000..05b5f9f
--- /dev/null
@@ -0,0 +1,28 @@
+From 65209e4fbf30d09dda89aa4b1d831461506848d7 Mon Sep 17 00:00:00 2001
+From: Rafael Zalamena <rzalamena@opensourcerouting.org>
+Date: Tue, 8 Oct 2019 20:47:38 -0300
+Subject: [PATCH] configure.ac: fix memory sanitizer test
+
+We should test for `-fsanitize=memory` instead of `-fsanitize=thread`
+when enabling memory sanitizer. While here, fix the error message.
+
+Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
+---
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 88f1c4f627..730e2ae6f0 100755
+--- a/configure.ac
++++ b/configure.ac
+@@ -328,8 +328,8 @@ if test "$enable_thread_sanitizer" = "yes"; then
+   ])
+ fi
+ if test "$enable_memory_sanitizer" = "yes"; then
+-  AC_C_FLAG([-fsanitize=thread -fPIE -pie], [
+-    AC_MSG_ERROR([$CC does not support Thread Sanitizer.])
++  AC_C_FLAG([-fsanitize=memory -fPIE -pie], [
++    AC_MSG_ERROR([$CC does not support Memory Sanitizer.])
+   ], [
+     SAN_FLAGS="-fsanitize=memory -fPIE -pie"
+   ])