From 155399a8c3f51b67caa0e9f733802904463079af Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 18 May 2024 19:49:27 +0200 Subject: [PATCH] package created using the webbuild interface [release 10.0-1mamba;Thu May 16 2024] --- README.md | 3 + frr-10.0-libyang-2.2.8.patch | 206 ++++++++++++++++++++++++++++++ frr-sysusers.conf | 4 + frr-tmpfiles.conf | 1 + frr.spec | 236 +++++++++++++++++++++++++++++++++++ 5 files changed, 450 insertions(+) create mode 100644 frr-10.0-libyang-2.2.8.patch create mode 100644 frr-sysusers.conf create mode 100644 frr-tmpfiles.conf create mode 100644 frr.spec diff --git a/README.md b/README.md index ae717ed..0e2ac46 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # frr +Routing protocol suite supporting BGP4, OSPFv2, OSPFv3, ISIS, RIP, RIPng, PIM, LDP, BFD, VRRP, NHRP and EIGRP. +Forks and obsoletes Quagga. + diff --git a/frr-10.0-libyang-2.2.8.patch b/frr-10.0-libyang-2.2.8.patch new file mode 100644 index 0000000..5da0b94 --- /dev/null +++ b/frr-10.0-libyang-2.2.8.patch @@ -0,0 +1,206 @@ +diff -ru frr-10.0.orig/lib/vty.c frr-10.0/lib/vty.c +--- frr-10.0.orig/lib/vty.c 2024-05-16 12:29:42.000000000 +0200 ++++ frr-10.0/lib/vty.c 2024-05-16 13:22:41.208287747 +0200 +@@ -39,6 +39,7 @@ + #include "libfrr.h" + #include "frrstr.h" + #include "lib_errors.h" ++#include + #include "northbound_cli.h" + #include "printfrr.h" + #include "json.h" +@@ -3668,15 +3669,24 @@ + } + + static void vty_out_yang_error(struct vty *vty, LYD_FORMAT format, +- struct ly_err_item *ei) ++ const struct ly_err_item *ei) + { ++#if (LY_VERSION_MAJOR < 3) ++#define data_path path ++#else ++#define data_path data_path ++#endif + bool have_apptag = ei->apptag && ei->apptag[0] != 0; +- bool have_path = ei->path && ei->path[0] != 0; ++ bool have_path = ei->data_path && ei->data_path[0] != 0; + bool have_msg = ei->msg && ei->msg[0] != 0; + const char *severity = NULL; + const char *evalid = NULL; + const char *ecode = NULL; ++#if (LY_VERSION_MAJOR < 3) + LY_ERR err = ei->no; ++#else ++ LY_ERR err = ei->err; ++#endif + + if (ei->level == LY_LLERR) + severity = "error"; +@@ -3701,7 +3711,8 @@ + vty_out(vty, "%s\n", + evalid); + if (have_path) +- vty_out(vty, "%s\n", ei->path); ++ vty_out(vty, "%s\n", ++ ei->data_path); + if (have_apptag) + vty_out(vty, "%s\n", + ei->apptag); +@@ -3720,7 +3731,7 @@ + if (evalid) + vty_out(vty, ", \"error-validation\": \"%s\"", evalid); + if (have_path) +- vty_out(vty, ", \"error-path\": \"%s\"", ei->path); ++ vty_out(vty, ", \"error-path\": \"%s\"", ei->data_path); + if (have_apptag) + vty_out(vty, ", \"error-app-tag\": \"%s\"", ei->apptag); + if (have_msg) +@@ -3737,18 +3748,19 @@ + if (evalid) + vty_out(vty, " invalid: %s", evalid); + if (have_path) +- vty_out(vty, " path: %s", ei->path); ++ vty_out(vty, " path: %s", ei->data_path); + if (have_apptag) + vty_out(vty, " app-tag: %s", ei->apptag); + if (have_msg) + vty_out(vty, " msg: %s", ei->msg); + break; + } ++#undef data_path + } + + static uint vty_out_yang_errors(struct vty *vty, LYD_FORMAT format) + { +- struct ly_err_item *ei = ly_err_first(ly_native_ctx); ++ const struct ly_err_item *ei = ly_err_first(ly_native_ctx); + uint count; + + if (!ei) +diff -ru frr-10.0.orig/lib/yang.c frr-10.0/lib/yang.c +--- frr-10.0.orig/lib/yang.c 2024-05-16 12:29:42.000000000 +0200 ++++ frr-10.0/lib/yang.c 2024-05-16 13:22:41.209287749 +0200 +@@ -11,6 +11,7 @@ + #include "lib_errors.h" + #include "yang.h" + #include "yang_translator.h" ++#include + #include "northbound.h" + + #include "lib/config_paths.h" +@@ -18,6 +19,17 @@ + DEFINE_MTYPE_STATIC(LIB, YANG_MODULE, "YANG module"); + DEFINE_MTYPE_STATIC(LIB, YANG_DATA, "YANG data structure"); + ++/* Safe to remove after libyang 2.2.8 */ ++#if (LY_VERSION_MAJOR < 3) ++#define yang_lyd_find_xpath3(ctx_node, tree, xpath, format, prefix_data, vars, \ ++ set) \ ++ lyd_find_xpath3(ctx_node, tree, xpath, vars, set) ++#else ++#define yang_lyd_find_xpath3(ctx_node, tree, xpath, format, prefix_data, vars, \ ++ set) \ ++ lyd_find_xpath3(ctx_node, tree, xpath, LY_VALUE_JSON, NULL, vars, set) ++#endif ++ + /* libyang container. */ + struct ly_ctx *ly_native_ctx; + +@@ -691,7 +703,12 @@ + } + + /* Make libyang log its errors using FRR logging infrastructure. */ +-static void ly_log_cb(LY_LOG_LEVEL level, const char *msg, const char *path) ++static void ly_zlog_cb(LY_LOG_LEVEL level, const char *msg, const char *data_path ++#if !(LY_VERSION_MAJOR < 3) ++ , ++ const char *schema_path, uint64_t line ++#endif ++) + { + int priority = LOG_ERR; + +@@ -708,8 +725,14 @@ + break; + } + +- if (path) +- zlog(priority, "libyang: %s (%s)", msg, path); ++ if (data_path) ++ zlog(priority, "libyang: %s (%s)", msg, data_path); ++#if !(LY_VERSION_MAJOR < 3) ++ else if (schema_path) ++ zlog(priority, "libyang %s (%s)\n", msg, schema_path); ++ else if (line) ++ zlog(priority, "libyang %s (line %" PRIu64 ")\n", msg, line); ++#endif + else + zlog(priority, "libyang: %s", msg); + } +@@ -736,7 +759,8 @@ + return err; + } + +- err = lyd_find_xpath3(NULL, tree, xpath, NULL, &set); ++ err = yang_lyd_find_xpath3(NULL, tree, xpath, LY_VALUE_JSON, NULL, NULL, ++ &set); + if (err) { + zlog_err("Failed to parse notification: %s", ly_last_errmsg()); + lyd_free_all(tree); +@@ -829,23 +853,29 @@ + + const char *yang_print_errors(struct ly_ctx *ly_ctx, char *buf, size_t buf_len) + { +- struct ly_err_item *ei; ++ const struct ly_err_item *ei; + + ei = ly_err_first(ly_ctx); + if (!ei) + return ""; + + strlcpy(buf, "YANG error(s):\n", buf_len); ++#if (LY_VERSION_MAJOR < 3) ++#define data_path path ++#else ++#define data_path data_path ++#endif + for (; ei; ei = ei->next) { +- if (ei->path) { ++ if (ei->data_path) { + strlcat(buf, " Path: ", buf_len); +- strlcat(buf, ei->path, buf_len); ++ strlcat(buf, ei->data_path, buf_len); + strlcat(buf, "\n", buf_len); + } + strlcat(buf, " Error: ", buf_len); + strlcat(buf, ei->msg, buf_len); + strlcat(buf, "\n", buf_len); + } ++#undef data_path + + ly_err_clean(ly_ctx, NULL); + +@@ -897,7 +927,12 @@ + void yang_init(bool embedded_modules, bool defer_compile) + { + /* Initialize libyang global parameters that affect all containers. */ +- ly_set_log_clb(ly_log_cb, 1); ++ ly_set_log_clb(ly_zlog_cb ++#if (LY_VERSION_MAJOR < 3) ++ , ++ 1 ++#endif ++ ); + ly_log_options(LY_LOLOG | LY_LOSTORE); + + /* Initialize libyang container for native models. */ +@@ -1209,7 +1244,8 @@ + + *root = lyd_first_sibling(*root); + +- err = lyd_find_xpath3(NULL, *root, xpath, NULL, &set); ++ err = yang_lyd_find_xpath3(NULL, *root, xpath, LY_VALUE_JSON, NULL, ++ NULL, &set); + if (err) { + flog_err_sys(EC_LIB_LIBYANG, + "cannot obtain specific result for xpath \"%s\": %s", diff --git a/frr-sysusers.conf b/frr-sysusers.conf new file mode 100644 index 0000000..2050589 --- /dev/null +++ b/frr-sysusers.conf @@ -0,0 +1,4 @@ +#Type Name ID GECOS Home directory Shell +g frrvty - +u frr - "FRRouting routing suite" /run/frr /sbin/nologin +m frr frrvty diff --git a/frr-tmpfiles.conf b/frr-tmpfiles.conf new file mode 100644 index 0000000..c1613b2 --- /dev/null +++ b/frr-tmpfiles.conf @@ -0,0 +1 @@ +d /run/frr 0755 frr frr - diff --git a/frr.spec b/frr.spec new file mode 100644 index 0000000..dfac469 --- /dev/null +++ b/frr.spec @@ -0,0 +1,236 @@ +Name: frr +Version: 10.0 +Release: 1mamba +Summary: Routing protocol suite supporting BGP4, OSPFv2, OSPFv3, ISIS, RIP, RIPng, PIM, LDP, BFD, VRRP, NHRP and EIGRP +Group: Applications/Networking +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: https://frrouting.org/ +Source: https://github.com/FRRouting/frr.git/frr-%{version}/frr-%{version}.tar.bz2 +Source1: frr-sysusers.conf +Source2: frr-tmpfiles.conf +Patch0: frr-10.0-libyang-2.2.8.patch +License: GPL-2.0 +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libcap-devel +BuildRequires: libcares-devel +BuildRequires: libjson-c-devel +BuildRequires: libnetsnmp-devel +BuildRequires: libnl-devel +BuildRequires: libpam-devel +BuildRequires: libpcre-devel +BuildRequires: libpcre2-devel +BuildRequires: libprotobuf-c-devel +BuildRequires: libreadline-devel +BuildRequires: librpm-devel +BuildRequires: librtr-devel +BuildRequires: libunwind-devel +BuildRequires: libxcrypt-devel +BuildRequires: libyang-devel +BuildRequires: libzeromq-devel +## AUTOBUILDREQ-END +Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} +Requires(post): %{__install_info} +Requires(preun): %{__install_info} +Obsoletes: quagga <= 1.2.4-3mamba +Obsoletes: quagga-ipv6 <= 1.2.4-3mamba + +%description +Routing protocol suite supporting BGP4, OSPFv2, OSPFv3, ISIS, RIP, RIPng, PIM, LDP, BFD, VRRP, NHRP and EIGRP. +Forks and obsoletes Quagga. + +%package -n lib%{name} +Group: System/Libraries +Summary: Shared libraries for %{name} + +%description -n lib%{name} +This package contains shared libraries for %{name}. + +%package -n lib%{name}-devel +Group: Development/Libraries +Summary: Development files for %{name} +Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} +Obsoletes: quagga-devel <= 1.2.4-3mamba + +%description -n lib%{name}-devel +This package contains libraries and header files for developing applications that use %{name}. + +%debug_package + +%prep +%setup -q +#-D -T +#:<< _EOF +# Fix some paths +sed -ri 's|/var/run/frr|/run/frr|g' redhat/frr.logrotate +sed -ri 's|/usr/lib/frr|/usr/bin|g' tools/frr-reload +%patch 0 -p1 -b .libyang-2.2.8 + +autoreconf -f -i + +%build +#:<< _EOF +%configure \ + --sbindir=%{_bindir} \ + --with-libpam \ + --enable-snmp="agentx" \ + --enable-multipath=256 \ + --enable-user="frr" \ + --enable-group="frr" \ + --enable-vty-group="frrvty" \ + --enable-configfile-mask="0640" \ + --enable-logfile-mask="0640" \ + --enable-pcre2posix \ + --enable-shell-access \ + --enable-rpki \ + --enable-fpm + +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall + +install -D -m0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/frr.conf +install -D -m0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/frr.conf + +install -D -m0644 redhat/frr.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/frr +install -D -m0644 redhat/frr.pam %{buildroot}%{_sysconfdir}/pam.d/frr + +install -D -m0644 tools/frr.service %{buildroot}%{_unitdir}/frr.service + +install -D -m0644 tools/etc/frr/daemons -t %{buildroot}%{_sysconfdir}/frr +install -D -m0644 tools/etc/iproute2/rt_protos.d/frr.conf -t %{buildroot}%{_sysconfdir}/iproute2/rt_protos.d +install -D -m0644 tools/etc/frr/frr.conf -t %{buildroot}%{_sysconfdir}/frr +install -D -m0644 tools/etc/frr/vtysh.conf -t %{buildroot}%{_sysconfdir}/frr + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%pre +%sysusers_create_compat %{SOURCE1} + +%post +%systemd_post frr +%install_info %{name}.info +: + +%preun +%uninstall_info %{name}.info +%systemd_preun frr +: + +%postun +%systemd_postun_with_restart frr +: + +%post -n lib%{name} -p /sbin/ldconfig +%postun -n lib%{name} -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%dir %attr(750,frr,frr) %{_sysconfdir}/frr +%config(noreplace) %attr(644,frr,frr) %{_sysconfdir}/frr/frr.conf +%config(noreplace) %attr(644,frr,frr) %{_sysconfdir}/frr/vtysh.conf +%config(noreplace) %attr(644,frr,frr) %{_sysconfdir}/frr/daemons +%config(noreplace) %attr(644,root,root) %{_sysconfdir}/logrotate.d/frr +%config(noreplace) %attr(644,frr,frr) %{_sysconfdir}/iproute2/rt_protos.d/frr.conf +%config(noreplace) %{_pam_confdir}/frr +%{_bindir}/babeld +%{_bindir}/bfdd +%{_bindir}/bgpd +%{_bindir}/eigrpd +%{_bindir}/fabricd +%{_bindir}/frr +%{_bindir}/frr-reload +%{_bindir}/frr-reload.py +%{_bindir}/frr_babeltrace.py +%{_bindir}/frrcommon.sh +%{_bindir}/frrinit.sh +%{_bindir}/generate_support_bundle.py +%{_bindir}/isisd +%{_bindir}/ldpd +%{_bindir}/mgmtd +%{_bindir}/nhrpd +%{_bindir}/ospf6d +%{_bindir}/ospfclient.py +%{_bindir}/ospfd +%{_bindir}/pathd +%{_bindir}/pbrd +%{_bindir}/pim6d +%{_bindir}/pimd +%{_bindir}/ripd +%{_bindir}/ripngd +%{_bindir}/ssd +%{_bindir}/staticd +%{_bindir}/vrrpd +%{_bindir}/watchfrr +%{_bindir}/watchfrr.sh +%{_bindir}/zebra +%{_tmpfilesdir}/frr.conf +%{_sysusersdir}/frr.conf +%{_unitdir}/frr.service +%{_infodir}/frr.info* +%{_mandir}/man1/frr.1* +%{_mandir}/man1/vtysh.1* +%{_mandir}/man8/frr-*.8* +%{_mandir}/man8/mtracebis.8* +%dir %{_datadir}/yang +%{_datadir}/yang/frr-*.yang +%{_datadir}/yang/ietf-*.yang + +%files -n lib%{name} +%defattr(-,root,root) +%{_libdir}/libfrr.so.* +%{_libdir}/libfrr_pb.so.* +%{_libdir}/libfrrcares.so.* +%{_libdir}/libfrrfpm_pb.so.* +%{_libdir}/libfrrospfapiclient.so.* +%{_libdir}/libfrrsnmp.so.* +%{_libdir}/libfrrzmq.so.* +%{_libdir}/libmgmt_be_nb.so.* +%dir %{_libdir}/frr/modules +%{_libdir}/frr/modules/bgpd_bmp.so +%{_libdir}/frr/modules/bgpd_rpki.so +%{_libdir}/frr/modules/bgpd_snmp.so +%{_libdir}/frr/modules/dplane_fpm_nl.so +%{_libdir}/frr/modules/isisd_snmp.so +%{_libdir}/frr/modules/ldpd_snmp.so +%{_libdir}/frr/modules/ospf6d_snmp.so +%{_libdir}/frr/modules/ospfd_snmp.so +%{_libdir}/frr/modules/pathd_pcep.so +%{_libdir}/frr/modules/ripd_snmp.so +%{_libdir}/frr/modules/zebra_cumulus_mlag.so +%{_libdir}/frr/modules/zebra_fpm.so +%{_libdir}/frr/modules/zebra_snmp.so +%doc COPYING + +%files -n lib%{name}-devel +%defattr(-,root,root) +%{_bindir}/mtracebis +%{_bindir}/vtysh +%dir %{_includedir}/frr +%{_includedir}/frr/* +%{_libdir}/libfrr.a +%{_libdir}/libfrr.so +%{_libdir}/libfrr_pb.a +%{_libdir}/libfrr_pb.so +%{_libdir}/libfrrcares.a +%{_libdir}/libfrrcares.so +%{_libdir}/libfrrfpm_pb.a +%{_libdir}/libfrrfpm_pb.so +%{_libdir}/libfrrospfapiclient.a +%{_libdir}/libfrrospfapiclient.so +%{_libdir}/libfrrsnmp.a +%{_libdir}/libfrrsnmp.so +%{_libdir}/libfrrzmq.a +%{_libdir}/libfrrzmq.so +%{_libdir}/libmgmt_be_nb.a +%{_libdir}/libmgmt_be_nb.so +%doc README.md + +%changelog +* Thu May 16 2024 Silvan Calarco 10.0-1mamba +- package created using the webbuild interface