diff options
author | Camiel Dobbelaar <camield@cvs.openbsd.org> | 2002-10-25 10:40:46 +0000 |
---|---|---|
committer | Camiel Dobbelaar <camield@cvs.openbsd.org> | 2002-10-25 10:40:46 +0000 |
commit | 1116bfd151f96821ebdbaeb8543ce4097979d9d8 (patch) | |
tree | ce56d6d3ba373169dbda846146979f64e63e4b72 | |
parent | 60749b6964e1a9fd44c203d14fc38e17f75e9360 (diff) |
- more sa_family_t
- move unmask code to correct file
- whitespace
ok mcbride@ dhartmei@
-rw-r--r-- | sbin/pfctl/pf_print_state.c | 30 | ||||
-rw-r--r-- | sbin/pfctl/pf_print_state.h | 8 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_parser.c | 24 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_parser.h | 34 |
4 files changed, 48 insertions, 48 deletions
diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index 238fc04c594..3f26a236eaa 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.6 2002/10/22 12:28:08 mcbride Exp $ */ +/* $OpenBSD: pf_print_state.c,v 1.7 2002/10/25 10:40:45 camield Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -55,32 +55,10 @@ #include "pfctl_parser.h" #include "pf_print_state.h" -void print_name(struct pf_addr *, struct pf_addr *, int); - -int -unmask(struct pf_addr *m, u_int8_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); -} +void print_name(struct pf_addr *, struct pf_addr *, sa_family_t); void -print_addr(struct pf_addr_wrap *addr, struct pf_addr *mask, u_int8_t af) +print_addr(struct pf_addr_wrap *addr, struct pf_addr *mask, sa_family_t af) { char buf[48]; @@ -101,7 +79,7 @@ print_addr(struct pf_addr_wrap *addr, struct pf_addr *mask, u_int8_t af) } void -print_name(struct pf_addr *addr, struct pf_addr *mask, int af) +print_name(struct pf_addr *addr, struct pf_addr *mask, sa_family_t af) { char host[NI_MAXHOST]; diff --git a/sbin/pfctl/pf_print_state.h b/sbin/pfctl/pf_print_state.h index 05c2ac41ec2..989cc344913 100644 --- a/sbin/pfctl/pf_print_state.h +++ b/sbin/pfctl/pf_print_state.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_print_state.h,v 1.5 2002/10/22 12:28:08 mcbride Exp $ */ +/* $OpenBSD: pf_print_state.h,v 1.6 2002/10/25 10:40:45 camield Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -33,9 +33,9 @@ #ifndef _PF_PRINT_STATE_H_ #define _PF_PRINT_STATE_H_ -void print_addr (struct pf_addr_wrap *, struct pf_addr *, sa_family_t); -void print_host (struct pf_state_host *, sa_family_t, int); -void print_seq (struct pf_state_peer *); +void print_addr(struct pf_addr_wrap *, struct pf_addr *, sa_family_t); +void print_host(struct pf_state_host *, sa_family_t, int); +void print_seq(struct pf_state_peer *); void print_state(struct pf_state *s, int); #endif /* _PF_PRINT_STATE_H_ */ diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 76f3277b226..6181a438eec 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_parser.c,v 1.101 2002/10/22 12:28:08 mcbride Exp $ */ +/* $OpenBSD: pfctl_parser.c,v 1.102 2002/10/25 10:40:45 camield Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -829,3 +829,25 @@ 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); +} diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index c0967965d84..774a7dee882 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_parser.h,v 1.25 2002/06/25 08:13:26 henning Exp $ */ +/* $OpenBSD: pfctl_parser.h,v 1.26 2002/10/25 10:40:45 camield Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -63,26 +63,26 @@ struct pfctl { struct pfioc_rdr *prdr; }; -int pfctl_add_rule(struct pfctl *, struct pf_rule *); -int pfctl_add_nat(struct pfctl *, struct pf_nat *); -int pfctl_add_binat(struct pfctl *, struct pf_binat *); -int pfctl_add_rdr(struct pfctl *, struct pf_rdr *); +int pfctl_add_rule(struct pfctl *, struct pf_rule *); +int pfctl_add_nat(struct pfctl *, struct pf_nat *); +int pfctl_add_binat(struct pfctl *, struct pf_binat *); +int pfctl_add_rdr(struct pfctl *, struct pf_rdr *); -int pfctl_set_timeout(struct pfctl *, const char *, int); -int pfctl_set_optimization(struct pfctl *, const char *); -int pfctl_set_limit(struct pfctl *, const char *, unsigned int); -int pfctl_set_logif(struct pfctl *, char *); +int pfctl_set_timeout(struct pfctl *, const char *, int); +int pfctl_set_optimization(struct pfctl *, const char *); +int pfctl_set_limit(struct pfctl *, const char *, unsigned int); +int pfctl_set_logif(struct pfctl *, char *); -int parse_rules(FILE *, struct pfctl *); -int parse_flags(char *); +int parse_rules(FILE *, struct pfctl *); +int parse_flags(char *); -void print_rule(struct pf_rule *); -void print_nat(struct pf_nat *); -void print_binat(struct pf_binat *); -void print_rdr(struct pf_rdr *); -void print_status(struct pf_status *); +void print_rule(struct pf_rule *); +void print_nat(struct pf_nat *); +void print_binat(struct pf_binat *); +void print_rdr(struct pf_rdr *); +void print_status(struct pf_status *); -int unmask(struct pf_addr *, u_int8_t); +int unmask(struct pf_addr *, sa_family_t); struct icmptypeent { char *name; |