fix portinuse.c for OpenBSD 5.5+

all CIRCLEQ have been replaced by TAILQ
fixes #496
This commit is contained in:
Thomas Bernard 2020-10-30 22:14:45 +01:00
parent 1008ed1117
commit c9939cc01e
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
3 changed files with 22 additions and 6 deletions

View File

@ -1,4 +1,7 @@
$Id: Changelog.txt,v 1.467 2020/06/20 15:45:30 nanard Exp $ $Id: Changelog.txt,v 1.469 2020/10/30 21:11:50 nanard Exp $
2020/10/30:
OpenBSD: portinuse.c compatible with OpenBSD 5.5+
2020/10/22: 2020/10/22:
netfilter_nft: fix rule-cache update when using the same chain name in netfilter_nft: fix rule-cache update when using the same chain name in

6
miniupnpd/configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# $Id: configure,v 1.111 2020/05/10 22:26:13 nanard Exp $ # $Id: configure,v 1.113 2020/10/30 21:11:52 nanard Exp $
# vim: tabstop=4 shiftwidth=4 noexpandtab # vim: tabstop=4 shiftwidth=4 noexpandtab
# #
# miniupnp daemon # miniupnp daemon
@ -200,6 +200,10 @@ case $OS_NAME in
if [ $MAJORVER -ge 5 ]; then if [ $MAJORVER -ge 5 ]; then
echo "#define PFRULE_HAS_ONRDOMAIN" >> ${CONFIGFILE} echo "#define PFRULE_HAS_ONRDOMAIN" >> ${CONFIGFILE}
fi fi
# before OpenBSD 5.5 inpt_queue was CIRCLEQ
if [ $MAJORVER -lt 5 ] || [ $MAJORVER -eq 5 -a $MINORVER -lt 5 ]; then
echo "#define INPT_QUEUE_IS_CIRCLEQ" >> ${CONFIGFILE}
fi
FW=pf FW=pf
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE} echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
OS_URL=http://www.openbsd.org/ OS_URL=http://www.openbsd.org/

View File

@ -1,7 +1,7 @@
/* $Id: portinuse.c,v 1.9 2019/09/24 11:49:28 nanard Exp $ */ /* $Id: portinuse.c,v 1.11 2020/10/30 21:11:52 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab /* vim: tabstop=4 shiftwidth=4 noexpandtab
* MiniUPnP project * MiniUPnP project
* (c) 2007-2019 Thomas Bernard * (c) 2007-2020 Thomas Bernard
* http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
* This software is subject to the conditions detailed * This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */ * in the LICENCE file provided within the distribution */
@ -163,7 +163,12 @@ static struct nlist list[] = {
kvm_close(kd); kvm_close(kd);
return -1; return -1;
} }
next = CIRCLEQ_FIRST(&table.inpt_queue); /*TAILQ_FIRST(&table.inpt_queue);*/ /* inpt_queue was CIRCLEQ_HEAD, it is TAILQ_HEAD since OpenBSD 5.5 */
#ifdef INPT_QUEUE_IS_CIRCLEQ
next = CIRCLEQ_FIRST(&table.inpt_queue);
#else
next = TAILQ_FIRST(&table.inpt_queue);
#endif
while(next != NULL) { while(next != NULL) {
if(((u_long)next & 3) != 0) break; if(((u_long)next & 3) != 0) break;
n = kvm_read(kd, (u_long)next, &inpcb, sizeof(inpcb)); n = kvm_read(kd, (u_long)next, &inpcb, sizeof(inpcb));
@ -171,7 +176,11 @@ static struct nlist list[] = {
syslog(LOG_ERR, "kvm_read(): %s", kvm_geterr(kd)); syslog(LOG_ERR, "kvm_read(): %s", kvm_geterr(kd));
break; break;
} }
next = CIRCLEQ_NEXT(&inpcb, inp_queue); /*TAILQ_NEXT(&inpcb, inp_queue);*/ #ifdef INPT_QUEUE_IS_CIRCLEQ
next = CIRCLEQ_NEXT(&inpcb, inp_queue);
#else
next = TAILQ_NEXT(&inpcb, inp_queue);
#endif
/* skip IPv6 sockets */ /* skip IPv6 sockets */
if((inpcb.inp_flags & INP_IPV6) != 0) if((inpcb.inp_flags & INP_IPV6) != 0)
continue; continue;