summaryrefslogtreecommitdiff
path: root/sbin/pfctl
diff options
context:
space:
mode:
authorAlexandr Nedvedicky <sashan@cvs.openbsd.org>2022-11-21 07:27:11 +0000
committerAlexandr Nedvedicky <sashan@cvs.openbsd.org>2022-11-21 07:27:11 +0000
commit8b73fd0fa0b5ea0926cd3cb9dd96859bea5681c5 (patch)
treed7f1f963092954757bfc59a311b814c5a8b9dcfa /sbin/pfctl
parent7cf6d5ff9dd1616abe9cff6702c0e63e0fe72066 (diff)
Fix DIOCIGETIFACES ioctl so all network interfaces
and interface groups are reported. The bug allowed to enumerate the first 64 interfaces only. The issue has been noticed and bug kindly reported by Olivier Croquin. OK kn@
Diffstat (limited to 'sbin/pfctl')
-rw-r--r--sbin/pfctl/pfctl_table.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c
index 5c0c32e5961..a7ff5533964 100644
--- a/sbin/pfctl/pfctl_table.c
+++ b/sbin/pfctl/pfctl_table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_table.c,v 1.84 2020/01/15 22:38:31 kn Exp $ */
+/* $OpenBSD: pfctl_table.c,v 1.85 2022/11/21 07:27:10 sashan Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@@ -583,18 +583,16 @@ pfctl_show_ifaces(const char *filter, int opts)
{
struct pfr_buffer b;
struct pfi_kif *p;
- int i = 0;
bzero(&b, sizeof(b));
b.pfrb_type = PFRB_IFACES;
for (;;) {
- pfr_buf_grow(&b, b.pfrb_size);
+ pfr_buf_grow(&b, 0);
b.pfrb_size = b.pfrb_msize;
if (pfi_get_ifaces(filter, b.pfrb_caddr, &b.pfrb_size))
errx(1, "%s", pf_strerror(errno));
- if (b.pfrb_size <= b.pfrb_msize)
+ if (b.pfrb_size < b.pfrb_msize)
break;
- i++;
}
if (opts & PF_OPT_SHOWALL)
pfctl_print_title("INTERFACES:");