Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Jan 2022 09:48:13 GMT
From:      Eugene Grosbein <eugen@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: f29fab6043ae - main - net/quagga: add three bugfixes from upstream
Message-ID:  <202201150948.20F9mDGp041133@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by eugen:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f29fab6043ae4e3a2d448406a6c900c26f41c353

commit f29fab6043ae4e3a2d448406a6c900c26f41c353
Author:     Eugene Grosbein <eugen@FreeBSD.org>
AuthorDate: 2022-01-15 09:42:20 +0000
Commit:     Eugene Grosbein <eugen@FreeBSD.org>
CommitDate: 2022-01-15 09:48:03 +0000

    net/quagga: add three bugfixes from upstream
    
    This change imports three post-1.2.4 release changes
    from the primary Git repository of Quagga Project:
    
    1) Fix threading error that broke ripd:
    https://gogs.quagga.net/Quagga/quagga/commit/1f918980c08d9fb9215609db39f7fb279c2e1807
    
    2) Fix memory corruption that may occur
    when limit.rlim_cur is less then FD_SETSIZE:
    https://gogs.quagga.net/Quagga/quagga/commit/b54de751ef72fa67749825a0ea30af7c22d575c5
    
    3) Prevent queue corruption when removing the last entry of queues
    https://gogs.quagga.net/Quagga/quagga/commit/e21719d8fa2b560d7cc9d1d9204bafee4984c577
    
    PR:             261205
    Approved by:    pi (maintainer)
---
 net/quagga/Makefile                 |  2 +-
 net/quagga/files/patch-fdsetsize    | 21 +++++++++++++++++++++
 net/quagga/files/patch-lib_thread.c | 28 ++++++++++++++++++++++------
 net/quagga/files/patch-pqueue.c     | 14 ++++++++++++++
 4 files changed, 58 insertions(+), 7 deletions(-)

diff --git a/net/quagga/Makefile b/net/quagga/Makefile
index 5a4ca728e587..321a78832e7b 100644
--- a/net/quagga/Makefile
+++ b/net/quagga/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	quagga
 PORTVERSION=	1.2.4
-PORTREVISION=	8
+PORTREVISION=	9
 CATEGORIES=	net
 MASTER_SITES=	https://github.com/Quagga/quagga/releases/download/${DISTNAME}/
 
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],



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202201150948.20F9mDGp041133>