aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@mail.noconroy.net>2019-09-23 22:01:41 +0100
committerMatt Dunwoodie <ncon@mail.noconroy.net>2019-09-23 22:01:41 +0100
commit382892e0d60fa7f2113c3a0b6ca1a09a9108bb30 (patch)
tree61d34d189707564c708e2b7b0a89b4c1dabdf96c
parentMove functions from header files into dedicated file (diff)
downloadwireguard-openbsd-382892e0d60fa7f2113c3a0b6ca1a09a9108bb30.tar.xz
wireguard-openbsd-382892e0d60fa7f2113c3a0b6ca1a09a9108bb30.zip
mpq was broken, now fixed
-rw-r--r--src/kern_wg.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/kern_wg.c b/src/kern_wg.c
index 697249e..671b8b1 100644
--- a/src/kern_wg.c
+++ b/src/kern_wg.c
@@ -308,6 +308,8 @@ mpq_enqueue(struct mpq *mpq, struct mbuf *m)
CLR(m->m_flags, M_LINK0);
mtx_enter(&mpq->mpq_mtx);
ml_enqueue(&mpq->mpq_list, m);
+ if (mpq->mpq_cursor == NULL)
+ mpq->mpq_cursor = m;
mtx_leave(&mpq->mpq_mtx);
}
@@ -324,11 +326,9 @@ struct mbuf
{
struct mbuf *m;
mtx_enter(&mpq->mpq_mtx);
- if (mpq->mpq_cursor == NULL)
- mpq->mpq_cursor = MBUF_LIST_FIRST(&mpq->mpq_list);
- else
- mpq->mpq_cursor = MBUF_LIST_NEXT(mpq->mpq_cursor);
m = mpq->mpq_cursor;
+ if (mpq->mpq_cursor != NULL)
+ mpq->mpq_cursor = MBUF_LIST_NEXT(mpq->mpq_cursor);
mtx_leave(&mpq->mpq_mtx);
return m;
}