summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2000-06-14 10:07:22 +0000
committerluigi <luigi@FreeBSD.org>2000-06-14 10:07:22 +0000
commit021d03f5bf631a868a0518181a8ca19a75e04d16 (patch)
treef6b3a25c5da00d0c531271085d7fa0bf5023e8f3 /sbin
parent9e9163919b2e43f0aa5da82abe72ea2129448b57 (diff)
downloadFreeBSD-src-021d03f5bf631a868a0518181a8ca19a75e04d16.zip
FreeBSD-src-021d03f5bf631a868a0518181a8ca19a75e04d16.tar.gz
Fix behaviour of "ipfw pipe show" -- previous code gave
ambiguous data to the userland program (kernel operation was safe, anyways).
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ipfw/ipfw.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/ipfw/ipfw.c b/sbin/ipfw/ipfw.c
index 75cb893..aa79185 100644
--- a/sbin/ipfw/ipfw.c
+++ b/sbin/ipfw/ipfw.c
@@ -611,17 +611,17 @@ list(ac, av)
{
const int unit = do_pipe ? sizeof(*pipes) : sizeof(*rules);
const int ocmd = do_pipe ? IP_DUMMYNET_GET : IP_FW_GET;
- int nalloc = 0;
+ int nalloc = unit;
+ nbytes = nalloc ;
- while (num >= nalloc) {
+ while (nbytes >= nalloc) {
nalloc = nalloc * 2 + 200;
- nbytes = nalloc * unit;
+ nbytes = nalloc ;
if ((data = realloc(data, nbytes)) == NULL)
err(EX_OSERR, "realloc");
if (getsockopt(s, IPPROTO_IP, ocmd, data, &nbytes) < 0)
err(EX_OSERR, "getsockopt(IP_%s_GET)",
do_pipe ? "DUMMYNET" : "FW");
- num = nbytes / unit;
}
}
@@ -643,7 +643,7 @@ list(ac, av)
char buf[30] ;
char prefix[80] ;
- if ( (p->fs.flags_fs & DN_IS_PIPE) == 0)
+ if ( p->next != (struct dn_pipe *)DN_IS_PIPE )
break ;
l = sizeof(*p) + p->fs.rq_elements * sizeof(*q) ;
next = (void *)p + l ;
@@ -674,7 +674,7 @@ list(ac, av)
for ( ; nbytes >= sizeof(*fs) ; fs = (struct dn_flow_set *)next ) {
char prefix[80] ;
- if ( (fs->flags_fs & DN_IS_QUEUE) == 0)
+ if ( fs->next != (struct dn_flow_set *)DN_IS_QUEUE )
break ;
l = sizeof(*fs) + fs->rq_elements * sizeof(*q) ;
next = (void *)fs + l ;
OpenPOWER on IntegriCloud