summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2008-05-18 11:54:05 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2008-05-18 11:54:05 +0000
commit0fbafca9bb11a9e26f31986344984ea0ba0e8cc8 (patch)
tree438f018b02bf6029b035f5bc8c0129b6cb53c689 /sys
parent7acf7b87ca33910cd82ef1554fe47beedea34aac (diff)
KNF
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_pfsync.c8
-rw-r--r--sys/net/pf.c98
-rw-r--r--sys/net/pf_if.c4
-rw-r--r--sys/net/pf_ioctl.c35
-rw-r--r--sys/net/pfvar.h14
5 files changed, 80 insertions, 79 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index 537549b2c9f..8c70ab56079 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.90 2008/05/06 03:45:21 mpf Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.91 2008/05/18 11:54:04 mcbride Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -590,7 +590,7 @@ pfsync_input(struct mbuf *m, ...)
}
continue;
}
- pfsync_alloc_scrub_memory(&sp->dst, &st->dst);
+ pfsync_alloc_scrub_memory(&sp->dst, &st->dst);
pf_state_peer_ntoh(&sp->src, &st->src);
pf_state_peer_ntoh(&sp->dst, &st->dst);
st->expire = ntohl(sp->expire) + time_second;
@@ -717,7 +717,7 @@ pfsync_input(struct mbuf *m, ...)
PFSYNC_FLAG_STALE);
continue;
}
- pfsync_alloc_scrub_memory(&up->dst, &st->dst);
+ pfsync_alloc_scrub_memory(&up->dst, &st->dst);
pf_state_peer_ntoh(&up->src, &st->src);
pf_state_peer_ntoh(&up->dst, &st->dst);
st->expire = ntohl(up->expire) + time_second;
@@ -1716,7 +1716,7 @@ pfsync_update_tdb(struct tdb *tdb, int output)
for (i = 0; !pt && i < h->count; i++) {
if (tdb->tdb_spi == u->spi &&
tdb->tdb_sproto == u->sproto &&
- !bcmp(&tdb->tdb_dst, &u->dst,
+ !bcmp(&tdb->tdb_dst, &u->dst,
SA_LEN(&u->dst.sa))) {
pt = u;
pt->updates++;
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 9245ae03b81..b204c420630 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.574 2008/05/15 19:40:37 markus Exp $ */
+/* $OpenBSD: pf.c,v 1.575 2008/05/18 11:54:04 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -531,7 +531,7 @@ struct pf_state *
pf_find_state_byid(struct pf_state_cmp *key)
{
pf_status.fcounters[FCNT_STATE_SEARCH]++;
-
+
return (RB_FIND(pf_state_tree_id, &tree_id, (struct pf_state *)key));
}
@@ -700,12 +700,12 @@ pf_src_connlimit(struct pf_state **state)
if (sk->af ==
(*state)->state_key->af &&
(((*state)->state_key->direction ==
- PF_OUT &&
+ PF_OUT &&
PF_AEQ(&(*state)->src_node->addr,
- &sk->lan.addr, sk->af)) ||
+ &sk->lan.addr, sk->af)) ||
((*state)->state_key->direction == PF_IN &&
PF_AEQ(&(*state)->src_node->addr,
- &sk->ext.addr, sk->af))) &&
+ &sk->ext.addr, sk->af))) &&
((*state)->rule.ptr->flush &
PF_FLUSH_GLOBAL ||
(*state)->rule.ptr == st->rule.ptr)) {
@@ -937,33 +937,33 @@ pf_state_expires(const struct pf_state *state)
void
pf_purge_expired_src_nodes(int waslocked)
{
- struct pf_src_node *cur, *next;
- int locked = waslocked;
-
- for (cur = RB_MIN(pf_src_tree, &tree_src_tracking); cur; cur = next) {
- next = RB_NEXT(pf_src_tree, &tree_src_tracking, cur);
-
- if (cur->states <= 0 && cur->expire <= time_second) {
- if (! locked) {
- rw_enter_write(&pf_consistency_lock);
- next = RB_NEXT(pf_src_tree,
- &tree_src_tracking, cur);
- locked = 1;
- }
- if (cur->rule.ptr != NULL) {
- cur->rule.ptr->src_nodes--;
- if (cur->rule.ptr->states_cur <= 0 &&
- cur->rule.ptr->max_src_nodes <= 0)
- pf_rm_rule(NULL, cur->rule.ptr);
- }
- RB_REMOVE(pf_src_tree, &tree_src_tracking, cur);
- pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++;
- pf_status.src_nodes--;
- pool_put(&pf_src_tree_pl, cur);
- }
- }
-
- if (locked && !waslocked)
+ struct pf_src_node *cur, *next;
+ int locked = waslocked;
+
+ for (cur = RB_MIN(pf_src_tree, &tree_src_tracking); cur; cur = next) {
+ next = RB_NEXT(pf_src_tree, &tree_src_tracking, cur);
+
+ if (cur->states <= 0 && cur->expire <= time_second) {
+ if (! locked) {
+ rw_enter_write(&pf_consistency_lock);
+ next = RB_NEXT(pf_src_tree,
+ &tree_src_tracking, cur);
+ locked = 1;
+ }
+ if (cur->rule.ptr != NULL) {
+ cur->rule.ptr->src_nodes--;
+ if (cur->rule.ptr->states_cur <= 0 &&
+ cur->rule.ptr->max_src_nodes <= 0)
+ pf_rm_rule(NULL, cur->rule.ptr);
+ }
+ RB_REMOVE(pf_src_tree, &tree_src_tracking, cur);
+ pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++;
+ pf_status.src_nodes--;
+ pool_put(&pf_src_tree_pl, cur);
+ }
+ }
+
+ if (locked && !waslocked)
rw_exit_write(&pf_consistency_lock);
}
@@ -1053,7 +1053,7 @@ pf_purge_expired_states(u_int32_t maxcheck)
{
static struct pf_state *cur = NULL;
struct pf_state *next;
- int locked = 0;
+ int locked = 0;
while (maxcheck--) {
/* wrap to start of list when we hit the end */
@@ -5462,29 +5462,29 @@ pf_check_proto_cksum(struct mbuf *m, int off, int len, u_int8_t p,
struct pf_divert *
pf_find_divert(struct mbuf *m)
{
- struct m_tag *mtag;
+ struct m_tag *mtag;
- if ((mtag = m_tag_find(m, PACKET_TAG_PF_DIVERT, NULL)) == NULL)
- return (NULL);
+ if ((mtag = m_tag_find(m, PACKET_TAG_PF_DIVERT, NULL)) == NULL)
+ return (NULL);
- return ((struct pf_divert *)(mtag + 1));
+ return ((struct pf_divert *)(mtag + 1));
}
struct pf_divert *
pf_get_divert(struct mbuf *m)
{
- struct m_tag *mtag;
-
- if ((mtag = m_tag_find(m, PACKET_TAG_PF_DIVERT, NULL)) == NULL) {
- mtag = m_tag_get(PACKET_TAG_PF_DIVERT, sizeof(struct pf_divert),
- M_NOWAIT);
- if (mtag == NULL)
- return (NULL);
- bzero(mtag + 1, sizeof(struct pf_divert));
- m_tag_prepend(m, mtag);
- }
-
- return ((struct pf_divert *)(mtag + 1));
+ struct m_tag *mtag;
+
+ if ((mtag = m_tag_find(m, PACKET_TAG_PF_DIVERT, NULL)) == NULL) {
+ mtag = m_tag_get(PACKET_TAG_PF_DIVERT, sizeof(struct pf_divert),
+ M_NOWAIT);
+ if (mtag == NULL)
+ return (NULL);
+ bzero(mtag + 1, sizeof(struct pf_divert));
+ m_tag_prepend(m, mtag);
+ }
+
+ return ((struct pf_divert *)(mtag + 1));
}
#ifdef INET
diff --git a/sys/net/pf_if.c b/sys/net/pf_if.c
index a3f62e1ea52..c38ddbc1527 100644
--- a/sys/net/pf_if.c
+++ b/sys/net/pf_if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_if.c,v 1.51 2007/11/07 17:28:40 mpf Exp $ */
+/* $OpenBSD: pf_if.c,v 1.52 2008/05/18 11:54:04 mcbride Exp $ */
/*
* Copyright 2005 Henning Brauer <henning@openbsd.org>
@@ -606,7 +606,7 @@ void
pfi_update_status(const char *name, struct pf_status *pfs)
{
struct pfi_kif *p;
- struct pfi_kif_cmp key;
+ struct pfi_kif_cmp key;
struct ifg_member p_member, *ifgm;
TAILQ_HEAD(, ifg_member) ifg_members;
int i, j, k, s;
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c
index 5243d3aea4e..63065d66019 100644
--- a/sys/net/pf_ioctl.c
+++ b/sys/net/pf_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_ioctl.c,v 1.196 2008/05/09 13:59:31 mpf Exp $ */
+/* $OpenBSD: pf_ioctl.c,v 1.197 2008/05/18 11:54:04 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -147,7 +147,7 @@ pfattach(int num)
"pfsrctrpl", NULL);
pool_init(&pf_state_pl, sizeof(struct pf_state), 0, 0, 0, "pfstatepl",
NULL);
- pool_init(&pf_state_key_pl, sizeof(struct pf_state_key), 0, 0, 0,
+ pool_init(&pf_state_key_pl, sizeof(struct pf_state_key), 0, 0, 0,
"pfstatekeypl", NULL);
pool_init(&pf_altq_pl, sizeof(struct pf_altq), 0, 0, 0, "pfaltqpl",
&pool_allocator_nointr);
@@ -843,7 +843,7 @@ pf_commit_rules(u_int32_t ticket, int rs_num, char *anchor)
void
pf_state_export(struct pfsync_state *sp, struct pf_state_key *sk,
- struct pf_state *s)
+ struct pf_state *s)
{
int secs = time_second;
bzero(sp, sizeof(struct pfsync_state));
@@ -894,7 +894,7 @@ pf_state_export(struct pfsync_state *sp, struct pf_state_key *sk,
void
pf_state_import(struct pfsync_state *sp, struct pf_state_key *sk,
- struct pf_state *s)
+ struct pf_state *s)
{
/* copy to state key */
sk->lan.addr = sp->lan.addr;
@@ -1067,7 +1067,8 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
}
return (EACCES);
case DIOCGETRULE:
- if (((struct pfioc_rule *)addr)->action == PF_GET_CLR_CNTR)
+ if (((struct pfioc_rule *)addr)->action ==
+ PF_GET_CLR_CNTR)
return (EACCES);
break;
default:
@@ -1651,7 +1652,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
case DIOCADDSTATE: {
struct pfioc_state *ps = (struct pfioc_state *)addr;
- struct pfsync_state *sp = &ps->state;
+ struct pfsync_state *sp = &ps->state;
struct pf_state *s;
struct pf_state_key *sk;
struct pfi_kif *kif;
@@ -2867,22 +2868,22 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
case DIOCKILLSRCNODES: {
struct pf_src_node *sn;
struct pf_state *s;
- struct pfioc_src_node_kill *psnk = \
- (struct pfioc_src_node_kill *) addr;
+ struct pfioc_src_node_kill *psnk =
+ (struct pfioc_src_node_kill *)addr;
u_int killed = 0;
RB_FOREACH(sn, pf_src_tree, &tree_src_tracking) {
- if (PF_MATCHA(psnk->psnk_src.neg, \
- &psnk->psnk_src.addr.v.a.addr, \
- &psnk->psnk_src.addr.v.a.mask, \
- &sn->addr, sn->af) &&
- PF_MATCHA(psnk->psnk_dst.neg, \
- &psnk->psnk_dst.addr.v.a.addr, \
- &psnk->psnk_dst.addr.v.a.mask, \
- &sn->raddr, sn->af)) {
+ if (PF_MATCHA(psnk->psnk_src.neg,
+ &psnk->psnk_src.addr.v.a.addr,
+ &psnk->psnk_src.addr.v.a.mask,
+ &sn->addr, sn->af) &&
+ PF_MATCHA(psnk->psnk_dst.neg,
+ &psnk->psnk_dst.addr.v.a.addr,
+ &psnk->psnk_dst.addr.v.a.mask,
+ &sn->raddr, sn->af)) {
/* Handle state to src_node linkage */
if (sn->states != 0) {
- RB_FOREACH(s, pf_state_tree_id,
+ RB_FOREACH(s, pf_state_tree_id,
&tree_id) {
if (s->src_node == sn)
s->src_node = NULL;
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index d9e27c57787..eedbdcf8614 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfvar.h,v 1.266 2008/05/09 13:59:31 mpf Exp $ */
+/* $OpenBSD: pfvar.h,v 1.267 2008/05/18 11:54:04 mcbride Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -328,10 +328,10 @@ struct pfi_dynaddr {
((aw)->type == PF_ADDR_TABLE && \
!pfr_match_addr((aw)->p.tbl, (x), (af))) || \
((aw)->type == PF_ADDR_DYNIFTL && \
- !pfi_match_addr((aw)->p.dyn, (x), (af))) || \
+ !pfi_match_addr((aw)->p.dyn, (x), (af))) || \
((aw)->type == PF_ADDR_RANGE && \
!pf_match_addr_range(&(aw)->v.a.addr, \
- &(aw)->v.a.mask, (x), (af))) || \
+ &(aw)->v.a.mask, (x), (af))) || \
((aw)->type == PF_ADDR_ADDRMASK && \
!PF_AZERO(&(aw)->v.a.mask, (af)) && \
!PF_MATCHA(0, &(aw)->v.a.addr, \
@@ -772,7 +772,7 @@ struct pf_state {
struct pfsync_state_scrub {
u_int16_t pfss_flags;
u_int8_t pfss_ttl; /* stashed TTL */
-#define PFSYNC_SCRUB_FLAG_VALID 0x01
+#define PFSYNC_SCRUB_FLAG_VALID 0x01
u_int8_t scrub_flag;
u_int32_t pfss_ts_mod; /* timestamp modulation */
} __packed;
@@ -822,7 +822,7 @@ struct pfsync_state {
u_int8_t updates;
} __packed;
-#define PFSYNC_FLAG_COMPRESS 0x01
+#define PFSYNC_FLAG_COMPRESS 0x01
#define PFSYNC_FLAG_STALE 0x02
#define PFSYNC_FLAG_SRCNODE 0x04
#define PFSYNC_FLAG_NATSRCNODE 0x08
@@ -837,7 +837,7 @@ struct pfsync_state {
(d)->state = (s)->state; \
(d)->wscale = (s)->wscale; \
if ((s)->scrub) { \
- (d)->scrub.pfss_flags = \
+ (d)->scrub.pfss_flags = \
(s)->scrub->pfss_flags & PFSS_TIMESTAMP; \
(d)->scrub.pfss_ttl = (s)->scrub->pfss_ttl; \
(d)->scrub.pfss_ts_mod = (s)->scrub->pfss_ts_mod; \
@@ -853,7 +853,7 @@ struct pfsync_state {
(d)->mss = ntohs((s)->mss); \
(d)->state = (s)->state; \
(d)->wscale = (s)->wscale; \
- if ((s)->scrub.scrub_flag == PFSYNC_SCRUB_FLAG_VALID && \
+ if ((s)->scrub.scrub_flag == PFSYNC_SCRUB_FLAG_VALID && \
(d)->scrub != NULL) { \
(d)->scrub->pfss_flags = \
ntohs((s)->scrub.pfss_flags) & PFSS_TIMESTAMP; \