diff --git a/net/quagga/Makefile b/net/quagga/Makefile index 5a4ca728e587..321a78832e7b 100644 --- a/net/quagga/Makefile +++ b/net/quagga/Makefile @@ -1,110 +1,110 @@ # Created by: Bruce M Simpson PORTNAME= quagga PORTVERSION= 1.2.4 -PORTREVISION= 8 +PORTREVISION= 9 CATEGORIES= net MASTER_SITES= https://github.com/Quagga/quagga/releases/download/${DISTNAME}/ MAINTAINER= ports@FreeBSD.org COMMENT= Free RIPv1, RIPv2, OSPFv2, BGP4, IS-IS route software LICENSE= GPLv2+ LICENSE_FILE= ${WRKSRC}/COPYING USES= compiler:c11 cpe gmake libtool makeinfo \ perl5 readline ssl CONFLICTS= frr7 openbgpd pimd zebra GNU_CONFIGURE= yes CONFIGURE_ENV+= GAWK=${AWK} CFLAGS+= -fcommon INSTALL_TARGET= install-strip USE_LDCONFIG= yes USE_PERL5= build INFO= quagga OPTIONS_DEFINE= ISISD PIMD PAM RTADV SNMP TCPSOCKETS DLMALLOC \ NO_BGP_ANNOUNCE OSPF_NEXTHOP ISIS_TOPOLOGY EXAMPLES # IRDP needs something freebsd does not seem to have: # configure: error: 'IRDP requires in_pktinfo at the moment!' OPTIONS_DEFAULT= ISISD PIMD RTADV OPTIONS_SUB= yes PIMD_DESC= PIM-SSM multicast routing IRDP_DESC= Enable IRDP server support ISISD_DESC= Enable ISIS daemon (beta) ISIS_TOPOLOGY_DESC= Enable IS-IS topology generator PAM_DESC= PAM authentication for vtysh RTADV_DESC= IPv6 Router Advertisements TCPSOCKETS_DESC= Use TCP/IP sockets for protocol daemons DLMALLOC_DESC= Use dlmalloc (makes bgpd much faster) NO_BGP_ANNOUNCE_DESC= Turn off BGP route announcement OSPF_NEXTHOP_DESC= Set ip next-hop in OSPF route maps ENABLE_USER?= quagga ENABLE_GROUP?= quagga USERS= ${ENABLE_USER} GROUPS= ${ENABLE_GROUP} SYSCONF_DIR?= ${ETCDIR} LOCALSTATE_DIR?=/var/run/quagga CONFIGURE_ARGS= --enable-user=${ENABLE_USER} \ --enable-group=${ENABLE_GROUP} \ --sysconfdir=${SYSCONF_DIR} \ --localstatedir=${LOCALSTATE_DIR} \ --enable-vtysh .if defined(ENABLE_VTY_GROUP) CONFIGURE_ARGS+=--enable-vty-group=${ENABLE_VTY_GROUP} .endif EXAMPLES_CONFIGURE_ON= --enable-exampledir=${PREFIX}/share/examples/quagga EXAMPLES_CONFIGURE_OFF= --disable-exampledir ISISD_CONFIGURE_ENABLE= isisd ISIS_TOPOLOGY_CONFIGURE_ENABLE= isis-topology PIMD_CONFIGURE_ENABLE= pimd IRDP_CONFIGURE_ENABLE= irdp PAM_CONFIGURE_WITH= libpam RTADV_CONFIGURE_ENABLE= rtadv SNMP_CONFIGURE_ENABLE= snmp SNMP_LIB_DEPENDS= libnetsnmp.so:net-mgmt/net-snmp TCPSOCKETS_CONFIGURE_ENABLE= tcp-zebra DLMALLOC_LIB_DEPENDS= libdlmalloc.so:devel/libdlmalloc DLMALLOC_LIBS= -L${LOCALBASE}/lib -ldlmalloc OSPF_NEXTHOP_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-ospf-nexthop # inverse option. NO_BGP_ANNOUNCE_CONFIGURE_ON= --disable-bgp-announce NO_BGP_ANNOUNCE_CONFIGURE_OFF= --enable-bgp-announce USE_RC_SUBR= quagga watchquagga SUB_LIST+= LOCALSTATE_DIR=${LOCALSTATE_DIR} \ SYSCONF_DIR=${SYSCONF_DIR} PLIST_SUB+= LOCALSTATE_DIR=${LOCALSTATE_DIR} \ SYSCONF_DIR=${SYSCONF_DIR} \ ENABLE_USER=${ENABLE_USER} \ ENABLE_GROUP=${ENABLE_GROUP} pre-everything:: @${ECHO} "=============================================================" @${ECHO} @${ECHO} "You can build ${PORTNAME} with the following options:" @${ECHO} @${ECHO} "ENABLE_USER Specify user to run Quagga suite as" @${ECHO} "ENABLE_GROUP Specify group to run Quagga suite as" @${ECHO} "ENABLE_VTY_GROUP Specify group for vty socket ownership" @${ECHO} "SYSCONF_DIR Specify directory for Quagga configuration files" @${ECHO} "LOCALSTATE_DIR Specify directory for Quagga runtime files" post-install: ${MKDIR} ${STAGEDIR}${LOCALSTATE_DIR} ${STAGEDIR}${SYSCONF_DIR} .include diff --git a/net/quagga/files/patch-fdsetsize b/net/quagga/files/patch-fdsetsize new file mode 100644 index 000000000000..83067174f970 --- /dev/null +++ b/net/quagga/files/patch-fdsetsize @@ -0,0 +1,21 @@ +--- lib/thread.c.orig 2018-03-30 18:53:43.537794946 +0200 ++++ lib/thread.c 2018-03-30 19:17:27.919629268 +0200 +@@ -531,7 +531,8 @@ thread_master_create () + return NULL; + } + +- rv->fd_limit = (int)limit.rlim_cur; ++ rv->fd_limit = ((int)limit.rlim_cur < FD_SETSIZE ? ++ (int)limit.rlim_cur : FD_SETSIZE); + rv->read = XCALLOC (MTYPE_THREAD, sizeof (struct thread *) * rv->fd_limit); + if (rv->read == NULL) + { +@@ -1187,7 +1188,7 @@ thread_fetch (struct thread_master *m) + timer_wait = timer_wait_bg; + } + +- num = fd_select (FD_SETSIZE, &readfd, &writefd, &exceptfd, timer_wait); ++ num = fd_select (m->fd_limit, &readfd, &writefd, &exceptfd, timer_wait); + + /* Signals should get quick treatment */ + if (num < 0) diff --git a/net/quagga/files/patch-lib_thread.c b/net/quagga/files/patch-lib_thread.c index fdfe14662332..04736c624c00 100644 --- a/net/quagga/files/patch-lib_thread.c +++ b/net/quagga/files/patch-lib_thread.c @@ -1,11 +1,27 @@ ---- lib/thread.c.orig 2018-02-19 21:24:55 UTC -+++ lib/thread.c -@@ -603,6 +603,8 @@ thread_add_fd (struct thread **thread_ar +--- lib/thread.c.orig 2022-01-15 00:23:57.600963000 +0700 ++++ lib/thread.c 2022-01-15 00:26:01.645088000 +0700 +@@ -603,8 +603,12 @@ thread_add_fd (struct thread **thread_array, struct th static void thread_add_unuse (struct thread *thread) { -+ if (thread->type == THREAD_UNUSED) -+ return; ++ assert (thread); ++ /* thread_execute uses dummy threads, allocated on its stack */ ++ if (thread->master == NULL) ++ return; ++ thread->type = THREAD_UNUSED; - assert (thread->master != NULL && thread != NULL); +- assert (thread->master != NULL && thread != NULL); assert (thread->next == NULL); + assert (thread->prev == NULL); + thread_list_add (&thread->master->unuse, thread); +@@ -1342,9 +1346,7 @@ thread_call (struct thread *thread) + } + #endif /* CONSUMED_TIME_CHECK */ + +- +- if (thread->master) +- thread_add_unuse (thread); ++ thread_add_unuse (thread); + } + + /* Execute thread */ diff --git a/net/quagga/files/patch-pqueue.c b/net/quagga/files/patch-pqueue.c new file mode 100644 index 000000000000..c00e7f6efcaa --- /dev/null +++ b/net/quagga/files/patch-pqueue.c @@ -0,0 +1,14 @@ +--- lib/pqueue.c.orig 2018-02-20 04:24:55.000000000 +0700 ++++ lib/pqueue.c 2022-01-15 00:17:05.525677000 +0700 +@@ -172,7 +172,10 @@ pqueue_dequeue (struct pqueue *queue) + void + pqueue_remove_at (int index, struct pqueue *queue) + { +- queue->array[index] = queue->array[--queue->size]; ++ if (index == --queue->size) ++ return; /* we're removing the last entry */ ++ ++ queue->array[index] = queue->array[queue->size]; + + if (index > 0 + && (*queue->cmp) (queue->array[index],