-/* $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
{
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:");
-/* $OpenBSD: pf_if.c,v 1.106 2022/06/26 11:37:08 mbuhl Exp $ */
+/* $OpenBSD: pf_if.c,v 1.107 2022/11/21 07:27:10 sashan Exp $ */
/*
* Copyright 2005 Henning Brauer <henning@openbsd.org>
nextp = RB_NEXT(pfi_ifhead, &pfi_ifs, p);
if (pfi_skip_if(name, p))
continue;
- if (*size > n++) {
- if (!p->pfik_tzero)
- p->pfik_tzero = gettime();
- memcpy(buf++, p, sizeof(*buf));
- nextp = RB_NEXT(pfi_ifhead, &pfi_ifs, p);
- }
+ if (*size <= ++n)
+ break;
+ if (!p->pfik_tzero)
+ p->pfik_tzero = gettime();
+ memcpy(buf++, p, sizeof(*buf));
+ nextp = RB_NEXT(pfi_ifhead, &pfi_ifs, p);
}
*size = n;
}