diff options
author | rwatson <rwatson@FreeBSD.org> | 2007-05-10 15:58:48 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2007-05-10 15:58:48 +0000 |
commit | a25f94b5ae47af3cd364faa45ba35b34610eb8e9 (patch) | |
tree | 2075644406447dff1b0f6bb1567b5058f2fa628c | |
parent | a55a86971407200964b1955b343fe4aee3ae676f (diff) | |
download | FreeBSD-src-a25f94b5ae47af3cd364faa45ba35b34610eb8e9.zip FreeBSD-src-a25f94b5ae47af3cd364faa45ba35b34610eb8e9.tar.gz |
Move universally to ANSI C function declarations, with relatively
consistent style(9)-ish layout.
-rw-r--r-- | sys/netinet/if_ether.c | 29 | ||||
-rw-r--r-- | sys/netinet/in.c | 58 | ||||
-rw-r--r-- | sys/netinet/in_cksum.c | 4 | ||||
-rw-r--r-- | sys/netinet/in_gif.c | 26 | ||||
-rw-r--r-- | sys/netinet/in_rmx.c | 2 | ||||
-rw-r--r-- | sys/netinet/ip_divert.c | 9 | ||||
-rw-r--r-- | sys/netinet/ip_dummynet.c | 12 | ||||
-rw-r--r-- | sys/netinet/ip_ecn.c | 22 | ||||
-rw-r--r-- | sys/netinet/ip_encap.c | 49 | ||||
-rw-r--r-- | sys/netinet/ip_fw2.c | 41 | ||||
-rw-r--r-- | sys/netinet/ip_icmp.c | 23 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 34 | ||||
-rw-r--r-- | sys/netinet/ip_ipsec.c | 5 | ||||
-rw-r--r-- | sys/netinet/ip_mroute.c | 10 | ||||
-rw-r--r-- | sys/netinet/ip_options.c | 20 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 24 | ||||
-rw-r--r-- | sys/netinet/raw_ip.c | 7 | ||||
-rw-r--r-- | sys/netinet/tcp_input.c | 3 | ||||
-rw-r--r-- | sys/netinet/tcp_reass.c | 3 | ||||
-rw-r--r-- | sys/netinet/tcp_sack.c | 3 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 6 | ||||
-rw-r--r-- | sys/netinet/tcp_timer.c | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_timewait.c | 6 | ||||
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 2 |
24 files changed, 149 insertions, 253 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index cc4c3d4..6b5ada9 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -143,10 +143,7 @@ arptimer(void *arg) * Parallel to llc_rtrequest. */ static void -arp_rtrequest(req, rt, info) - int req; - struct rtentry *rt; - struct rt_addrinfo *info; +arp_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) { struct sockaddr *gate; struct llinfo_arp *la; @@ -308,10 +305,8 @@ arp_rtrequest(req, rt, info) * - arp header source ethernet address */ static void -arprequest(ifp, sip, tip, enaddr) - struct ifnet *ifp; - struct in_addr *sip, *tip; - u_char *enaddr; +arprequest(struct ifnet *ifp, struct in_addr *sip, struct in_addr *tip, + u_char *enaddr) { struct mbuf *m; struct arphdr *ah; @@ -358,7 +353,7 @@ arprequest(ifp, sip, tip, enaddr) */ int arpresolve(struct ifnet *ifp, struct rtentry *rt0, struct mbuf *m, - struct sockaddr *dst, u_char *desten) + struct sockaddr *dst, u_char *desten) { struct llinfo_arp *la = NULL; struct rtentry *rt = NULL; @@ -562,8 +557,7 @@ SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_permanent_modify, CTLFLAG_RW, static void -in_arpinput(m) - struct mbuf *m; +in_arpinput(struct mbuf *m) { struct arphdr *ah; struct ifnet *ifp = m->m_pkthdr.rcvif; @@ -894,9 +888,7 @@ drop: * Lookup or enter a new address in arptab. */ static struct rtentry * -arplookup(addr, create, proxy) - u_long addr; - int create, proxy; +arplookup(u_long addr, int create, int proxy) { struct rtentry *rt; struct sockaddr_inarp sin; @@ -943,9 +935,7 @@ arplookup(addr, create, proxy) } void -arp_ifinit(ifp, ifa) - struct ifnet *ifp; - struct ifaddr *ifa; +arp_ifinit(struct ifnet *ifp, struct ifaddr *ifa) { if (ntohl(IA_SIN(ifa)->sin_addr.s_addr) != INADDR_ANY) arprequest(ifp, &IA_SIN(ifa)->sin_addr, @@ -955,10 +945,7 @@ arp_ifinit(ifp, ifa) } void -arp_ifinit2(ifp, ifa, enaddr) - struct ifnet *ifp; - struct ifaddr *ifa; - u_char *enaddr; +arp_ifinit2(struct ifnet *ifp, struct ifaddr *ifa, u_char *enaddr) { if (ntohl(IA_SIN(ifa)->sin_addr.s_addr) != INADDR_ANY) arprequest(ifp, &IA_SIN(ifa)->sin_addr, diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 04a9161..dd20e00 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -95,8 +95,7 @@ extern struct inpcbinfo udbinfo; * Otherwise, it includes only the directly-connected (sub)nets. */ int -in_localaddr(in) - struct in_addr in; +in_localaddr(struct in_addr in) { register u_long i = ntohl(in.s_addr); register struct in_ifaddr *ia; @@ -118,8 +117,7 @@ in_localaddr(in) * on one of its interfaces. */ int -in_localip(in) - struct in_addr in; +in_localip(struct in_addr in) { struct in_ifaddr *ia; @@ -136,8 +134,7 @@ in_localip(in) * may be forwarded. */ int -in_canforward(in) - struct in_addr in; +in_canforward(struct in_addr in) { register u_long i = ntohl(in.s_addr); register u_long net; @@ -156,8 +153,7 @@ in_canforward(in) * Trim a mask in a sockaddr */ static void -in_socktrim(ap) -struct sockaddr_in *ap; +in_socktrim(struct sockaddr_in *ap) { register char *cplim = (char *) &ap->sin_addr; register char *cp = (char *) (&ap->sin_addr + 1); @@ -193,9 +189,7 @@ in_mask2len(mask) } static void -in_len2mask(mask, len) - struct in_addr *mask; - int len; +in_len2mask(struct in_addr *mask, int len) { int i; u_char *p; @@ -214,12 +208,8 @@ in_len2mask(mask, len) */ /* ARGSUSED */ int -in_control(so, cmd, data, ifp, td) - struct socket *so; - u_long cmd; - caddr_t data; - register struct ifnet *ifp; - struct thread *td; +in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, + struct thread *td) { register struct ifreq *ifr = (struct ifreq *)data; register struct in_ifaddr *ia = 0, *iap; @@ -558,12 +548,8 @@ in_control(so, cmd, data, ifp, td) * other values may be returned from in_ioctl() */ static int -in_lifaddr_ioctl(so, cmd, data, ifp, td) - struct socket *so; - u_long cmd; - caddr_t data; - struct ifnet *ifp; - struct thread *td; +in_lifaddr_ioctl(struct socket *so, u_long cmd, caddr_t data, + struct ifnet *ifp, struct thread *td) { struct if_laddrreq *iflr = (struct if_laddrreq *)data; struct ifaddr *ifa; @@ -723,10 +709,9 @@ in_lifaddr_ioctl(so, cmd, data, ifp, td) * Delete any existing route for an interface. */ void -in_ifscrub(ifp, ia) - register struct ifnet *ifp; - register struct in_ifaddr *ia; +in_ifscrub(struct ifnet *ifp, struct in_ifaddr *ia) { + in_scrubprefix(ia); } @@ -735,11 +720,8 @@ in_ifscrub(ifp, ia) * and routing table entry. */ static int -in_ifinit(ifp, ia, sin, scrub) - register struct ifnet *ifp; - register struct in_ifaddr *ia; - struct sockaddr_in *sin; - int scrub; +in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin, + int scrub) { register u_long i = ntohl(sin->sin_addr.s_addr); struct sockaddr_in oldaddr; @@ -834,9 +816,7 @@ in_ifinit(ifp, ia, sin, scrub) * accordingly. */ static int -in_addprefix(target, flags) - struct in_ifaddr *target; - int flags; +in_addprefix(struct in_ifaddr *target, int flags) { struct in_ifaddr *ia; struct in_addr prefix, mask, p, m; @@ -895,8 +875,7 @@ in_addprefix(target, flags) * otherwise. */ static int -in_scrubprefix(target) - struct in_ifaddr *target; +in_scrubprefix(struct in_ifaddr *target) { struct in_ifaddr *ia; struct in_addr prefix, mask, p; @@ -962,9 +941,7 @@ in_scrubprefix(target) * Return 1 if the address might be a local broadcast address. */ int -in_broadcast(in, ifp) - struct in_addr in; - struct ifnet *ifp; +in_broadcast(struct in_addr in, struct ifnet *ifp) { register struct ifaddr *ifa; u_long t; @@ -1175,8 +1152,7 @@ in_purgemaddrs(struct ifnet *ifp) * On interface removal, clean up IPv4 data structures hung off of the ifnet. */ void -in_ifdetach(ifp) - struct ifnet *ifp; +in_ifdetach(struct ifnet *ifp) { in_pcbpurgeif0(&ripcbinfo, ifp); diff --git a/sys/netinet/in_cksum.c b/sys/netinet/in_cksum.c index cd1affe..8928394 100644 --- a/sys/netinet/in_cksum.c +++ b/sys/netinet/in_cksum.c @@ -44,9 +44,7 @@ #define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; ADDCARRY(sum);} int -in_cksum(m, len) - register struct mbuf *m; - register int len; +in_cksum(struct mbuf *m, int len) { register u_short *w; register int sum = 0; diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c index aac8208..e70a6f8 100644 --- a/sys/netinet/in_gif.c +++ b/sys/netinet/in_gif.c @@ -88,10 +88,7 @@ SYSCTL_INT(_net_inet_ip, IPCTL_GIF_TTL, gifttl, CTLFLAG_RW, &ip_gif_ttl, 0, ""); int -in_gif_output(ifp, family, m) - struct ifnet *ifp; - int family; - struct mbuf *m; +in_gif_output(struct ifnet *ifp, int family, struct mbuf *m) { struct gif_softc *sc = ifp->if_softc; struct sockaddr_in *dst = (struct sockaddr_in *)&sc->gif_ro.ro_dst; @@ -238,9 +235,7 @@ in_gif_output(ifp, family, m) } void -in_gif_input(m, off) - struct mbuf *m; - int off; +in_gif_input(struct mbuf *m, int off) { struct ifnet *gifp = NULL; struct gif_softc *sc; @@ -334,10 +329,7 @@ in_gif_input(m, off) * validate outer address. */ static int -gif_validate4(ip, sc, ifp) - const struct ip *ip; - struct gif_softc *sc; - struct ifnet *ifp; +gif_validate4(const struct ip *ip, struct gif_softc *sc, struct ifnet *ifp) { struct sockaddr_in *src, *dst; struct in_ifaddr *ia4; @@ -396,11 +388,7 @@ gif_validate4(ip, sc, ifp) * matched the physical addr family. see gif_encapcheck(). */ int -gif_encapcheck4(m, off, proto, arg) - const struct mbuf *m; - int off; - int proto; - void *arg; +gif_encapcheck4(const struct mbuf *m, int off, int proto, void *arg) { struct ip ip; struct gif_softc *sc; @@ -417,8 +405,7 @@ gif_encapcheck4(m, off, proto, arg) } int -in_gif_attach(sc) - struct gif_softc *sc; +in_gif_attach(struct gif_softc *sc) { sc->encap_cookie4 = encap_attach_func(AF_INET, -1, gif_encapcheck, &in_gif_protosw, sc); @@ -428,8 +415,7 @@ in_gif_attach(sc) } int -in_gif_detach(sc) - struct gif_softc *sc; +in_gif_detach(struct gif_softc *sc) { int error; diff --git a/sys/netinet/in_rmx.c b/sys/netinet/in_rmx.c index 1260d979..fd025a8 100644 --- a/sys/netinet/in_rmx.c +++ b/sys/netinet/in_rmx.c @@ -66,7 +66,7 @@ extern int in_inithead(void **head, int off); */ static struct radix_node * in_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, - struct radix_node *treenodes) + struct radix_node *treenodes) { struct rtentry *rt = (struct rtentry *)treenodes; struct sockaddr_in *sin = (struct sockaddr_in *)rt_key(rt); diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index b96b792..d50c921 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -145,6 +145,7 @@ div_inpcb_fini(void *mem, int size) void div_init(void) { + INP_INFO_LOCK_INIT(&divcbinfo, "div"); LIST_INIT(&divcb); divcbinfo.ipi_listhead = &divcb; @@ -298,8 +299,8 @@ divert_packet(struct mbuf *m, int incoming) * the interface with that address. */ static int -div_output(struct socket *so, struct mbuf *m, - struct sockaddr_in *sin, struct mbuf *control) +div_output(struct socket *so, struct mbuf *m, struct sockaddr_in *sin, + struct mbuf *control) { struct m_tag *mtag; struct divert_tag *dt; @@ -502,7 +503,7 @@ div_shutdown(struct socket *so) static int div_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, - struct mbuf *control, struct thread *td) + struct mbuf *control, struct thread *td) { /* Packet must have a header (but that's about it) */ if (m->m_len < sizeof (struct ip) && @@ -630,6 +631,7 @@ div_pcblist(SYSCTL_HANDLER_ARGS) static int div_sockaddr(struct socket *so, struct sockaddr **nam) { + return (in_setsockaddr(so, nam)); } @@ -640,6 +642,7 @@ div_sockaddr(struct socket *so, struct sockaddr **nam) static int div_peeraddr(struct socket *so, struct sockaddr **nam) { + return (in_setpeeraddr(so, nam)); } diff --git a/sys/netinet/ip_dummynet.c b/sys/netinet/ip_dummynet.c index 7b68694..7af8f21 100644 --- a/sys/netinet/ip_dummynet.c +++ b/sys/netinet/ip_dummynet.c @@ -506,8 +506,8 @@ transmit_event(struct dn_pipe *pipe, struct mbuf **head, struct mbuf **tail) * and put into delay line (p_queue) */ static void -move_pkt(struct mbuf *pkt, struct dn_flow_queue *q, - struct dn_pipe *p, int len) +move_pkt(struct mbuf *pkt, struct dn_flow_queue *q, struct dn_pipe *p, + int len) { struct dn_pkt_tag *dt = dn_tag_get(pkt); @@ -721,6 +721,7 @@ ready_event_wfq(struct dn_pipe *p, struct mbuf **head, struct mbuf **tail) static void dummynet(void * __unused unused) { + taskqueue_enqueue(dn_tq, &dn_task); } @@ -730,7 +731,6 @@ dummynet(void * __unused unused) static void dummynet_task(void *context, int pending) { - struct mbuf *head = NULL, *tail = NULL; struct dn_pipe *pipe; struct dn_heap *heaps[3]; @@ -1551,7 +1551,7 @@ dn_rule_delete(void *r) * setup RED parameters */ static int -config_red(struct dn_flow_set *p, struct dn_flow_set * x) +config_red(struct dn_flow_set *p, struct dn_flow_set *x) { int i; @@ -1818,7 +1818,7 @@ pipe_remove_from_heap(struct dn_heap *h, struct dn_pipe *p) * drain all queues. Called in case of severe mbuf shortage. */ void -dummynet_drain() +dummynet_drain(void) { struct dn_flow_set *fs; struct dn_pipe *pipe; @@ -1855,6 +1855,7 @@ dummynet_drain() static int delete_pipe(struct dn_pipe *p) { + if (p->pipe_nr == 0 && p->fs.fs_nr == 0) return EINVAL ; if (p->pipe_nr != 0 && p->fs.fs_nr != 0) @@ -2170,6 +2171,7 @@ ip_dn_destroy(void) static int dummynet_modevent(module_t mod, int type, void *data) { + switch (type) { case MOD_LOAD: if (DUMMYNET_LOADED) { diff --git a/sys/netinet/ip_ecn.c b/sys/netinet/ip_ecn.c index 39884ba..c511ba7 100644 --- a/sys/netinet/ip_ecn.c +++ b/sys/netinet/ip_ecn.c @@ -90,11 +90,9 @@ * modify outer ECN (TOS) field on ingress operation (tunnel encapsulation). */ void -ip_ecn_ingress(mode, outer, inner) - int mode; - u_int8_t *outer; - const u_int8_t *inner; +ip_ecn_ingress(int mode, u_int8_t *outer, const u_int8_t *inner) { + if (!outer || !inner) panic("NULL pointer passed to ip_ecn_ingress"); @@ -124,11 +122,9 @@ ip_ecn_ingress(mode, outer, inner) * the caller should drop the packet if the return value is 0. */ int -ip_ecn_egress(mode, outer, inner) - int mode; - const u_int8_t *outer; - u_int8_t *inner; +ip_ecn_egress(int mode, const u_int8_t *outer, u_int8_t *inner) { + if (!outer || !inner) panic("NULL pointer passed to ip_ecn_egress"); @@ -160,10 +156,7 @@ ip_ecn_egress(mode, outer, inner) #ifdef INET6 void -ip6_ecn_ingress(mode, outer, inner) - int mode; - u_int32_t *outer; - const u_int32_t *inner; +ip6_ecn_ingress(int mode, u_int32_t *outer, const u_int32_t *inner) { u_int8_t outer8, inner8; @@ -177,10 +170,7 @@ ip6_ecn_ingress(mode, outer, inner) } int -ip6_ecn_egress(mode, outer, inner) - int mode; - const u_int32_t *outer; - u_int32_t *inner; +ip6_ecn_egress(int mode, const u_int32_t *outer, u_int32_t *inner) { u_int8_t outer8, inner8, oinner8; diff --git a/sys/netinet/ip_encap.c b/sys/netinet/ip_encap.c index 8a3298a..81b2720 100644 --- a/sys/netinet/ip_encap.c +++ b/sys/netinet/ip_encap.c @@ -108,15 +108,13 @@ LIST_HEAD(, encaptab) encaptab = LIST_HEAD_INITIALIZER(&encaptab); * it's referenced by KAME pieces in netinet6. */ void -encap_init() +encap_init(void) { } #ifdef INET void -encap4_input(m, off) - struct mbuf *m; - int off; +encap4_input(struct mbuf *m, int off) { struct ip *ip; int proto; @@ -201,10 +199,7 @@ encap4_input(m, off) #ifdef INET6 int -encap6_input(mp, offp, proto) - struct mbuf **mp; - int *offp; - int proto; +encap6_input(struct mbuf **mp, int *offp, int proto) { struct mbuf *m = *mp; struct ip6_hdr *ip6; @@ -272,8 +267,7 @@ encap6_input(mp, offp, proto) /*lint -sem(encap_add, custodial(1)) */ static void -encap_add(ep) - struct encaptab *ep; +encap_add(struct encaptab *ep) { mtx_assert(&encapmtx, MA_OWNED); @@ -286,13 +280,9 @@ encap_add(ep) * Return value will be necessary as input (cookie) for encap_detach(). */ const struct encaptab * -encap_attach(af, proto, sp, sm, dp, dm, psw, arg) - int af; - int proto; - const struct sockaddr *sp, *sm; - const struct sockaddr *dp, *dm; - const struct protosw *psw; - void *arg; +encap_attach(int af, int proto, const struct sockaddr *sp, + const struct sockaddr *sm, const struct sockaddr *dp, + const struct sockaddr *dm, const struct protosw *psw, void *arg) { struct encaptab *ep; @@ -346,12 +336,9 @@ encap_attach(af, proto, sp, sm, dp, dm, psw, arg) } const struct encaptab * -encap_attach_func(af, proto, func, psw, arg) - int af; - int proto; - int (*func)(const struct mbuf *, int, int, void *); - const struct protosw *psw; - void *arg; +encap_attach_func(int af, int proto, + int (*func)(const struct mbuf *, int, int, void *), + const struct protosw *psw, void *arg) { struct encaptab *ep; @@ -377,8 +364,7 @@ encap_attach_func(af, proto, func, psw, arg) } int -encap_detach(cookie) - const struct encaptab *cookie; +encap_detach(const struct encaptab *cookie) { const struct encaptab *ep = cookie; struct encaptab *p; @@ -398,10 +384,8 @@ encap_detach(cookie) } static int -mask_match(ep, sp, dp) - const struct encaptab *ep; - const struct sockaddr *sp; - const struct sockaddr *dp; +mask_match(const struct encaptab *ep, const struct sockaddr *sp, + const struct sockaddr *dp) { struct sockaddr_storage s; struct sockaddr_storage d; @@ -451,9 +435,7 @@ mask_match(ep, sp, dp) } static void -encap_fillarg(m, ep) - struct mbuf *m; - const struct encaptab *ep; +encap_fillarg(struct mbuf *m, const struct encaptab *ep) { struct m_tag *tag; @@ -465,8 +447,7 @@ encap_fillarg(m, ep) } void * -encap_getarg(m) - struct mbuf *m; +encap_getarg(struct mbuf *m) { void *p = NULL; struct m_tag *tag; diff --git a/sys/netinet/ip_fw2.c b/sys/netinet/ip_fw2.c index 21f9914..fc8f95b 100644 --- a/sys/netinet/ip_fw2.c +++ b/sys/netinet/ip_fw2.c @@ -770,8 +770,8 @@ static u_int64_t norule_counter; /* counter for ipfw_log(NULL...) */ */ static void ipfw_log(struct ip_fw *f, u_int hlen, struct ip_fw_args *args, - struct mbuf *m, struct ifnet *oif, u_short offset, uint32_t tablearg, - struct ip *ip) + struct mbuf *m, struct ifnet *oif, u_short offset, uint32_t tablearg, + struct ip *ip) { struct ether_header *eh = args->eh; char *action; @@ -1158,7 +1158,7 @@ next: */ static ipfw_dyn_rule * lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int *match_direction, - struct tcphdr *tcp) + struct tcphdr *tcp) { /* * stateful ipfw extensions. @@ -1301,7 +1301,7 @@ done: static ipfw_dyn_rule * lookup_dyn_rule(struct ipfw_flow_id *pkt, int *match_direction, - struct tcphdr *tcp) + struct tcphdr *tcp) { ipfw_dyn_rule *q; @@ -1776,7 +1776,7 @@ lookup_next_rule(struct ip_fw *me) static int add_table_entry(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr, - uint8_t mlen, uint32_t value) + uint8_t mlen, uint32_t value) { struct radix_node_head *rnh; struct table_entry *ent; @@ -1804,7 +1804,7 @@ add_table_entry(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr, static int del_table_entry(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr, - uint8_t mlen) + uint8_t mlen) { struct radix_node_head *rnh; struct table_entry *ent; @@ -1885,7 +1885,7 @@ init_tables(struct ip_fw_chain *ch) static int lookup_table(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr, - uint32_t *val) + uint32_t *val) { struct radix_node_head *rnh; struct table_entry *ent; @@ -1977,11 +1977,10 @@ fill_ugid_cache(struct inpcb *inp, struct ip_fw_ugid *ugp) } static int -check_uidgid(ipfw_insn_u32 *insn, - int proto, struct ifnet *oif, - struct in_addr dst_ip, u_int16_t dst_port, - struct in_addr src_ip, u_int16_t src_port, - struct ip_fw_ugid *ugp, int *lookup, struct inpcb *inp) +check_uidgid(ipfw_insn_u32 *insn, int proto, struct ifnet *oif, + struct in_addr dst_ip, u_int16_t dst_port, struct in_addr src_ip, + u_int16_t src_port, struct ip_fw_ugid *ugp, int *lookup, + struct inpcb *inp) { struct inpcbinfo *pi; int wildcard; @@ -2066,7 +2065,8 @@ check_uidgid(ipfw_insn_u32 *insn, static eventhandler_tag ifaddr_event_tag; static void -ifaddr_change(void *arg __unused, struct ifnet *ifp) { +ifaddr_change(void *arg __unused, struct ifnet *ifp) +{ struct cfg_nat *ptr; struct ifaddr *ifa; @@ -2092,7 +2092,8 @@ ifaddr_change(void *arg __unused, struct ifnet *ifp) { } static void -flush_nat_ptrs(const int i) { +flush_nat_ptrs(const int i) +{ struct ip_fw *rule; IPFW_WLOCK_ASSERT(&layer3_chain); @@ -2106,7 +2107,8 @@ flush_nat_ptrs(const int i) { } static struct cfg_nat * -lookup_nat(const int i) { +lookup_nat(const int i) +{ struct cfg_nat *ptr; LIST_FOREACH(ptr, &layer3_chain.nat, _next) @@ -2134,7 +2136,8 @@ lookup_nat(const int i) { } while (0) static void -del_redir_spool_cfg(struct cfg_nat *n, struct redir_chain *head) { +del_redir_spool_cfg(struct cfg_nat *n, struct redir_chain *head) +{ struct cfg_redir *r, *tmp_r; struct cfg_spool *s, *tmp_s; int i, num; @@ -2168,7 +2171,8 @@ del_redir_spool_cfg(struct cfg_nat *n, struct redir_chain *head) { } static int -add_redir_spool_cfg(char *buf, struct cfg_nat *ptr) { +add_redir_spool_cfg(char *buf, struct cfg_nat *ptr) +{ struct cfg_redir *r, *ser_r; struct cfg_spool *s, *ser_s; int cnt, off, i; @@ -3798,7 +3802,8 @@ done: * Arguments are not checked, so they better be correct. */ static struct ip_fw * -remove_rule(struct ip_fw_chain *chain, struct ip_fw *rule, struct ip_fw *prev) +remove_rule(struct ip_fw_chain *chain, struct ip_fw *rule, + struct ip_fw *prev) { struct ip_fw *n; int l = RULESIZE(rule); diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 3385143..2ccd6bd 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -145,11 +145,7 @@ extern struct protosw inetsw[]; * in response to bad packet ip. */ void -icmp_error(n, type, code, dest, mtu) - struct mbuf *n; - int type, code; - n_long dest; - int mtu; +icmp_error(struct mbuf *n, int type, int code, n_long dest, int mtu) { register struct ip *oip = mtod(n, struct ip *), *nip; register unsigned oiphlen = oip->ip_hl << 2; @@ -293,9 +289,7 @@ freeit: * Process a received ICMP message. */ void -icmp_input(m, off) - struct mbuf *m; - int off; +icmp_input(struct mbuf *m, int off) { struct icmp *icp; struct in_ifaddr *ia; @@ -622,8 +616,7 @@ freeit: * Reflect the ip packet back to the source */ static void -icmp_reflect(m) - struct mbuf *m; +icmp_reflect(struct mbuf *m) { struct ip *ip = mtod(m, struct ip *); struct ifaddr *ifa; @@ -802,9 +795,7 @@ done: * after supplying a checksum. */ static void -icmp_send(m, opts) - register struct mbuf *m; - struct mbuf *opts; +icmp_send(struct mbuf *m, struct mbuf *opts) { register struct ip *ip = mtod(m, struct ip *); register int hlen; @@ -831,7 +822,7 @@ icmp_send(m, opts) } n_time -iptime() +iptime(void) { struct timeval atv; u_long t; @@ -847,9 +838,7 @@ iptime() * is returned; otherwise, a smaller value is returned. */ int -ip_next_mtu(mtu, dir) - int mtu; - int dir; +ip_next_mtu(int mtu, int dir) { static int mtutab[] = { 65535, 32000, 17914, 8166, 4352, 2002, 1492, 1280, 1006, 508, diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 4fe44b9..2bf024b 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -209,10 +209,10 @@ static void ip_freef(struct ipqhead *, struct ipq *); * All protocols not implemented in kernel go to raw IP protocol handler. */ void -ip_init() +ip_init(void) { - register struct protosw *pr; - register int i; + struct protosw *pr; + int i; TAILQ_INIT(&in_ifaddrhead); in_ifaddrhashtbl = hashinit(INADDR_NHASH, M_IFADDR, &in_ifaddrhmask); @@ -268,9 +268,10 @@ ip_init() netisr_register(NETISR_IP, ip_input, &ipintrq, NETISR_MPSAFE); } -void ip_fini(xtp) - void *xtp; +void +ip_fini(void *xtp) { + callout_stop(&ipport_tick_callout); } @@ -738,7 +739,6 @@ SYSCTL_PROC(_net_inet_ip, OID_AUTO, maxfragpackets, CTLTYPE_INT|CTLFLAG_RW, * to the first packet/fragment are preserved. * The IP header is *NOT* adjusted out of iplen. */ - struct mbuf * ip_reass(struct mbuf *m) { @@ -1054,11 +1054,9 @@ done: * associated datagrams. */ static void -ip_freef(fhp, fp) - struct ipqhead *fhp; - struct ipq *fp; +ip_freef(struct ipqhead *fhp, struct ipq *fp) { - register struct mbuf *q; + struct mbuf *q; IPQ_LOCK_ASSERT(); @@ -1078,9 +1076,9 @@ ip_freef(fhp, fp) * queue, discard it. */ void -ip_slowtimo() +ip_slowtimo(void) { - register struct ipq *fp; + struct ipq *fp; int i; IPQ_LOCK(); @@ -1117,7 +1115,7 @@ ip_slowtimo() * Drain off all datagram fragments. */ void -ip_drain() +ip_drain(void) { int i; @@ -1198,8 +1196,7 @@ ipproto_unregister(u_char ipproto) * return internet address info of interface to be used to get there. */ struct in_ifaddr * -ip_rtaddr(dst) - struct in_addr dst; +ip_rtaddr(struct in_addr dst) { struct route sro; struct sockaddr_in *sin; @@ -1436,11 +1433,8 @@ ip_forward(struct mbuf *m, int srcrt) } void -ip_savecontrol(inp, mp, ip, m) - register struct inpcb *inp; - register struct mbuf **mp; - register struct ip *ip; - register struct mbuf *m; +ip_savecontrol(struct inpcb *inp, struct mbuf **mp, struct ip *ip, + struct mbuf *m) { if (inp->inp_socket->so_options & (SO_BINTIME | SO_TIMESTAMP)) { struct bintime bt; diff --git a/sys/netinet/ip_ipsec.c b/sys/netinet/ip_ipsec.c index 303ff70..296da69 100644 --- a/sys/netinet/ip_ipsec.c +++ b/sys/netinet/ip_ipsec.c @@ -293,8 +293,8 @@ ip_ipsec_mtu(struct mbuf *m) */ int ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error, - struct route **ro, struct route *iproute, struct sockaddr_in **dst, - struct in_ifaddr **ia, struct ifnet **ifp) + struct route **ro, struct route *iproute, struct sockaddr_in **dst, + struct in_ifaddr **ia, struct ifnet **ifp) { struct secpolicy *sp = NULL; struct ip *ip = mtod(*m, struct ip *); @@ -576,4 +576,3 @@ bad: #endif /* FAST_IPSEC */ return 0; } - diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 5de70e3..f9997ce 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -2550,8 +2550,8 @@ expire_bw_meter_process(void *unused) * */ static int -pim_register_send(struct ip *ip, struct vif *vifp, - struct mbuf *m, struct mfc *rt) +pim_register_send(struct ip *ip, struct vif *vifp, struct mbuf *m, + struct mfc *rt) { struct mbuf *mb_copy, *mm; @@ -2648,7 +2648,7 @@ pim_register_prepare(struct ip *ip, struct mbuf *m) */ static int pim_register_send_upcall(struct ip *ip, struct vif *vifp, - struct mbuf *mb_copy, struct mfc *rt) + struct mbuf *mb_copy, struct mfc *rt) { struct mbuf *mb_first; int len = ntohs(ip->ip_len); @@ -2701,8 +2701,8 @@ pim_register_send_upcall(struct ip *ip, struct vif *vifp, * Encapsulate the data packet in PIM Register message and send it to the RP. */ static int -pim_register_send_rp(struct ip *ip, struct vif *vifp, - struct mbuf *mb_copy, struct mfc *rt) +pim_register_send_rp(struct ip *ip, struct vif *vifp, struct mbuf *mb_copy, + struct mfc *rt) { struct mbuf *mb_first; struct ip *ip_outer; diff --git a/sys/netinet/ip_options.c b/sys/netinet/ip_options.c index 8986275..a198fc0 100644 --- a/sys/netinet/ip_options.c +++ b/sys/netinet/ip_options.c @@ -369,10 +369,7 @@ bad: * to be picked up later by ip_srcroute if the receiver is interested. */ static void -save_rte(m, option, dst) - struct mbuf *m; - u_char *option; - struct in_addr dst; +save_rte(struct mbuf *m, u_char *option, struct in_addr dst) { unsigned olen; struct ipopt_tag *opts; @@ -399,8 +396,7 @@ save_rte(m, option, dst) * The first hop is placed before the options, will be removed later. */ struct mbuf * -ip_srcroute(m0) - struct mbuf *m0; +ip_srcroute(struct mbuf *m0) { register struct in_addr *p, *q; register struct mbuf *m; @@ -461,9 +457,7 @@ ip_srcroute(m0) * XXX should be deleted; last arg currently ignored. */ void -ip_stripoptions(m, mopt) - register struct mbuf *m; - struct mbuf *mopt; +ip_stripoptions(struct mbuf *m, struct mbuf *mopt) { register int i; struct ip *ip = mtod(m, struct ip *); @@ -489,10 +483,7 @@ ip_stripoptions(m, mopt) * XXX This routine assumes that the packet has no options in place. */ struct mbuf * -ip_insertoptions(m, opt, phlen) - register struct mbuf *m; - struct mbuf *opt; - int *phlen; +ip_insertoptions(struct mbuf *m, struct mbuf *opt, int *phlen) { register struct ipoption *p = mtod(opt, struct ipoption *); struct mbuf *n; @@ -545,8 +536,7 @@ ip_insertoptions(m, opt, phlen) * omitting those not copied during fragmentation. */ int -ip_optcopy(ip, jp) - struct ip *ip, *jp; +ip_optcopy(struct ip *ip, struct ip *jp) { register u_char *cp, *dp; int opt, optlen, cnt; diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index d9e27ea..4c4a51f 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -107,8 +107,8 @@ extern struct protosw inetsw[]; * inserted, so must have a NULL opt pointer. */ int -ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, - int flags, struct ip_moptions *imo, struct inpcb *inp) +ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags, + struct ip_moptions *imo, struct inpcb *inp) { struct ip *ip; struct ifnet *ifp = NULL; /* keep compiler happy */ @@ -626,7 +626,7 @@ bad: */ int ip_fragment(struct ip *ip, struct mbuf **m_frag, int mtu, - u_long if_hwassist_flags, int sw_csum) + u_long if_hwassist_flags, int sw_csum) { int error = 0; int hlen = ip->ip_hl << 2; @@ -814,9 +814,7 @@ in_delayed_cksum(struct mbuf *m) * IP socket option processing. */ int -ip_ctloutput(so, sopt) - struct socket *so; - struct sockopt *sopt; +ip_ctloutput(struct socket *so, struct sockopt *sopt) { struct inpcb *inp = sotoinpcb(so); int error, optval; @@ -1145,9 +1143,7 @@ ip_ctloutput(so, sopt) * following RFC1724 section 3.3, 0.0.0.0/8 is interpreted as interface index. */ static struct ifnet * -ip_multicast_if(a, ifindexp) - struct in_addr *a; - int *ifindexp; +ip_multicast_if(struct in_addr *a, int *ifindexp) { int ifindex; struct ifnet *ifp; @@ -1594,8 +1590,7 @@ ip_getmoptions(struct inpcb *inp, struct sockopt *sopt) * Discard the IP multicast options. */ void -ip_freemoptions(imo) - register struct ip_moptions *imo; +ip_freemoptions(struct ip_moptions *imo) { register int i; @@ -1615,11 +1610,8 @@ ip_freemoptions(imo) * replicating that code here. */ static void -ip_mloopback(ifp, m, dst, hlen) - struct ifnet *ifp; - register struct mbuf *m; - register struct sockaddr_in *dst; - int hlen; +ip_mloopback(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in *dst, + int hlen) { register struct ip *ip; struct mbuf *copym; diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 50ca889..d48dca8 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -129,8 +129,9 @@ rip_inpcb_init(void *mem, int size, int flags) } void -rip_init() +rip_init(void) { + INP_INFO_LOCK_INIT(&ripcbinfo, "rip"); LIST_INIT(&ripcb); ripcbinfo.ipi_listhead = &ripcb; @@ -790,7 +791,7 @@ rip_shutdown(struct socket *so) static int rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, - struct mbuf *control, struct thread *td) + struct mbuf *control, struct thread *td) { struct inpcb *inp; u_long dst; @@ -915,6 +916,7 @@ rip_pcblist(SYSCTL_HANDLER_ARGS) static int rip_sockaddr(struct socket *so, struct sockaddr **nam) { + return (in_setsockaddr(so, nam)); } @@ -925,6 +927,7 @@ rip_sockaddr(struct socket *so, struct sockaddr **nam) static int rip_peeraddr(struct socket *so, struct sockaddr **nam) { + return (in_setpeeraddr(so, nam)); } diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index eac67ec..ad42e03 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -224,8 +224,9 @@ tcp_reass_zone_change(void *tag) uma_zone_t tcp_reass_zone; void -tcp_reass_init() +tcp_reass_init(void) { + tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", &tcp_reass_maxseg); diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index eac67ec..ad42e03 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -224,8 +224,9 @@ tcp_reass_zone_change(void *tag) uma_zone_t tcp_reass_zone; void -tcp_reass_init() +tcp_reass_init(void) { + tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", &tcp_reass_maxseg); diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index 56d2688..807526f 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -259,8 +259,7 @@ tcp_update_sack_list(struct tcpcb *tp, tcp_seq rcv_start, tcp_seq rcv_end) * Delete all receiver-side SACK information. */ void -tcp_clean_sackreport(tp) - struct tcpcb *tp; +tcp_clean_sackreport(struct tcpcb *tp) { int i; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 049222d..a3bdb08 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -300,8 +300,8 @@ tcp_inpcb_init(void *mem, int size, int flags) void tcp_init(void) { - int hashsize = TCBHASHSIZE; + int hashsize = TCBHASHSIZE; tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; tcp_keepidle = TCPTV_KEEP_IDLE; @@ -465,8 +465,8 @@ tcpip_maketemplate(struct inpcb *inp) * NOTE: If m != NULL, then ti must point to *inside* the mbuf. */ void -tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, - struct mbuf *m, tcp_seq ack, tcp_seq seq, int flags) +tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m, + tcp_seq ack, tcp_seq seq, int flags) { int tlen; int win = 0; diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 0e4f4e3..dd380b7 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -128,7 +128,7 @@ static int tcp_timer_rexmt(struct tcpcb *, struct inpcb *); * causes finite state machine actions if timers expire. */ void -tcp_slowtimo() +tcp_slowtimo(void) { tcp_maxidle = tcp_keepcnt * tcp_keepintvl; @@ -149,7 +149,6 @@ static int tcp_timer_race; SYSCTL_INT(_net_inet_tcp, OID_AUTO, timer_race, CTLFLAG_RD, &tcp_timer_race, 0, "Count of t_inpcb races on tcp_discardcb"); - void tcp_timer_activate(struct tcpcb *tp, int timer_type, u_int delta) { @@ -417,7 +416,6 @@ shutdown: return; } - /* * TCP timer processing. */ diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index 049222d..a3bdb08 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -300,8 +300,8 @@ tcp_inpcb_init(void *mem, int size, int flags) void tcp_init(void) { - int hashsize = TCBHASHSIZE; + int hashsize = TCBHASHSIZE; tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; tcp_keepidle = TCPTV_KEEP_IDLE; @@ -465,8 +465,8 @@ tcpip_maketemplate(struct inpcb *inp) * NOTE: If m != NULL, then ti must point to *inside* the mbuf. */ void -tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, - struct mbuf *m, tcp_seq ack, tcp_seq seq, int flags) +tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m, + tcp_seq ack, tcp_seq seq, int flags) { int tlen; int win = 0; diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index acda0ec..b975915 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -694,6 +694,7 @@ out: static int tcp_sockaddr(struct socket *so, struct sockaddr **nam) { + return (in_setsockaddr(so, nam)); } @@ -704,6 +705,7 @@ tcp_sockaddr(struct socket *so, struct sockaddr **nam) static int tcp_peeraddr(struct socket *so, struct sockaddr **nam) { + return (in_setpeeraddr(so, nam)); } |