diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-05-19 20:22:54 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-05-19 20:22:54 +0000 |
commit | d44beb8c31ace893e777e473b7bdf0a731bc343b (patch) | |
tree | 2cff965f868b9a2439a8b0f84ccae253e1560614 | |
parent | be918f62aa1e740f58a719f2d8d32d1fc10dc75a (diff) |
print out the full netmask; don't just ignore the upper bits in the v4 case
helps finding assignment bugs.
-rw-r--r-- | sbin/pfctl/pf_print_state.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index 560aa82f6b1..2fe474e7a4e 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_print_state.c,v 1.27 2003/05/17 07:45:28 dhartmei Exp $ */ +/* $OpenBSD: pf_print_state.c,v 1.28 2003/05/19 20:22:53 henning Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -257,18 +257,14 @@ print_state(struct pf_state *s, int opts) int unmask(struct pf_addr *m, sa_family_t af) { - int i = 31, j = 0, b = 0, msize; + int i = 31, j = 0, b = 0; u_int32_t tmp; - if (af == AF_INET) - msize = 1; - else - msize = 4; - while (j < msize && m->addr32[j] == 0xffffffff) { + while (j < 4 && m->addr32[j] == 0xffffffff) { b += 32; j++; } - if (j < msize) { + if (j < 4) { tmp = ntohl(m->addr32[j]); for (i = 31; tmp & (1 << i); --i) b++; |