ipf -Z returns junk and/or can cause a panic (seen on solaris.)

This commit is contained in:
darrenr 2006-04-18 12:40:49 +00:00
parent e2f83bd318
commit 0df9b5fe68
2 changed files with 13 additions and 7 deletions

14
dist/ipf/tools/ipf.c vendored
View File

@ -1,4 +1,4 @@
/* $NetBSD: ipf.c,v 1.1.1.4 2006/04/04 16:10:08 martti Exp $ */
/* $NetBSD: ipf.c,v 1.2 2006/04/18 12:40:49 darrenr Exp $ */
/*
* Copyright (C) 1993-2001 by Darren Reed.
@ -453,15 +453,21 @@ void ipf_frsync()
void zerostats()
{
ipfobj_t obj;
friostat_t fio;
friostat_t *fiop = &fio;
obj.ipfo_rev = IPFILTER_VERSION;
obj.ipfo_type = IPFOBJ_IPFSTAT;
obj.ipfo_size = sizeof(fio);
obj.ipfo_ptr = &fio;
obj.ipfo_offset = 0;
if (opendevice(ipfname, 1) != -2) {
if (ioctl(fd, SIOCFRZST, &fiop) == -1) {
if (ioctl(fd, SIOCFRZST, &obj) == -1) {
perror("ioctl(SIOCFRZST)");
exit(-1);
}
showstats(fiop);
showstats(&fio);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: fil.c,v 1.22 2006/04/04 16:17:19 martti Exp $ */
/* $NetBSD: fil.c,v 1.23 2006/04/18 12:40:49 darrenr Exp $ */
/*
* Copyright (C) 1993-2003 by Darren Reed.
@ -140,7 +140,7 @@ struct file;
#if !defined(lint)
#if defined(__NetBSD__)
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.22 2006/04/04 16:17:19 martti Exp $");
__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.23 2006/04/18 12:40:49 darrenr Exp $");
#else
static const char sccsid[] = "@(#)fil.c 1.36 6/5/96 (C) 1993-2000 Darren Reed";
static const char rcsid[] = "@(#)Id: fil.c,v 2.243.2.78 2006/03/29 11:19:54 darrenr Exp";
@ -6288,7 +6288,7 @@ caddr_t data;
int error;
fr_getstat(&fio);
error = copyoutptr(&fio, data, sizeof(fio));
error = fr_outobj(data, &fio, IPFOBJ_IPFSTAT);
if (error)
return EFAULT;