diff options
author | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2003-01-09 15:58:36 +0000 |
---|---|---|
committer | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2003-01-09 15:58:36 +0000 |
commit | c47d7f93536d14c6893f5d473cc90350959c804a (patch) | |
tree | 7286854d03a553a91dc03ae0f03950c4391a570d | |
parent | 52dbecd0d22e71fd3b999b6e655d8a1633ec2c8b (diff) |
(whitespace) KNF, re-fold -w 80
-rw-r--r-- | sys/net/pf.c | 52 | ||||
-rw-r--r-- | sys/net/pf_ioctl.c | 29 | ||||
-rw-r--r-- | sys/net/pf_norm.c | 8 | ||||
-rw-r--r-- | sys/net/pf_table.c | 10 | ||||
-rw-r--r-- | sys/net/pfvar.h | 4 |
5 files changed, 58 insertions, 45 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c index cdb47e555eb..844dfa14e39 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.301 2003/01/09 10:40:44 cedric Exp $ */ +/* $OpenBSD: pf.c,v 1.302 2003/01/09 15:58:35 dhartmei Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -783,11 +783,13 @@ pf_calc_skip_steps(struct pf_rulequeue *rules) prev->src.addr.type == PF_ADDR_DYNIFTL || cur->src.addr.type == PF_ADDR_TABLE || prev->src.addr.type == PF_ADDR_TABLE || - cur->src.not != prev->src.not || + cur->src.not != prev->src.not || (cur->src.addr.type == PF_ADDR_NOROUTE) != (prev->src.addr.type == PF_ADDR_NOROUTE) || - !PF_AEQ(&cur->src.addr.v.a.addr, &prev->src.addr.v.a.addr, 0) || - !PF_AEQ(&cur->src.addr.v.a.mask, &prev->src.addr.v.a.mask, 0)) + !PF_AEQ(&cur->src.addr.v.a.addr, + &prev->src.addr.v.a.addr, 0) || + !PF_AEQ(&cur->src.addr.v.a.mask, + &prev->src.addr.v.a.mask, 0)) PF_SET_SKIP_STEPS(PF_SKIP_SRC_ADDR); if (cur->src.port[0] != prev->src.port[0] || cur->src.port[1] != prev->src.port[1] || @@ -797,11 +799,13 @@ pf_calc_skip_steps(struct pf_rulequeue *rules) prev->dst.addr.type == PF_ADDR_DYNIFTL || cur->dst.addr.type == PF_ADDR_TABLE || prev->dst.addr.type == PF_ADDR_TABLE || - cur->dst.not != prev->dst.not || + cur->dst.not != prev->dst.not || (cur->dst.addr.type == PF_ADDR_NOROUTE) != (prev->dst.addr.type == PF_ADDR_NOROUTE) || - !PF_AEQ(&cur->dst.addr.v.a.addr, &prev->dst.addr.v.a.addr, 0) || - !PF_AEQ(&cur->dst.addr.v.a.mask, &prev->dst.addr.v.a.mask, 0)) + !PF_AEQ(&cur->dst.addr.v.a.addr, + &prev->dst.addr.v.a.addr, 0) || + !PF_AEQ(&cur->dst.addr.v.a.mask, + &prev->dst.addr.v.a.mask, 0)) PF_SET_SKIP_STEPS(PF_SKIP_DST_ADDR); if (cur->dst.port[0] != prev->dst.port[0] || cur->dst.port[1] != prev->dst.port[1] || @@ -896,7 +900,7 @@ pf_change_a(u_int32_t *a, u_int16_t *c, u_int32_t an, u_int8_t u) *a = an; *c = pf_cksum_fixup(pf_cksum_fixup(*c, ao / 65536, an / 65536, u), - ao % 65536, an % 65536, u); + ao % 65536, an % 65536, u); } #ifdef INET6 @@ -1125,7 +1129,7 @@ pf_send_reset(int off, struct tcphdr *th, struct pf_pdesc *pd, sa_family_t af, h2->ip_len = len; h2->ip_off = ip_mtudisc ? IP_DF : 0; ip_output(m, (void *)NULL, (void *)NULL, 0, (void *)NULL, - (void *)NULL); + (void *)NULL); break; #endif /* INET */ #ifdef INET6 @@ -1377,16 +1381,16 @@ pf_addr_inc(struct pf_addr *addr, u_int8_t af) #endif /* INET6 */ #define mix(a,b,c) \ - do { \ - a -= b; a -= c; a ^= (c >> 13); \ - b -= c; b -= a; b ^= (a << 8); \ - c -= a; c -= b; c ^= (b >> 13); \ - a -= b; a -= c; a ^= (c >> 12); \ - b -= c; b -= a; b ^= (a << 16); \ - c -= a; c -= b; c ^= (b >> 5); \ - a -= b; a -= c; a ^= (c >> 3); \ - b -= c; b -= a; b ^= (a << 10); \ - c -= a; c -= b; c ^= (b >> 15); \ + do { \ + a -= b; a -= c; a ^= (c >> 13); \ + b -= c; b -= a; b ^= (a << 8); \ + c -= a; c -= b; c ^= (b >> 13); \ + a -= b; a -= c; a ^= (c >> 12); \ + b -= c; b -= a; b ^= (a << 16); \ + c -= a; c -= b; c ^= (b >> 5); \ + a -= b; a -= c; a ^= (c >> 3); \ + b -= c; b -= a; b ^= (a << 10); \ + c -= a; c -= b; c ^= (b >> 15); \ } while(0) /* @@ -1729,7 +1733,8 @@ pf_get_translation(int direction, struct ifnet *ifp, u_int8_t proto, r->src.addr.p.dyn->undefined) return (NULL); else - PF_POOLMASK(naddr, &r->src.addr.v.a.addr, + PF_POOLMASK(naddr, + &r->src.addr.v.a.addr, &r->src.addr.v.a.mask, saddr, af); break; } @@ -1741,8 +1746,8 @@ pf_get_translation(int direction, struct ifnet *ifp, u_int8_t proto, if (r->dst.port_op == PF_OP_RRG) { u_int32_t tmp_nport; - tmp_nport = ntohs(r->rpool.proxy_port[0]) - + (ntohs(dport) - ntohs(r->dst.port[0])); + tmp_nport = ntohs(r->rpool.proxy_port[0]) + + (ntohs(dport) - ntohs(r->dst.port[0])); /* wrap around if necessary */ if (tmp_nport > 65535) tmp_nport -= 65535; @@ -3823,7 +3828,8 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, goto bad; m_tag_prepend(m0, mtag); if (m0->m_len < sizeof(struct ip)) - panic("pf_route: m0->m_len < sizeof(struct ip)"); + panic("pf_route: m0->m_len < " + "sizeof(struct ip)"); ip = mtod(m0, struct ip *); } } diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index d1c2e0fb39e..9510391cff6 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.46 2003/01/09 10:40:44 cedric Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.47 2003/01/09 15:58:35 dhartmei Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -824,12 +824,14 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) s = splsoftnet(); if (pcr->action == PF_CHANGE_ADD_HEAD) - oldrule = TAILQ_FIRST(ruleset->rules[rs_num].active.ptr); + oldrule = TAILQ_FIRST( + ruleset->rules[rs_num].active.ptr); else if (pcr->action == PF_CHANGE_ADD_TAIL) - oldrule = TAILQ_LAST(ruleset->rules[rs_num].active.ptr, - pf_rulequeue); + oldrule = TAILQ_LAST( + ruleset->rules[rs_num].active.ptr, pf_rulequeue); else { - oldrule = TAILQ_FIRST(ruleset->rules[rs_num].active.ptr); + oldrule = TAILQ_FIRST( + ruleset->rules[rs_num].active.ptr); while ((oldrule != NULL) && (oldrule->nr != pcr->nr)) oldrule = TAILQ_NEXT(oldrule, entries); if (oldrule == NULL) { @@ -901,10 +903,14 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) st = n->state; if ((!psk->psk_af || st->af == psk->psk_af) && (!psk->psk_proto || psk->psk_proto == st->proto) && - PF_MATCHA(psk->psk_src.not, &psk->psk_src.addr.v.a.addr, - &psk->psk_src.addr.v.a.mask, &st->lan.addr, st->af) && - PF_MATCHA(psk->psk_dst.not, &psk->psk_dst.addr.v.a.addr, - &psk->psk_dst.addr.v.a.mask, &st->ext.addr, st->af) && + PF_MATCHA(psk->psk_src.not, + &psk->psk_src.addr.v.a.addr, + &psk->psk_src.addr.v.a.mask, &st->lan.addr, + st->af) && + PF_MATCHA(psk->psk_dst.not, + &psk->psk_dst.addr.v.a.addr, + &psk->psk_dst.addr.v.a.mask, &st->ext.addr, + st->af) && (psk->psk_src.port_op == 0 || pf_match_port(psk->psk_src.port_op, psk->psk_src.port[0], psk->psk_src.port[1], @@ -1100,7 +1106,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) else st = pf_find_state(&tree_lan_ext, &key); if (st != NULL) { - if (direction == PF_IN) { + if (direction == PF_IN) { PF_ACPY(&pnl->rsaddr, &st->lan.addr, st->af); pnl->rsport = st->lan.port; @@ -1640,7 +1646,8 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) } pool->cur = TAILQ_FIRST(&pool->list); - PF_ACPY(&pool->counter, &pool->cur->addr.addr.v.a.addr, pca->af); + PF_ACPY(&pool->counter, &pool->cur->addr.addr.v.a.addr, + pca->af); splx(s); break; } diff --git a/sys/net/pf_norm.c b/sys/net/pf_norm.c index 70c9cb0e627..894db02eb9b 100644 --- a/sys/net/pf_norm.c +++ b/sys/net/pf_norm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_norm.c,v 1.50 2003/01/07 00:21:07 dhartmei Exp $ */ +/* $OpenBSD: pf_norm.c,v 1.51 2003/01/09 15:58:35 dhartmei Exp $ */ /* * Copyright 2001 Niels Provos <provos@citi.umich.edu> @@ -192,7 +192,7 @@ pf_purge_expired_fragments(void) } /* - * Try to flush old fragments to make space for new ones + * Try to flush old fragments to make space for new ones */ void @@ -203,7 +203,7 @@ pf_flush_fragments(void) goal = pf_nfrents * 9 / 10; DPFPRINTF(("trying to free > %d frents\n", - pf_nfrents - goal)); + pf_nfrents - goal)); while (goal < pf_nfrents) { frag = TAILQ_LAST(&pf_fragqueue, pf_fragqueue); if (frag == NULL) @@ -214,7 +214,7 @@ pf_flush_fragments(void) goal = pf_ncache * 9 / 10; DPFPRINTF(("trying to free > %d cache entries\n", - pf_ncache - goal)); + pf_ncache - goal)); while (goal < pf_ncache) { frag = TAILQ_LAST(&pf_cachequeue, pf_cachequeue); if (frag == NULL) diff --git a/sys/net/pf_table.c b/sys/net/pf_table.c index ea5b037867a..38a93d73929 100644 --- a/sys/net/pf_table.c +++ b/sys/net/pf_table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_table.c,v 1.16 2003/01/09 10:40:44 cedric Exp $ */ +/* $OpenBSD: pf_table.c,v 1.17 2003/01/09 15:58:35 dhartmei Exp $ */ /* * Copyright (c) 2002 Cedric Berger @@ -45,7 +45,7 @@ #define ACCEPT_FLAGS(oklist) \ do { \ if ((flags & ~(oklist)) & \ - PFR_FLAG_ALLMASK) \ + PFR_FLAG_ALLMASK) \ return (EINVAL); \ } while (0) @@ -629,7 +629,7 @@ pfr_enqueue_addrs(struct pfr_ktable *kt, struct pfr_kentryworkq *workq, void pfr_mark_addrs(struct pfr_ktable *kt) { - struct pfr_walktree w; + struct pfr_walktree w; bzero(&w, sizeof(w)); w.pfrw_op = PFRW_MARK; @@ -1209,7 +1209,7 @@ pfr_ina_define(struct pfr_table *tbl, struct pfr_addr *addr, int size, { struct pfr_ktableworkq tableq; struct pfr_kentryworkq addrq; - struct pfr_ktable *kt, *shadow; + struct pfr_ktable *kt, *shadow; struct pfr_kentry *p; struct pfr_addr ad; int i, rv, xadd = 0, xaddr = 0; @@ -1277,7 +1277,7 @@ _bad: int pfr_ina_commit(int ticket, int *nadd, int *nchange, int flags) { - struct pfr_ktable *p; + struct pfr_ktable *p; struct pfr_ktableworkq workq; int s, xadd = 0, xchange = 0; long tzero = time.tv_sec; diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 99bb797910e..a2fcd83b2e6 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfvar.h,v 1.130 2003/01/09 10:40:45 cedric Exp $ */ +/* $OpenBSD: pfvar.h,v 1.131 2003/01/09 15:58:35 dhartmei Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -1022,7 +1022,7 @@ int pfr_tst_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); int pfr_ina_begin(int *, int *, int); int pfr_ina_commit(int, int *, int *, int); -int pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *, +int pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *, int *, int, int); extern struct pf_status pf_status; |