pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
FRRouting =========
Module Name: pkgsrc-wip
Committed By: Frank Kardel <kardel%NetBSD.org@localhost>
Pushed By: kardel
Date: Sun Oct 11 13:43:28 2020 +0200
Changeset: 3b6ab739977272fce006bd118612d1042c8caac7
Added Files:
frr/DESCR
frr/MESSAGE
frr/Makefile
frr/PLIST
frr/distinfo
frr/files/staticd.sh
frr/patches/patch-lib_zlog.c
frr/patches/patch-zebra_ioctl.c
Log Message:
FRRouting
=========
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
...
FRRouting is currently actively maintained in contrast to Quagga.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=3b6ab739977272fce006bd118612d1042c8caac7
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
frr/DESCR | 17 ++++
frr/MESSAGE | 7 ++
frr/Makefile | 93 ++++++++++++++++++++
frr/PLIST | 190 ++++++++++++++++++++++++++++++++++++++++
frr/distinfo | 8 ++
frr/files/staticd.sh | 27 ++++++
frr/patches/patch-lib_zlog.c | 22 +++++
frr/patches/patch-zebra_ioctl.c | 116 ++++++++++++++++++++++++
8 files changed, 480 insertions(+)
diffs:
diff --git a/frr/DESCR b/frr/DESCR
new file mode 100644
index 0000000000..a553bdffe7
--- /dev/null
+++ b/frr/DESCR
@@ -0,0 +1,17 @@
+FRRouting
+=========
+
+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
+...
diff --git a/frr/MESSAGE b/frr/MESSAGE
new file mode 100644
index 0000000000..2e9e8bb487
--- /dev/null
+++ b/frr/MESSAGE
@@ -0,0 +1,7 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2020/07/28 06:36:29 kardel Exp $
+
+You can find some example config files in
+${PREFIX}/share/examples/frr
+
+===========================================================================
diff --git a/frr/Makefile b/frr/Makefile
new file mode 100644
index 0000000000..c6c66b8d54
--- /dev/null
+++ b/frr/Makefile
@@ -0,0 +1,93 @@
+# $NetBSD$
+
+GITHUB_PROJECT= frr
+VERSION= 7.4
+GITHUB_TAG= frr-${VERSION}
+DISTNAME= frr-${VERSION}
+CATEGORIES= sysutils
+MASTER_SITES= ${MASTER_SITE_GITHUB:=FRRouting/}
+
+MAINTAINER= kardel%NetBSD.org@localhost
+HOMEPAGE= https://github.com/FRRouting/frr/
+COMMENT= Frr routing multi protocol suite
+LICENSE= gnu-gpl-v2
+
+CONFLICTS= quagga-[0-9]*
+
+WRKSRC= ${WRKDIR}/frr-frr-${VERSION}
+USE_LANGUAGES= c c++
+USE_TOOLS+= gmake perl bash pkg-config autoconf automake autoreconf
+USE_LIBTOOL= YES
+GNU_CONFIGURE= yes
+PKG_SYSCONFSUBDIR= frr
+BUILD_DEFS= VARBASE
+
+FRR_GROUP?= _frr
+FRR_VTY_GROUP?= frrvty
+
+FRR_USER?= _frr
+FRR_CONF_MODE= 0640
+FRR_LOG_MODE= 0640
+PKG_GECOS.${FRR_USER}= FRRouting User
+PKG_HOME.${FRR_USER}= /nonexistent
+PKG_SHELL.${FRR_USER}= /bin/sh
+
+PKG_GROUPS= ${FRR_GROUP} ${FRR_VTY_GROUP}
+PKG_USERS= ${FRR_USER}:${FRR_GROUP}
+
+RCD_SUPPLIED= bgpd ospf6d ospfd ripd ripngd zebra
+RCD_SCRIPTS= ${RCD_SUPPLIED} staticd
+
+.for f in ${RCD_SUPPLIED}
+RCD_SCRIPT_SRC.${f}= ${WRKSRC}/pkgsrc/${f}.sh
+.endfor
+
+CONFIG_TEMPLATE_PATH= share/examples/${PKG_SYSCONFSUBDIR}/configsamples
+
+USE_TOOLS+= bash:run
+REPLACE_BASH= tools/frr.in tools/*.sh.in
+
+REPLACE_PYTHON= tools/generate_support_bundle.py tools/frr-reload.py
+
+SUBST_CLASSES+= workdir
+SUBST_STAGE.workdir= post-configure
+SUBST_MESSAGE.workdir= Fixing absolute workdir references.
+SUBST_FILES.workdir= lib/version.h
+SUBST_SED.workdir= -e "s,${WRKDIR},"'{WRKDIR},g'
+SUBST_VARS.workdir=
+
+CONFIGURE_ARGS?= --sysconfdir=${PREFIX}/etc/${PKG_SYSCONFSUBDIR}
+CONFIGURE_ARGS+= --enable-user=${FRR_USER}
+CONFIGURE_ARGS+= --enable-group=${FRR_GROUP}
+CONFIGURE_ARGS+= --enable-exampledir=${PREFIX}/${CONFIG_TEMPLATE_PATH}
+# CONFIGURE_ARGS+= --enable-pkgsrcrcdir=${PREFIX}/share/examples/rc.d
+CONFIGURE_ARGS+= --localstatedir=${VARBASE}/run/frr
+CONFIGURE_ARGS+= --enable-multipath=64
+CONFIGURE_ARGS+= --enable-vty-group=${FRR_VTY_GROUP}
+CONFIGURE_ARGS+= --enable-configfile-mask=${FRR_CONF_MODE}
+CONFIGURE_ARGS+= --enable-logfile-mask=${FRR_LOG_MODE}
+CONFIGURE_ARGS+= --enable-fpm
+CONFIGURE_ARGS+= --with-pkg-git-version
+CONFIGURE_ARGS+= --with-pkg-extra-version=/${DISTNAME}
+# CONFIGURE_ARGS+= --enable-address-sanitizer
+
+pre-configure:
+ cd ${WRKSRC} && ${SH} bootstrap.sh
+
+.include "../../wip/libyang/buildlink3.mk"
+.include "../../textproc/json-c/buildlink3.mk"
+.include "../../lang/python/application.mk"
+.include "../../mk/readline.buildlink3.mk"
+
+.include "../../mk/bsd.pkg.mk"
+
+# needs to be here to have ${EGREP} defined
+CONFIG_TEMPLATES!= ${EGREP} ${CONFIG_TEMPLATE_PATH:Q} PLIST 2>/dev/null
+CONF_FILES?=
+
+.for l in ${CONFIG_TEMPLATES}
+CONF_FILES_PERMS+= /dev/null ${PKG_SYSCONFDIR}${l:C/^${CONFIG_TEMPLATE_PATH}(.*)\.sample/\1/} \
+ ${FRR_USER} ${FRR_GROUP} ${FRR_CONF_MODE}
+.endfor
+
+# .include "../../mk/bsd.pkg.mk"
diff --git a/frr/PLIST b/frr/PLIST
new file mode 100644
index 0000000000..f4dd2535ba
--- /dev/null
+++ b/frr/PLIST
@@ -0,0 +1,190 @@
+@comment $NetBSD$
+bin/mtracebis
+bin/vtysh
+include/frr/agg_table.h
+include/frr/atomlist.h
+include/frr/bfd.h
+include/frr/bitfield.h
+include/frr/buffer.h
+include/frr/checksum.h
+include/frr/command.h
+include/frr/command_graph.h
+include/frr/command_match.h
+include/frr/compiler.h
+include/frr/csv.h
+include/frr/db.h
+include/frr/debug.h
+include/frr/defaults.h
+include/frr/distribute.h
+include/frr/eigrpd/eigrp_dump.h
+include/frr/eigrpd/eigrp_topology.h
+include/frr/eigrpd/eigrpd.h
+include/frr/ferr.h
+include/frr/filter.h
+include/frr/freebsd-queue.h
+include/frr/frr_pthread.h
+include/frr/frratomic.h
+include/frr/frrcu.h
+include/frr/frrlua.h
+include/frr/frrstr.h
+include/frr/getopt.h
+include/frr/graph.h
+include/frr/hash.h
+include/frr/hook.h
+include/frr/iana_afi.h
+include/frr/id_alloc.h
+include/frr/if.h
+include/frr/if_rmap.h
+include/frr/imsg.h
+include/frr/ipaddr.h
+include/frr/jhash.h
+include/frr/json.h
+include/frr/keychain.h
+include/frr/lib_errors.h
+include/frr/lib_vty.h
+include/frr/libfrr.h
+include/frr/libospf.h
+include/frr/linklist.h
+include/frr/log.h
+include/frr/log_vty.h
+include/frr/md5.h
+include/frr/memory.h
+include/frr/mlag.h
+include/frr/module.h
+include/frr/monotime.h
+include/frr/mpls.h
+include/frr/network.h
+include/frr/nexthop.h
+include/frr/nexthop_group.h
+include/frr/nexthop_group_private.h
+include/frr/northbound.h
+include/frr/northbound_cli.h
+include/frr/northbound_db.h
+include/frr/ns.h
+include/frr/openbsd-queue.h
+include/frr/openbsd-tree.h
+include/frr/ospfapi/ospf_apiclient.h
+include/frr/ospfd/ospf_api.h
+include/frr/ospfd/ospf_asbr.h
+include/frr/ospfd/ospf_dump.h
+include/frr/ospfd/ospf_dump_api.h
+include/frr/ospfd/ospf_ism.h
+include/frr/ospfd/ospf_lsa.h
+include/frr/ospfd/ospf_lsdb.h
+include/frr/ospfd/ospf_nsm.h
+include/frr/ospfd/ospf_opaque.h
+include/frr/ospfd/ospfd.h
+include/frr/pbr.h
+include/frr/plist.h
+include/frr/prefix.h
+include/frr/printfrr.h
+include/frr/privs.h
+include/frr/ptm_lib.h
+include/frr/pullwr.h
+include/frr/pw.h
+include/frr/qobj.h
+include/frr/queue.h
+include/frr/ringbuf.h
+include/frr/route_types.h
+include/frr/routemap.h
+include/frr/sbuf.h
+include/frr/seqlock.h
+include/frr/sha256.h
+include/frr/sigevent.h
+include/frr/skiplist.h
+include/frr/smux.h
+include/frr/sockopt.h
+include/frr/sockunion.h
+include/frr/spf_backoff.h
+include/frr/srcdest_table.h
+include/frr/srv6.h
+include/frr/stream.h
+include/frr/systemd.h
+include/frr/table.h
+include/frr/termtable.h
+include/frr/thread.h
+include/frr/typerb.h
+include/frr/typesafe.h
+include/frr/vector.h
+include/frr/version.h
+include/frr/vlan.h
+include/frr/vrf.h
+include/frr/vrf_int.h
+include/frr/vty.h
+include/frr/vxlan.h
+include/frr/wheel.h
+include/frr/workqueue.h
+include/frr/yang.h
+include/frr/yang_translator.h
+include/frr/yang_wrappers.h
+include/frr/zassert.h
+include/frr/zclient.h
+include/frr/zebra.h
+include/frr/zlog.h
+include/frr/zlog_targets.h
+lib/frr/modules/zebra_fpm.la
+lib/libfrr.la
+lib/libfrrospfapiclient.la
+sbin/babeld
+sbin/bfdd
+sbin/bgpd
+sbin/eigrpd
+sbin/fabricd
+sbin/frr
+sbin/frr-reload
+sbin/frr-reload.py
+sbin/frrcommon.sh
+sbin/frrinit.sh
+sbin/generate_support_bundle.py
+sbin/isisd
+sbin/ldpd
+sbin/ospf6d
+sbin/ospfd
+sbin/pbrd
+sbin/pimd
+sbin/ripd
+sbin/ripngd
+sbin/ssd
+sbin/staticd
+sbin/watchfrr
+sbin/watchfrr.sh
+sbin/zebra
+share/examples/frr/configsamples/babeld.conf.sample
+share/examples/frr/configsamples/bfdd.conf.sample
+share/examples/frr/configsamples/bgpd.conf.sample
+share/examples/frr/configsamples/bgpd.conf.sample2
+share/examples/frr/configsamples/bgpd.conf.vnc.sample
+share/examples/frr/configsamples/eigrpd.conf.sample
+share/examples/frr/configsamples/fabricd.conf.sample
+share/examples/frr/configsamples/isisd.conf.sample
+share/examples/frr/configsamples/ldpd.conf.sample
+share/examples/frr/configsamples/ospf6d.conf.sample
+share/examples/frr/configsamples/ospfd.conf.sample
+share/examples/frr/configsamples/pbrd.conf.sample
+share/examples/frr/configsamples/pimd.conf.sample
+share/examples/frr/configsamples/ripd.conf.sample
+share/examples/frr/configsamples/ripngd.conf.sample
+share/examples/frr/configsamples/staticd.conf.sample
+share/examples/frr/configsamples/vtysh.conf.sample
+share/examples/frr/configsamples/zebra.conf.sample
+share/yang/frr-bfdd.yang
+share/yang/frr-eigrpd.yang
+share/yang/frr-filter.yang
+share/yang/frr-igmp.yang
+share/yang/frr-interface.yang
+share/yang/frr-isisd.yang
+share/yang/frr-module-translator.yang
+share/yang/frr-nexthop.yang
+share/yang/frr-pim-rp.yang
+share/yang/frr-pim.yang
+share/yang/frr-ripd.yang
+share/yang/frr-ripngd.yang
+share/yang/frr-route-map.yang
+share/yang/frr-route-types.yang
+share/yang/frr-routing.yang
+share/yang/frr-staticd.yang
+share/yang/frr-test-module.yang
+share/yang/frr-vrf.yang
+share/yang/frr-zebra.yang
+share/yang/ietf-interfaces.yang
+share/yang/ietf-routing-types.yang
diff --git a/frr/distinfo b/frr/distinfo
new file mode 100644
index 0000000000..39d570f4c9
--- /dev/null
+++ b/frr/distinfo
@@ -0,0 +1,8 @@
+$NetBSD$
+
+SHA1 (frr-7.4.tar.gz) = 97ee20790e59d672d6ce41a147dad7639de65e91
+RMD160 (frr-7.4.tar.gz) = 6c8dbf18b9d59c6518d57b2a1869d827ff194448
+SHA512 (frr-7.4.tar.gz) = d5c4e3bf7527bc094a65b24fda1b7a86f87e996fb3d98abe646e878274e0ca30f45aefca76816414b9d44607616cd2eb8ad118045b8986a92dd130f3a704162f
+Size (frr-7.4.tar.gz) = 6074854 bytes
+SHA1 (patch-lib_zlog.c) = 00e70b92eae8e399ac3083fec815350463a6b0e0
+SHA1 (patch-zebra_ioctl.c) = 99b7606564f4dc620df997889156b5c09f7fb396
diff --git a/frr/files/staticd.sh b/frr/files/staticd.sh
new file mode 100755
index 0000000000..72ee9602a9
--- /dev/null
+++ b/frr/files/staticd.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# ripd is part of the quagga routing beast
+#
+# PROVIDE: ripd
+# REQUIRE: zebra
+##
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin
+export PATH
+
+if [ -f /etc/rc.subr ]
+then
+ . /etc/rc.subr
+fi
+
+name="staticd"
+rcvar=$name
+required_files="/usr/pkg/etc/frr/${name}.conf"
+command="/usr/pkg/sbin/${name}"
+command_args="-d"
+
+socket_dir=/var/run/frr
+pidfile="${socket_dir}/${name}.pid"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/frr/patches/patch-lib_zlog.c b/frr/patches/patch-lib_zlog.c
new file mode 100644
index 0000000000..bc14c78459
--- /dev/null
+++ b/frr/patches/patch-lib_zlog.c
@@ -0,0 +1,22 @@
+$NetBSD$
+
+ As NetBSD currently (2020) implements
+ posix_fallocate() but no file system supports it
+ we need to stay away from posix_fallocate.
+ Additionally the present frr code relies on
+ negative errnos (as found e.g. in Linux) and
+ also did not find in the manual that
+ posix_fallocate() return the errno and does not set
+ errno.
+
+--- lib/zlog.c.orig 2020-06-30 11:08:57.000000000 +0000
++++ lib/zlog.c
+@@ -245,7 +246,7 @@ void zlog_tls_buffer_init(void)
+ }
+ fchown(mmfd, zlog_uid, zlog_gid);
+
+-#ifdef HAVE_POSIX_FALLOCATE
++#if defined(HAVE_POSIX_FALLOCATE) && !defined(__NetBSD__)
+ if (posix_fallocate(mmfd, 0, TLS_LOG_BUF_SIZE) < 0) {
+ #else
+ if (ftruncate(mmfd, TLS_LOG_BUF_SIZE) < 0) {
diff --git a/frr/patches/patch-zebra_ioctl.c b/frr/patches/patch-zebra_ioctl.c
new file mode 100644
index 0000000000..19ac380490
--- /dev/null
+++ b/frr/patches/patch-zebra_ioctl.c
@@ -0,0 +1,116 @@
+$NetBSD$
+
+ In NetBSD the correct way to determine link status is
+ ifi_link_state in if_data. This also avoids many
+ error messages on interfaces that do not support
+ SIOCGIFMEDIA.
+
+--- zebra/ioctl.c.orig 2020-06-30 11:08:57.000000000 +0000
++++ zebra/ioctl.c
+@@ -421,9 +421,6 @@ void if_get_flags(struct interface *ifp)
+ {
+ int ret;
+ struct ifreq ifreq;
+-#ifdef HAVE_BSD_LINK_DETECT
+- struct ifmediareq ifmr;
+-#endif /* HAVE_BSD_LINK_DETECT */
+
+ ifreq_set_name(&ifreq, ifp);
+
+@@ -434,34 +431,80 @@ void if_get_flags(struct interface *ifp)
+ safe_strerror(errno));
+ return;
+ }
+-#ifdef HAVE_BSD_LINK_DETECT /* Detect BSD link-state at start-up */
++
++ if (!CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION))
++ goto out;
+
+ /* Per-default, IFF_RUNNING is held high, unless link-detect says
+ * otherwise - we abuse IFF_RUNNING inside zebra as a link-state flag,
+ * following practice on Linux and Solaris kernels
+ */
+- SET_FLAG(ifreq.ifr_flags, IFF_RUNNING);
+
+- if (CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION)) {
+- (void)memset(&ifmr, 0, sizeof(ifmr));
+- strlcpy(ifmr.ifm_name, ifp->name, sizeof(ifmr.ifm_name));
+-
+- /* Seems not all interfaces implement this ioctl */
+- if (if_ioctl(SIOCGIFMEDIA, (caddr_t)&ifmr) == -1 &&
+- errno != EINVAL)
++#ifdef SIOCGIFDATA
++ /*
++ * BSD gets link state from ifi_link_link in struct if_data.
++ * All BSD's have this in getifaddrs(3) ifa_data for AF_LINK addresses.
++ * We can also access it via SIOCGIFDATA.
++ */
++
++#ifdef __NetBSD__
++ struct ifdatareq ifdr = { .ifdr_data.ifi_link_state = 0 };
++ struct if_data *ifdata = &ifdr.ifdr_data;
++
++ strlcpy(ifdr.ifdr_name, ifp->name, sizeof(ifdr.ifdr_name));
++ ret = vrf_if_ioctl(SIOCGIFDATA, (caddr_t)&ifdr, ifp->vrf_id);
++#else
++ struct if_data ifd = { .ifi_link_state = 0 };
++ struct if_data *ifdata = &ifd;
++
++ ifreq.ifr_data = (caddr_t)ifdata;
++ ret = vrf_if_ioctl(SIOCGIFDATA, (caddr_t)&ifreq, ifp->vrf_id);
++#endif
++
++ if (ret == -1)
++ /* Very unlikely. Did the interface disappear? */
++ flog_err_sys(EC_LIB_SYSTEM_CALL,
++ "if_ioctl(SIOCGIFDATA) failed: %s",
++ safe_strerror(errno));
++ else {
++ if (ifdata->ifi_link_state >= LINK_STATE_UP)
++ SET_FLAG(ifreq.ifr_flags, IFF_RUNNING);
++ else if (ifdata->ifi_link_state == LINK_STATE_UNKNOWN)
++ /* BSD traditionally treats UNKNOWN as UP */
++ SET_FLAG(ifreq.ifr_flags, IFF_RUNNING);
++ else
++ UNSET_FLAG(ifreq.ifr_flags, IFF_RUNNING);
++ }
++
++#elif defined(HAVE_BSD_LINK_DETECT)
++ /*
++ * This is only needed for FreeBSD older than FreeBSD-13.
++ * Valid and active media generally means the link state is
++ * up, but this is not always the case.
++ * For example, some BSD's with a net80211 interface in MONITOR
++ * mode will treat the media as valid and active but the
++ * link state is down - because we cannot send anything.
++ * Also, virtual interfaces such as PPP, VLAN, etc generally
++ * don't support media at all, so the ioctl will just fail.
++ */
++ struct ifmediareq ifmr = { .ifm_status = 0 };
++
++ strlcpy(ifmr.ifm_name, ifp->name, sizeof(ifmr.ifm_name));
++
++ if (if_ioctl(SIOCGIFMEDIA, (caddr_t)&ifmr) == -1) {
++ if (errno != EINVAL)
+ flog_err_sys(EC_LIB_SYSTEM_CALL,
+ "if_ioctl(SIOCGIFMEDIA) failed: %s",
+ safe_strerror(errno));
+- else if (ifmr.ifm_status & IFM_AVALID) /* Link state is valid */
+- {
+- if (ifmr.ifm_status & IFM_ACTIVE)
+- SET_FLAG(ifreq.ifr_flags, IFF_RUNNING);
+- else
+- UNSET_FLAG(ifreq.ifr_flags, IFF_RUNNING);
+- }
++ } else if (ifmr.ifm_status & IFM_AVALID) { /* media state is valid */
++ if (ifmr.ifm_status & IFM_ACTIVE) /* media is active */
++ SET_FLAG(ifreq.ifr_flags, IFF_RUNNING);
++ else
++ UNSET_FLAG(ifreq.ifr_flags, IFF_RUNNING);
+ }
+ #endif /* HAVE_BSD_LINK_DETECT */
+
++out:
+ if_flags_update(ifp, (ifreq.ifr_flags & 0x0000ffff));
+ }
+
Home |
Main Index |
Thread Index |
Old Index