diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2010-02-08 12:16:03 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2010-02-08 12:16:03 +0000 |
commit | 7474572c4d9651d435dd70722a428b6808eb9b88 (patch) | |
tree | a2962fbe74ffc645b731915d61957b7360cdeb96 | |
parent | 3d3062f24e6f3519b1e27ba5bff0b7ab84cd189a (diff) |
More destatic and ansification.
ok claudio@ naddy@
-rw-r--r-- | sys/netinet6/ip6_id.c | 14 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 24 | ||||
-rw-r--r-- | sys/netinet6/ip6_mroute.c | 60 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 69 |
4 files changed, 82 insertions, 85 deletions
diff --git a/sys/netinet6/ip6_id.c b/sys/netinet6/ip6_id.c index 580d1b72062..8c7de21d727 100644 --- a/sys/netinet6/ip6_id.c +++ b/sys/netinet6/ip6_id.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_id.c,v 1.7 2008/06/09 22:47:42 djm Exp $ */ +/* $OpenBSD: ip6_id.c,v 1.8 2010/02/08 12:16:02 jsing Exp $ */ /* $NetBSD: ip6_id.c,v 1.7 2003/09/13 21:32:59 itojun Exp $ */ /* $KAME: ip6_id.c,v 1.8 2003/09/06 13:41:06 itojun Exp $ */ @@ -124,16 +124,16 @@ static struct randomtab randomtab_20 = { { 2, 3, 14563, 0 }, /* factors of ru_n */ }; -static u_int32_t pmod(u_int32_t, u_int32_t, u_int32_t); -static void initid(struct randomtab *); -static u_int32_t randomid(struct randomtab *); +u_int32_t pmod(u_int32_t, u_int32_t, u_int32_t); +void initid(struct randomtab *); +u_int32_t randomid(struct randomtab *); /* * Do a fast modular exponation, returned value will be in the range * of 0 - (mod-1) */ -static u_int32_t +u_int32_t pmod(u_int32_t gen, u_int32_t expo, u_int32_t mod) { u_int64_t s, t, u; @@ -159,7 +159,7 @@ pmod(u_int32_t gen, u_int32_t expo, u_int32_t mod) * This function is called from id_randomid() when needed, an * application does not have to worry about it. */ -static void +void initid(struct randomtab *p) { u_int32_t j, i; @@ -203,7 +203,7 @@ initid(struct randomtab *p) p->ru_msb = p->ru_msb ? 0 : (1U << (p->ru_bits - 1)); } -static u_int32_t +u_int32_t randomid(struct randomtab *p) { int i, n; diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index d66e7599be4..b014e645653 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.94 2009/12/15 20:26:21 jasper Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.95 2010/02/08 12:16:02 jsing Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -133,18 +133,18 @@ int ip6_sourcecheck_interval; /* XXX */ struct ip6stat ip6stat; -static void ip6_init2(void *); +void ip6_init2(void *); int ip6_check_rh0hdr(struct mbuf *); -static int ip6_hopopts_input(u_int32_t *, u_int32_t *, struct mbuf **, int *); -static struct mbuf *ip6_pullexthdr(struct mbuf *, size_t, int); +int ip6_hopopts_input(u_int32_t *, u_int32_t *, struct mbuf **, int *); +struct mbuf *ip6_pullexthdr(struct mbuf *, size_t, int); /* * IP6 initialization: fill in IP6 protocol switch table. * All protocols not implemented in kernel go to raw IP6 protocol handler. */ void -ip6_init() +ip6_init(void) { struct ip6protosw *pr; int i; @@ -167,7 +167,7 @@ ip6_init() ip6_init2((void *)0); } -static void +void ip6_init2(void *dummy) { @@ -181,7 +181,7 @@ ip6_init2(void *dummy) * IP6 input interrupt handling. Just pass the packet to ip6_input. */ void -ip6intr() +ip6intr(void) { int s; struct mbuf *m; @@ -806,9 +806,9 @@ ip6_check_rh0hdr(struct mbuf *m) * * rtalertp - XXX: should be stored in a more smart way */ -static int +int ip6_hopopts_input(u_int32_t *plenp, u_int32_t *rtalertp, struct mbuf **mp, - int *offp) + int *offp) { struct mbuf *m = *mp; int off = *offp, hbhlen; @@ -852,7 +852,7 @@ ip6_hopopts_input(u_int32_t *plenp, u_int32_t *rtalertp, struct mbuf **mp, */ int ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen, - u_int32_t *rtalertp, u_int32_t *plenp) + u_int32_t *rtalertp, u_int32_t *plenp) { struct ip6_hdr *ip6; int optlen = 0; @@ -1235,7 +1235,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp) * pull single extension header from mbuf chain. returns single mbuf that * contains the result, or NULL on error. */ -static struct mbuf * +struct mbuf * ip6_pullexthdr(struct mbuf *m, size_t off, int nxt) { struct ip6_ext ip6e; @@ -1455,7 +1455,7 @@ int *ipv6ctl_vars[IPV6CTL_MAXID] = IPV6CTL_VARS; int ip6_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, - void *newp, size_t newlen) + void *newp, size_t newlen) { #ifdef MROUTING extern int ip6_mrtproto; diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 15e5810ccd3..c45da4f81f3 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -110,15 +110,13 @@ #include <netinet6/pim6_var.h> #include <netinet6/nd6.h> -static int ip6_mdq(struct mbuf *, struct ifnet *, struct mf6c *); -static void phyint_send(struct ip6_hdr *, struct mif6 *, struct mbuf *); +int ip6_mdq(struct mbuf *, struct ifnet *, struct mf6c *); +void phyint_send(struct ip6_hdr *, struct mif6 *, struct mbuf *); -static int set_pim6(int *); -static int get_pim6(struct mbuf *); -static int socket_send(struct socket *, struct mbuf *, - struct sockaddr_in6 *); -static int register_send(struct ip6_hdr *, struct mif6 *, - struct mbuf *); +int set_pim6(int *); +int get_pim6(struct mbuf *); +int socket_send(struct socket *, struct mbuf *, struct sockaddr_in6 *); +int register_send(struct ip6_hdr *, struct mif6 *, struct mbuf *); /* * Globals. All but ip6_mrouter, ip6_mrtproto and mrt6stat could be static, @@ -145,7 +143,7 @@ u_int mrt6debug = 0; /* debug level */ #define DEBUG_PIM 0x40 #endif -static void expire_upcalls(void *); +void expire_upcalls(void *); #define EXPIRE_TIMEOUT (hz / 4) /* 4x / second */ #define UPCALL_EXPIRE 6 /* number of timeouts */ @@ -238,13 +236,13 @@ u_long upcall_data[UPCALL_MAX + 1]; static void collate(); #endif /* UPCALL_TIMING */ -static int get_sg_cnt(struct sioc_sg_req6 *); -static int get_mif6_cnt(struct sioc_mif_req6 *); -static int ip6_mrouter_init(struct socket *, int, int); -static int add_m6if(struct mif6ctl *); -static int del_m6if(mifi_t *); -static int add_m6fc(struct mf6cctl *); -static int del_m6fc(struct mf6cctl *); +int get_sg_cnt(struct sioc_sg_req6 *); +int get_mif6_cnt(struct sioc_mif_req6 *); +int ip6_mrouter_init(struct socket *, int, int); +int add_m6if(struct mif6ctl *); +int del_m6if(mifi_t *); +int add_m6fc(struct mf6cctl *); +int del_m6fc(struct mf6cctl *); static struct timeout expire_upcalls_ch; @@ -330,7 +328,7 @@ mrt6_ioctl(int cmd, caddr_t data) /* * returns the packet, byte, rpf-failure count for the source group provided */ -static int +int get_sg_cnt(struct sioc_sg_req6 *req) { struct mf6c *rt; @@ -356,7 +354,7 @@ get_sg_cnt(struct sioc_sg_req6 *req) /* * returns the input and output packet and byte counts on the mif provided */ -static int +int get_mif6_cnt(struct sioc_mif_req6 *req) { mifi_t mifi = req->mifi; @@ -375,7 +373,7 @@ get_mif6_cnt(struct sioc_mif_req6 *req) /* * Get PIM processiong global */ -static int +int get_pim6(struct mbuf *m) { int *i; @@ -387,7 +385,7 @@ get_pim6(struct mbuf *m) return 0; } -static int +int set_pim6(int *i) { if ((*i != 1) && (*i != 0)) @@ -401,7 +399,7 @@ set_pim6(int *i) /* * Enable multicast routing */ -static int +int ip6_mrouter_init(struct socket *so, int v, int cmd) { #ifdef MRT6DEBUG @@ -444,7 +442,7 @@ ip6_mrouter_init(struct socket *so, int v, int cmd) * Disable multicast routing */ int -ip6_mrouter_done() +ip6_mrouter_done(void) { mifi_t mifi; int i; @@ -569,7 +567,7 @@ ip6_mrouter_detach(struct ifnet *ifp) /* * Add a mif to the mif table */ -static int +int add_m6if(struct mif6ctl *mifcp) { struct mif6 *mifp; @@ -657,7 +655,7 @@ add_m6if(struct mif6ctl *mifcp) /* * Delete a mif from the mif table */ -static int +int del_m6if(mifi_t *mifip) { struct mif6 *mifp = mif6table + *mifip; @@ -710,7 +708,7 @@ del_m6if(mifi_t *mifip) /* * Add an mfc entry */ -static int +int add_m6fc(struct mf6cctl *mfccp) { struct mf6c *rt; @@ -894,7 +892,7 @@ collate(struct timeval *t) /* * Delete an mfc entry */ -static int +int del_m6fc(struct mf6cctl *mfccp) { struct sockaddr_in6 origin; @@ -941,7 +939,7 @@ del_m6fc(struct mf6cctl *mfccp) return 0; } -static int +int socket_send(struct socket *s, struct mbuf *mm, struct sockaddr_in6 *src) { if (s) { @@ -1234,7 +1232,7 @@ ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) * Clean up cache entries if upcalls are not serviced * Call from the Slow Timeout mechanism, every half second. */ -static void +void expire_upcalls(void *unused) { struct rtdetq *rte; @@ -1292,7 +1290,7 @@ expire_upcalls(void *unused) /* * Packet forwarding routine once entry in the cache is made */ -static int +int ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt) { struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); @@ -1464,7 +1462,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt) return 0; } -static void +void phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) { struct mbuf *mb_copy; @@ -1571,7 +1569,7 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) splx(s); } -static int +int register_send(struct ip6_hdr *ip6, struct mif6 *mif, struct mbuf *m) { struct mbuf *mm; diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 3ffe2920fdf..e8aba376e2f 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.110 2009/11/25 07:37:29 mpf Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.111 2010/02/08 12:16:02 jsing Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -119,21 +119,21 @@ struct ip6_exthdrs { struct mbuf *ip6e_dest2; }; -static int ip6_pcbopt(int, u_char *, int, struct ip6_pktopts **, int, int); -static int ip6_pcbopts(struct ip6_pktopts **, struct mbuf *, struct socket *); -static int ip6_getpcbopt(struct ip6_pktopts *, int, struct mbuf **); -static int ip6_setpktopt(int, u_char *, int, struct ip6_pktopts *, int, int, +int ip6_pcbopt(int, u_char *, int, struct ip6_pktopts **, int, int); +int ip6_pcbopts(struct ip6_pktopts **, struct mbuf *, struct socket *); +int ip6_getpcbopt(struct ip6_pktopts *, int, struct mbuf **); +int ip6_setpktopt(int, u_char *, int, struct ip6_pktopts *, int, int, int, int); -static int ip6_setmoptions(int, struct ip6_moptions **, struct mbuf *); -static int ip6_getmoptions(int, struct ip6_moptions *, struct mbuf **); -static int ip6_copyexthdr(struct mbuf **, caddr_t, int); -static int ip6_insertfraghdr(struct mbuf *, struct mbuf *, int, +int ip6_setmoptions(int, struct ip6_moptions **, struct mbuf *); +int ip6_getmoptions(int, struct ip6_moptions *, struct mbuf **); +int ip6_copyexthdr(struct mbuf **, caddr_t, int); +int ip6_insertfraghdr(struct mbuf *, struct mbuf *, int, struct ip6_frag **); -static int ip6_insert_jumboopt(struct ip6_exthdrs *, u_int32_t); -static int ip6_splithdr(struct mbuf *, struct ip6_exthdrs *); -static int ip6_getpmtu(struct route_in6 *, struct route_in6 *, +int ip6_insert_jumboopt(struct ip6_exthdrs *, u_int32_t); +int ip6_splithdr(struct mbuf *, struct ip6_exthdrs *); +int ip6_getpmtu(struct route_in6 *, struct route_in6 *, struct ifnet *, struct in6_addr *, u_long *, int *); -static int copypktopts(struct ip6_pktopts *, struct ip6_pktopts *, int); +int copypktopts(struct ip6_pktopts *, struct ip6_pktopts *, int); /* Context for non-repeating IDs */ struct idgen32_ctx ip6_id_ctx; @@ -153,8 +153,8 @@ struct idgen32_ctx ip6_id_ctx; */ int ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, struct route_in6 *ro, - int flags, struct ip6_moptions *im6o, struct ifnet **ifpp, - struct inpcb *inp) + int flags, struct ip6_moptions *im6o, struct ifnet **ifpp, + struct inpcb *inp) { struct ip6_hdr *ip6, *mhip6; struct ifnet *ifp, *origifp = NULL; @@ -1033,7 +1033,7 @@ bad: goto done; } -static int +int ip6_copyexthdr(struct mbuf **mp, caddr_t hdr, int hlen) { struct mbuf *m; @@ -1063,7 +1063,7 @@ ip6_copyexthdr(struct mbuf **mp, caddr_t hdr, int hlen) /* * Insert jumbo payload option. */ -static int +int ip6_insert_jumboopt(struct ip6_exthdrs *exthdrs, u_int32_t plen) { struct mbuf *mopt; @@ -1158,9 +1158,9 @@ ip6_insert_jumboopt(struct ip6_exthdrs *exthdrs, u_int32_t plen) /* * Insert fragment header and copy unfragmentable header portions. */ -static int +int ip6_insertfraghdr(struct mbuf *m0, struct mbuf *m, int hlen, - struct ip6_frag **frghdrp) + struct ip6_frag **frghdrp) { struct mbuf *n, *mlast; @@ -1199,10 +1199,9 @@ ip6_insertfraghdr(struct mbuf *m0, struct mbuf *m, int hlen, return (0); } -static int +int ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro, - struct ifnet *ifp, struct in6_addr *dst, u_long *mtup, - int *alwaysfragp) + struct ifnet *ifp, struct in6_addr *dst, u_long *mtup, int *alwaysfragp) { u_int32_t mtu = 0; int alwaysfrag = 0; @@ -1276,7 +1275,7 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro, */ int ip6_ctloutput(int op, struct socket *so, int level, int optname, - struct mbuf **mp) + struct mbuf **mp) { int privileged, optdatalen, uproto; void *optdata; @@ -1962,7 +1961,7 @@ do { \ int ip6_raw_ctloutput(int op, struct socket *so, int level, int optname, - struct mbuf **mp) + struct mbuf **mp) { int error = 0, optval; const int icmp6off = offsetof(struct icmp6_hdr, icmp6_cksum); @@ -2035,7 +2034,7 @@ ip6_raw_ctloutput(int op, struct socket *so, int level, int optname, * Store in mbuf with pointer in pcbopt, adding pseudo-option * with destination address if source routed. */ -static int +int ip6_pcbopts(struct ip6_pktopts **pktopt, struct mbuf *m, struct socket *so) { struct ip6_pktopts *opt = *pktopt; @@ -2087,9 +2086,9 @@ ip6_initpktopts(struct ip6_pktopts *opt) } #define sin6tosa(sin6) ((struct sockaddr *)(sin6)) /* XXX */ -static int +int ip6_pcbopt(int optname, u_char *buf, int len, struct ip6_pktopts **pktopt, - int priv, int uproto) + int priv, int uproto) { struct ip6_pktopts *opt; @@ -2103,7 +2102,7 @@ ip6_pcbopt(int optname, u_char *buf, int len, struct ip6_pktopts **pktopt, return (ip6_setpktopt(optname, buf, len, opt, priv, 1, 0, uproto)); } -static int +int ip6_getpcbopt(struct ip6_pktopts *pktopt, int optname, struct mbuf **mp) { void *optdata = NULL; @@ -2259,7 +2258,7 @@ do {\ }\ } while (/*CONSTCOND*/ 0) -static int +int copypktopts(struct ip6_pktopts *dst, struct ip6_pktopts *src, int canwait) { dst->ip6po_hlim = src->ip6po_hlim; @@ -2306,7 +2305,7 @@ ip6_freepcbopts(struct ip6_pktopts *pktopt) /* * Set the IP6 multicast options in response to user setsockopt(). */ -static int +int ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) { int error = 0; @@ -2591,7 +2590,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) /* * Return the IP6 multicast options in response to user getsockopt(). */ -static int +int ip6_getmoptions(int optname, struct ip6_moptions *im6o, struct mbuf **mp) { u_int *hlim, *loop, *ifindex; @@ -2656,7 +2655,7 @@ ip6_freemoptions(struct ip6_moptions *im6o) */ int ip6_setpktopts(struct mbuf *control, struct ip6_pktopts *opt, - struct ip6_pktopts *stickyopt, int priv, int uproto) + struct ip6_pktopts *stickyopt, int priv, int uproto) { u_int clen; struct cmsghdr *cm = 0; @@ -2722,9 +2721,9 @@ ip6_setpktopts(struct mbuf *control, struct ip6_pktopts *opt, * "sticky=1, cmsg=0": RFC3542 socket option * "sticky=1, cmsg=1": RFC2292 socket option */ -static int +int ip6_setpktopt(int optname, u_char *buf, int len, struct ip6_pktopts *opt, - int priv, int sticky, int cmsg, int uproto) + int priv, int sticky, int cmsg, int uproto) { int minmtupolicy; @@ -3138,7 +3137,7 @@ ip6_mloopback(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in6 *dst) /* * Chop IPv6 header off from the payload. */ -static int +int ip6_splithdr(struct mbuf *m, struct ip6_exthdrs *exthdrs) { struct mbuf *mh; |