diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2002-07-05 14:05:45 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2002-07-05 14:05:45 +0000 |
commit | 13f0e77c3dce5b6dce284100dcef50d6a5536b1f (patch) | |
tree | 4b8717cfde03a2ced3ac9ec5b6d308d82fad9523 /sys | |
parent | 2e089e1ece0c1db27be654df2ff320f784f89ca6 (diff) |
fix a small bug I found while installing a -current pf firewall at a
client some days ago:
if you had a rulefile with "set loginterface <interface>" and loaded through
pfctl -e -f /etc/pf.conf, pfctl -si didn't display the interface stats,
because on DIOCSTART pf_status.ifname was cleared and enableing is done after
loading the ruleset.
similar for DIOCCLRSTATUS, remember pf_status.ifname there as well.
added feature:
On DIOCSETSTATUSIF unset the statusinterface if pi->ifname is empty.
ok dhartmei@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/pf_ioctl.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index 75b3362a130..b1a5ebe08bb 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.6 2002/06/16 17:00:39 aaron Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.7 2002/07/05 14:05:44 henning Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -198,6 +198,9 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) pf_status.running = 1; pf_status.states = states; pf_status.since = time.tv_sec; + if (status_ifp != NULL) + strlcpy(pf_status.ifname, + status_ifp->if_xname, IFNAMSIZ); DPFPRINTF(PF_DEBUG_MISC, ("pf: started\n")); } break; @@ -1320,12 +1323,16 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) struct pfioc_if *pi = (struct pfioc_if *)addr; struct ifnet *ifp; - if ((ifp = ifunit(pi->ifname)) == NULL) - error = EINVAL; - else { - status_ifp = ifp; - strlcpy(pf_status.ifname, ifp->if_xname, IFNAMSIZ); - } + if (pi->ifname[0] == 0) { + status_ifp = NULL; + bzero(pf_status.ifname, IFNAMSIZ); + } else + if ((ifp = ifunit(pi->ifname)) == NULL) + error = EINVAL; + else { + status_ifp = ifp; + strlcpy(pf_status.ifname, ifp->if_xname, IFNAMSIZ); + } break; } @@ -1346,6 +1353,9 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) pf_status.states = states; pf_status.since = since; pf_status.debug = debug; + if (status_ifp != NULL) + strlcpy(pf_status.ifname, + status_ifp->if_xname, IFNAMSIZ); break; } |