From ba28bae8cc6d4d02d73c6fe0bf1262701abd396b Mon Sep 17 00:00:00 2001 From: Michael Shalayeff Date: Sat, 30 Nov 2002 10:07:52 +0000 Subject: move unmask back into pf_print_state.c where it was, and please keep it there; henning@ ok --- sbin/pfctl/pf_print_state.c | 24 +++++++++++++++++++++++- sbin/pfctl/pfctl_parser.c | 24 +----------------------- 2 files changed, 24 insertions(+), 24 deletions(-) (limited to 'sbin') diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index cb3c56f4449..be1c930d10b 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.12 2002/11/29 18:24:29 mickey Exp $ */ +/* $OpenBSD: pf_print_state.c,v 1.13 2002/11/30 10:07:51 mickey Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -224,3 +224,25 @@ print_state(struct pf_state *s, int opts) printf("\n"); } } + +int +unmask(struct pf_addr *m, sa_family_t af) +{ + int i = 31, j = 0, b = 0, msize; + u_int32_t tmp; + + if (af == AF_INET) + msize = 1; + else + msize = 4; + while (j < msize && m->addr32[j] == 0xffffffff) { + b += 32; + j++; + } + if (j < msize) { + tmp = ntohl(m->addr32[j]); + for (i = 31; tmp & (1 << i); --i) + b++; + } + return (b); +} diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 72a9bd930be..80261b69c0d 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_parser.c,v 1.114 2002/11/28 13:18:09 mcbride Exp $ */ +/* $OpenBSD: pfctl_parser.c,v 1.115 2002/11/30 10:07:51 mickey Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -888,25 +888,3 @@ parse_flags(char *s) } return (f ? f : PF_TH_ALL); } - -int -unmask(struct pf_addr *m, sa_family_t af) -{ - int i = 31, j = 0, b = 0, msize; - u_int32_t tmp; - - if (af == AF_INET) - msize = 1; - else - msize = 4; - while (j < msize && m->addr32[j] == 0xffffffff) { - b += 32; - j++; - } - if (j < msize) { - tmp = ntohl(m->addr32[j]); - for (i = 31; tmp & (1 << i); --i) - b++; - } - return (b); -} -- cgit v1.2.3