diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-02-10 18:49:11 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-02-10 18:49:11 +0000 |
commit | 5b11f4f02fed1ed871a96ef84126922a06426eee (patch) | |
tree | 52db0c0f47c9947d38212da4044c0869d1fe798d /sys/net/pf_if.c | |
parent | bbc5f88d5364551f51d8658f0b6321caaa3b3bef (diff) |
KNF
Diffstat (limited to 'sys/net/pf_if.c')
-rw-r--r-- | sys/net/pf_if.c | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/sys/net/pf_if.c b/sys/net/pf_if.c index c6b322021c2..85e68bae079 100644 --- a/sys/net/pf_if.c +++ b/sys/net/pf_if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_if.c,v 1.6 2004/02/09 13:27:50 cedric Exp $ */ +/* $OpenBSD: pf_if.c,v 1.7 2004/02/10 18:49:10 henning Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -55,12 +55,12 @@ #include <netinet/ip6.h> #endif /* INET6 */ -#define ACCEPT_FLAGS(oklist) \ - do { \ - if ((flags & ~(oklist)) & \ - PFI_FLAG_ALLMASK) \ - return (EINVAL); \ - } while (0) +#define ACCEPT_FLAGS(oklist) \ + do { \ + if ((flags & ~(oklist)) & \ + PFI_FLAG_ALLMASK) \ + return (EINVAL); \ + } while (0) #define senderr(e) do { rv = (e); goto _bad; } while (0) @@ -75,7 +75,7 @@ long pfi_update = 1; struct pfr_addr *pfi_buffer; int pfi_buffer_cnt; int pfi_buffer_max; -char pfi_reserved_anchor[PF_ANCHOR_NAME_SIZE] = +char pfi_reserved_anchor[PF_ANCHOR_NAME_SIZE] = PF_RESERVED_ANCHOR; char pfi_interface_ruleset[PF_RULESET_NAME_SIZE] = PF_INTERFACE_RULESET; @@ -91,7 +91,7 @@ struct pfi_kif *pfi_if_create(const char *, struct pfi_kif *, int); void pfi_copy_group(char *, const char *, int); void pfi_dynamic_drivers(void); void pfi_newgroup(const char *, int); -struct pfi_kif *pfi_lookup_if(const char *); +struct pfi_kif *pfi_lookup_if(const char *); int pfi_skip_if(const char *, struct pfi_kif *, int); int pfi_unmask(void *); void pfi_dohooks(struct pfi_kif *); @@ -130,7 +130,7 @@ void pfi_attach_ifnet(struct ifnet *ifp) { struct pfi_kif *p, *q, key; - int s; + int s; pfi_initialize(); s = splsoftnet(); @@ -185,8 +185,8 @@ pfi_attach_ifnet(struct ifnet *ifp) q = p->pfik_parent; p->pfik_ifp = ifp; p->pfik_flags |= PFI_IFLAG_ATTACHED; - p->pfik_ah_cookie = hook_establish(ifp->if_addrhooks, - 1, pfi_kifaddr_update, p); + p->pfik_ah_cookie = + hook_establish(ifp->if_addrhooks, 1, pfi_kifaddr_update, p); pfi_index2kif[ifp->if_index] = p; pfi_dohooks(p); splx(s); @@ -313,9 +313,8 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) if (aw->iflags & PFI_AFLAG_NOALIAS) strlcat(tblname, ":0", sizeof(tblname)); if (dyn->pfid_net != 128) - snprintf(tblname+strlen(tblname), - sizeof(tblname)-strlen(tblname), - "/%d", dyn->pfid_net); + snprintf(tblname + strlen(tblname), + sizeof(tblname) - strlen(tblname), "/%d", dyn->pfid_net); ruleset = pf_find_or_create_ruleset(pfi_reserved_anchor, pfi_interface_ruleset); if (ruleset == NULL) @@ -328,8 +327,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) dyn->pfid_kt->pfrkt_flags |= PFR_TFLAG_ACTIVE; dyn->pfid_iflags = aw->iflags; dyn->pfid_af = af; - dyn->pfid_hook_cookie = hook_establish( - dyn->pfid_kif->pfik_ah_head, 1, + dyn->pfid_hook_cookie = hook_establish(dyn->pfid_kif->pfik_ah_head, 1, pfi_dynaddr_update, dyn); if (dyn->pfid_hook_cookie == NULL) senderr(1); @@ -361,7 +359,7 @@ pfi_dynaddr_update(void *p) if (dyn == NULL || kif == NULL || kt == NULL) panic("pfi_dynaddr_update"); if (kt->pfrkt_larg != pfi_update) { - /* this table need to be brought up-to-date */ + /* this table needs to be brought up-to-date */ pfi_table_update(kt, kif, dyn->pfid_net, dyn->pfid_iflags); kt->pfrkt_larg = pfi_update; } @@ -466,15 +464,15 @@ pfi_address_add(struct sockaddr *sa, int af, int net) int new_max = pfi_buffer_max * 2; if (new_max > PFI_BUFFER_MAX) { - printf("pfi_address_add: address buffer full " - "(%d/%d)\n", pfi_buffer_cnt, PFI_BUFFER_MAX); + printf("pfi_address_add: address buffer full (%d/%d)\n", + pfi_buffer_cnt, PFI_BUFFER_MAX); return; } p = malloc(new_max * sizeof(*pfi_buffer), PFI_MTYPE, M_DONTWAIT); if (p == NULL) { printf("pfi_address_add: no memory to grow buffer " - " (%d/%d)\n", pfi_buffer_cnt, PFI_BUFFER_MAX); + "(%d/%d)\n", pfi_buffer_cnt, PFI_BUFFER_MAX); return; } memcpy(pfi_buffer, p, pfi_buffer_cnt * sizeof(*pfi_buffer)); @@ -497,10 +495,10 @@ pfi_address_add(struct sockaddr *sa, int af, int net) p->pfra_ip6addr.s6_addr16[1] = 0; } /* mask network address bits */ - if (net < 128) - ((caddr_t)p)[p->pfra_net/8] &= ~(0xFF >> (p->pfra_net%8)); - for (i = (p->pfra_net+7)/8; i < sizeof(p->pfra_u); i++) - ((caddr_t)p)[i] = 0; + if (net < 128) + ((caddr_t)p)[p->pfra_net/8] &= ~(0xFF >> (p->pfra_net%8)); + for (i = (p->pfra_net+7)/8; i < sizeof(p->pfra_u); i++) + ((caddr_t)p)[i] = 0; } void @@ -648,8 +646,8 @@ pfi_dynamic_drivers(void) dev->dv_cfdata->cf_driver->cd_name)) enabled[i] = 1; } - for (cf = cfdata; cf->cf_driver; cf++) { - if (cf->cf_driver->cd_class != DV_IFNET) + for (cf = cfdata; cf->cf_driver; cf++) { + if (cf->cf_driver->cd_class != DV_IFNET) continue; for (p = cf->cf_parents; p && *p >= 0; p++) { if ((drv = cfdata[*p].cf_driver) == NULL) @@ -794,8 +792,8 @@ pfi_unmask(void *addr) tmp = ntohl(m->addr32[j]); for (i = 31; tmp & (1 << i); --i) b++; - } - return (b); + } + return (b); } void |