diff options
author | Ryan Thomas McBride <mcbride@cvs.openbsd.org> | 2010-06-28 23:21:42 +0000 |
---|---|---|
committer | Ryan Thomas McBride <mcbride@cvs.openbsd.org> | 2010-06-28 23:21:42 +0000 |
commit | c246d91cf4c801e05376eac44bd49d0016e34d9f (patch) | |
tree | a09bcc996a97bf629e74a883e6abb18fa5787f99 /sys/net/pf_if.c | |
parent | e780a94e3f212f0eddee803af28afa52558c1489 (diff) |
Clean up iterface stats handling:
- 'make -Fi' reset ALL the interface statistics
can be restricted with -i ifname
- 'make -Fa -i ifname' fail (it's meaningless)
- get rid of a silly little struct that's only used for one thing
ok henning
Diffstat (limited to 'sys/net/pf_if.c')
-rw-r--r-- | sys/net/pf_if.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/net/pf_if.c b/sys/net/pf_if.c index 0816e3fbf20..b96ba8d1150 100644 --- a/sys/net/pf_if.c +++ b/sys/net/pf_if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_if.c,v 1.60 2010/01/18 23:52:46 mcbride Exp $ */ +/* $OpenBSD: pf_if.c,v 1.61 2010/06/28 23:21:41 mcbride Exp $ */ /* * Copyright 2005 Henning Brauer <henning@openbsd.org> @@ -628,8 +628,17 @@ pfi_update_status(const char *name, struct pf_status *pfs) TAILQ_HEAD(, ifg_member) ifg_members; int i, j, k, s; - strlcpy(key.pfik_name, name, sizeof(key.pfik_name)); s = splsoftnet(); + if (*name == '\0' && pfs == NULL) { + RB_FOREACH(p, pfi_ifhead, &pfi_ifs) { + bzero(p->pfik_packets, sizeof(p->pfik_packets)); + bzero(p->pfik_bytes, sizeof(p->pfik_bytes)); + p->pfik_tzero = time_second; + } + return; + } + + strlcpy(key.pfik_name, name, sizeof(key.pfik_name)); p = RB_FIND(pfi_ifhead, &pfi_ifs, (struct pfi_kif *)&key); if (p == NULL) { splx(s); |