summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-03-09 21:44:42 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-03-09 21:44:42 +0000
commitd5341269e6abb2e11f628acb9460700dfc6eb316 (patch)
tree8b4d51c368baf1e0cd1d9e554f1db6386750c6ed
parente30ecfb228d856d044910932b3c4161a09478f46 (diff)
KNF, ok cedric@ deraadt@
-rw-r--r--sys/net/pf.c17
-rw-r--r--sys/net/pf_if.c8
-rw-r--r--sys/net/pf_ioctl.c10
-rw-r--r--sys/net/pf_norm.c4
-rw-r--r--sys/net/pf_table.c22
5 files changed, 31 insertions, 30 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index e82d9eacedb..5a0fff6237f 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.428 2004/02/24 12:09:34 mcbride Exp $ */
+/* $OpenBSD: pf.c,v 1.429 2004/03/09 21:44:40 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -483,7 +483,7 @@ struct pf_state *
pf_find_state_byid(struct pf_state *key)
{
pf_status.fcounters[FCNT_STATE_SEARCH]++;
- return RB_FIND(pf_state_tree_id, &tree_id, key);
+ return (RB_FIND(pf_state_tree_id, &tree_id, key));
}
struct pf_state *
@@ -1862,7 +1862,7 @@ pf_map_addr(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr,
if (pfr_pool_get(rpool->cur->addr.p.tbl,
&rpool->tblidx, &rpool->counter,
&raddr, &rmask, af)) {
- /* table contain no address of type 'af' */
+ /* table contains no address of type 'af' */
if (rpool->cur != acur)
goto try_next;
return (1);
@@ -1872,7 +1872,7 @@ pf_map_addr(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr,
if (pfr_pool_get(rpool->cur->addr.p.dyn->pfid_kt,
&rpool->tblidx, &rpool->counter,
&raddr, &rmask, af)) {
- /* table contain no address of type 'af' */
+ /* table contains no address of type 'af' */
if (rpool->cur != acur)
goto try_next;
return (1);
@@ -1980,7 +1980,6 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_rule *r,
case PF_POOL_BITMASK:
default:
return (1);
- break;
}
} while (! PF_AEQ(&init_addr, naddr, af) );
@@ -2084,7 +2083,6 @@ pf_get_translation(struct pf_pdesc *pd, struct mbuf *m, int off, int direction,
case PF_NOBINAT:
case PF_NORDR:
return (NULL);
- break;
case PF_NAT:
if (pf_get_sport(pd->af, pd->proto, r, saddr,
daddr, dport, naddr, nport, r->rpool.proxy_port[0],
@@ -2182,7 +2180,6 @@ pf_get_translation(struct pf_pdesc *pd, struct mbuf *m, int off, int direction,
}
default:
return (NULL);
- break;
}
}
@@ -2281,13 +2278,14 @@ pf_get_wscale(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af)
if (wscale > TCP_MAX_WINSHIFT)
wscale = TCP_MAX_WINSHIFT;
wscale |= PF_WSCALE_FLAG;
- /* fallthrough */
+ /* FALLTHROUGH */
default:
optlen = opt[1];
if (optlen < 2)
optlen = 2;
hlen -= optlen;
opt += optlen;
+ break;
}
}
return (wscale);
@@ -2317,13 +2315,14 @@ pf_get_mss(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af)
break;
case TCPOPT_MAXSEG:
bcopy((caddr_t)(opt + 2), (caddr_t)&mss, 2);
- /* fallthrough */
+ /* FALLTHROUGH */
default:
optlen = opt[1];
if (optlen < 2)
optlen = 2;
hlen -= optlen;
opt += optlen;
+ break;
}
}
return (mss);
diff --git a/sys/net/pf_if.c b/sys/net/pf_if.c
index a6228e010c4..9e63404f6e7 100644
--- a/sys/net/pf_if.c
+++ b/sys/net/pf_if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_if.c,v 1.9 2004/02/20 19:22:03 mcbride Exp $ */
+/* $OpenBSD: pf_if.c,v 1.10 2004/03/09 21:44:41 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -544,7 +544,7 @@ pfi_kifaddr_update(void *v)
int
pfi_if_compare(struct pfi_kif *p, struct pfi_kif *q)
{
- return strncmp(p->pfik_name, q->pfik_name, IFNAMSIZ);
+ return (strncmp(p->pfik_name, q->pfik_name, IFNAMSIZ));
}
struct pfi_kif *
@@ -826,7 +826,7 @@ pfi_match_addr(struct pfi_dynaddr *dyn, struct pf_addr *a, sa_family_t af)
return (PF_MATCHA(0, &dyn->pfid_addr4,
&dyn->pfid_mask4, a, AF_INET));
default:
- return pfr_match_addr(dyn->pfid_kt, a, AF_INET);
+ return (pfr_match_addr(dyn->pfid_kt, a, AF_INET));
}
} else {
switch (dyn->pfid_acnt6) {
@@ -838,7 +838,7 @@ pfi_match_addr(struct pfi_dynaddr *dyn, struct pf_addr *a, sa_family_t af)
return (PF_MATCHA(0, &dyn->pfid_addr6,
&dyn->pfid_mask6, a, AF_INET6));
default:
- return pfr_match_addr(dyn->pfid_kt, a, AF_INET6);
+ return (pfr_match_addr(dyn->pfid_kt, a, AF_INET6));
}
}
}
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c
index 43b1e2b9932..a86f09d843d 100644
--- a/sys/net/pf_ioctl.c
+++ b/sys/net/pf_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_ioctl.c,v 1.108 2004/02/20 19:22:03 mcbride Exp $ */
+/* $OpenBSD: pf_ioctl.c,v 1.109 2004/03/09 21:44:41 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -102,13 +102,13 @@ struct pf_rule pf_default_rule;
#define TAGID_MAX 50000
TAILQ_HEAD(pf_tags, pf_tagname) pf_tags = TAILQ_HEAD_INITIALIZER(pf_tags),
- pf_qids = TAILQ_HEAD_INITIALIZER(pf_qids);
+ pf_qids = TAILQ_HEAD_INITIALIZER(pf_qids);
#if (PF_QNAME_SIZE != PF_TAG_NAME_SIZE)
#error PF_QNAME_SIZE must be equal to PF_TAG_NAME_SIZE
#endif
static u_int16_t tagname2tag(struct pf_tags *, char *);
-static void tag2tagname(struct pf_tags *, u_int16_t, char *);
+static void tag2tagname(struct pf_tags *, u_int16_t, char *);
static void tag_unref(struct pf_tags *, u_int16_t);
#define DPFPRINTF(n, x) if (pf_status.debug >= (n)) printf x
@@ -508,7 +508,7 @@ tagname2tag(struct pf_tags *head, char *tagname)
}
static void
-tag2tagname(struct pf_tags *head, u_int16_t tagid, char *p)
+tag2tagname(struct pf_tags *head, u_int16_t tagid, char *p)
{
struct pf_tagname *tag;
@@ -1173,7 +1173,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
error = EBUSY;
else if (newrule->pqname[0] != 0) {
if ((newrule->pqid =
- pf_qname2qid(newrule->pqname)) == 0)
+ pf_qname2qid(newrule->pqname)) == 0)
error = EBUSY;
} else
newrule->pqid = newrule->qid;
diff --git a/sys/net/pf_norm.c b/sys/net/pf_norm.c
index c56fb6e5377..d2c6456d653 100644
--- a/sys/net/pf_norm.c
+++ b/sys/net/pf_norm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_norm.c,v 1.79 2004/02/10 18:49:10 henning Exp $ */
+/* $OpenBSD: pf_norm.c,v 1.80 2004/03/09 21:44:41 mcbride Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
@@ -1338,7 +1338,7 @@ pf_normalize_tcp_init(struct mbuf *m, int off, struct pf_pdesc *pd,
* the connections. They must all set an enabled bit in pfss_flags
*/
if ((th->th_flags & TH_SYN) == 0)
- return 0;
+ return (0);
if (th->th_off > (sizeof(struct tcphdr) >> 2) && src->scrub &&
diff --git a/sys/net/pf_table.c b/sys/net/pf_table.c
index 5b9d781b452..42d4cee0b7c 100644
--- a/sys/net/pf_table.c
+++ b/sys/net/pf_table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_table.c,v 1.46 2004/02/10 22:42:57 dhartmei Exp $ */
+/* $OpenBSD: pf_table.c,v 1.47 2004/03/09 21:44:41 mcbride Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@@ -978,7 +978,7 @@ pfr_walktree(struct radix_node *rn, void *arg)
case PFRW_SWEEP:
if (ke->pfrke_mark)
break;
- /* fall trough */
+ /* FALLTHROUGH */
case PFRW_ENQUEUE:
SLIST_INSERT_HEAD(w->pfrw_workq, ke, pfrke_workq);
w->pfrw_cnt++;
@@ -1038,6 +1038,7 @@ pfr_walktree(struct radix_node *rn, void *arg)
w->pfrw_dyn->pfid_mask6 = *SUNION2PF(
&pfr_mask, AF_INET6);
}
+ break;
}
return (0);
}
@@ -1859,15 +1860,16 @@ pfr_ktable_compare(struct pfr_ktable *p, struct pfr_ktable *q)
if ((d = strncmp(p->pfrkt_anchor, q->pfrkt_anchor,
PF_ANCHOR_NAME_SIZE)))
return (d);
- return strncmp(p->pfrkt_ruleset, q->pfrkt_ruleset,
- PF_RULESET_NAME_SIZE);
+ return (strncmp(p->pfrkt_ruleset, q->pfrkt_ruleset,
+ PF_RULESET_NAME_SIZE));
}
struct pfr_ktable *
pfr_lookup_table(struct pfr_table *tbl)
{
/* struct pfr_ktable start like a struct pfr_table */
- return RB_FIND(pfr_ktablehead, &pfr_ktables, (struct pfr_ktable *)tbl);
+ return (RB_FIND(pfr_ktablehead, &pfr_ktables,
+ (struct pfr_ktable *)tbl));
}
int
@@ -1879,7 +1881,7 @@ pfr_match_addr(struct pfr_ktable *kt, struct pf_addr *a, sa_family_t af)
if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE) && kt->pfrkt_root != NULL)
kt = kt->pfrkt_root;
if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
- return 0;
+ return (0);
switch (af) {
case AF_INET:
@@ -1977,7 +1979,7 @@ pfr_attach_table(struct pf_ruleset *rs, char *name)
}
if (!kt->pfrkt_refcnt[PFR_REFCNT_RULE]++)
pfr_setflags_ktable(kt, kt->pfrkt_flags|PFR_TFLAG_REFERENCED);
- return kt;
+ return (kt);
}
void
@@ -2080,12 +2082,12 @@ pfr_kentry_byidx(struct pfr_ktable *kt, int idx, int af)
switch (af) {
case AF_INET:
rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
- return w.pfrw_kentry;
+ return (w.pfrw_kentry);
case AF_INET6:
rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w);
- return w.pfrw_kentry;
+ return (w.pfrw_kentry);
default:
- return NULL;
+ return (NULL);
}
}