Home | History | Annotate | Line # | Download | only in kern
uipc_domain.c revision 1.55.8.1
      1  1.55.8.1      yamt /*	$NetBSD: uipc_domain.c,v 1.55.8.1 2006/05/24 10:58:42 yamt Exp $	*/
      2      1.12       cgd 
      3       1.1       cgd /*
      4      1.11   mycroft  * Copyright (c) 1982, 1986, 1993
      5      1.11   mycroft  *	The Regents of the University of California.  All rights reserved.
      6       1.1       cgd  *
      7       1.1       cgd  * Redistribution and use in source and binary forms, with or without
      8       1.1       cgd  * modification, are permitted provided that the following conditions
      9       1.1       cgd  * are met:
     10       1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     11       1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     12       1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     13       1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     14       1.1       cgd  *    documentation and/or other materials provided with the distribution.
     15      1.43       agc  * 3. Neither the name of the University nor the names of its contributors
     16       1.1       cgd  *    may be used to endorse or promote products derived from this software
     17       1.1       cgd  *    without specific prior written permission.
     18       1.1       cgd  *
     19       1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20       1.1       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21       1.1       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22       1.1       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23       1.1       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24       1.1       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25       1.1       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26       1.1       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27       1.1       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28       1.1       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29       1.1       cgd  * SUCH DAMAGE.
     30       1.1       cgd  *
     31      1.18      fvdl  *	@(#)uipc_domain.c	8.3 (Berkeley) 2/14/95
     32       1.1       cgd  */
     33      1.36     lukem 
     34      1.36     lukem #include <sys/cdefs.h>
     35  1.55.8.1      yamt __KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.55.8.1 2006/05/24 10:58:42 yamt Exp $");
     36       1.1       cgd 
     37       1.5   mycroft #include <sys/param.h>
     38       1.5   mycroft #include <sys/socket.h>
     39      1.50    atatat #include <sys/socketvar.h>
     40       1.5   mycroft #include <sys/protosw.h>
     41       1.5   mycroft #include <sys/domain.h>
     42       1.5   mycroft #include <sys/mbuf.h>
     43       1.5   mycroft #include <sys/time.h>
     44       1.5   mycroft #include <sys/kernel.h>
     45      1.11   mycroft #include <sys/systm.h>
     46      1.30   thorpej #include <sys/callout.h>
     47      1.49      matt #include <sys/queue.h>
     48      1.10       cgd #include <sys/proc.h>
     49      1.10       cgd #include <sys/sysctl.h>
     50      1.50    atatat #include <sys/un.h>
     51      1.50    atatat #include <sys/unpcb.h>
     52      1.50    atatat #include <sys/file.h>
     53  1.55.8.1      yamt #include <sys/kauth.h>
     54      1.13  christos 
     55      1.45  junyoung void	pffasttimo(void *);
     56      1.45  junyoung void	pfslowtimo(void *);
     57      1.37      matt 
     58      1.49      matt struct domainhead domains = STAILQ_HEAD_INITIALIZER(domains);
     59      1.11   mycroft 
     60      1.30   thorpej struct callout pffasttimo_ch, pfslowtimo_ch;
     61      1.30   thorpej 
     62      1.19   thorpej /*
     63      1.19   thorpej  * Current time values for fast and slow timeouts.  We can use u_int
     64      1.19   thorpej  * relatively safely.  The fast timer will roll over in 27 years and
     65      1.19   thorpej  * the slow timer in 68 years.
     66      1.19   thorpej  */
     67      1.19   thorpej u_int	pfslowtimo_now;
     68      1.19   thorpej u_int	pffasttimo_now;
     69      1.19   thorpej 
     70      1.49      matt void
     71      1.55   thorpej domaininit(void)
     72      1.49      matt {
     73      1.49      matt 	__link_set_decl(domains, struct domain);
     74      1.49      matt 	struct domain * const * dpp;
     75      1.49      matt 	struct domain *rt_domain = NULL;
     76      1.49      matt 
     77      1.49      matt 	/*
     78      1.49      matt 	 * Add all of the domains.  Make sure the PF_ROUTE
     79      1.49      matt 	 * domain is added last.
     80      1.49      matt 	 */
     81      1.49      matt 	__link_set_foreach(dpp, domains) {
     82      1.49      matt 		if ((*dpp)->dom_family == PF_ROUTE)
     83      1.49      matt 			rt_domain = *dpp;
     84      1.49      matt 		else
     85      1.49      matt 			domain_attach(*dpp);
     86      1.49      matt 	}
     87      1.49      matt 	if (rt_domain)
     88      1.49      matt 		domain_attach(rt_domain);
     89      1.49      matt 
     90      1.49      matt 	callout_init(&pffasttimo_ch);
     91      1.49      matt 	callout_init(&pfslowtimo_ch);
     92      1.49      matt 
     93      1.49      matt 	callout_reset(&pffasttimo_ch, 1, pffasttimo, NULL);
     94      1.49      matt 	callout_reset(&pfslowtimo_ch, 1, pfslowtimo, NULL);
     95       1.1       cgd }
     96       1.1       cgd 
     97       1.4    andrew void
     98      1.49      matt domain_attach(struct domain *dp)
     99       1.1       cgd {
    100      1.47      matt 	const struct protosw *pr;
    101       1.1       cgd 
    102      1.49      matt 	STAILQ_INSERT_TAIL(&domains, dp, dom_link);
    103      1.49      matt 
    104      1.49      matt 	if (dp->dom_init)
    105      1.49      matt 		(*dp->dom_init)();
    106       1.1       cgd 
    107      1.38      matt #ifdef MBUFTRACE
    108      1.49      matt 	if (dp->dom_mowner.mo_name[0] == '\0') {
    109      1.49      matt 		strncpy(dp->dom_mowner.mo_name, dp->dom_name,
    110      1.49      matt 		    sizeof(dp->dom_mowner.mo_name));
    111      1.49      matt 		MOWNER_ATTACH(&dp->dom_mowner);
    112      1.49      matt 	}
    113      1.38      matt #endif
    114      1.49      matt 	for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) {
    115      1.49      matt 		if (pr->pr_init)
    116      1.49      matt 			(*pr->pr_init)();
    117       1.1       cgd 	}
    118       1.1       cgd 
    119      1.16  explorer 	if (max_linkhdr < 16)		/* XXX */
    120      1.16  explorer 		max_linkhdr = 16;
    121       1.1       cgd 	max_hdr = max_linkhdr + max_protohdr;
    122       1.1       cgd 	max_datalen = MHLEN - max_hdr;
    123       1.1       cgd }
    124       1.1       cgd 
    125      1.29   thorpej struct domain *
    126      1.49      matt pffinddomain(int family)
    127      1.29   thorpej {
    128      1.29   thorpej 	struct domain *dp;
    129      1.29   thorpej 
    130      1.49      matt 	DOMAIN_FOREACH(dp)
    131      1.29   thorpej 		if (dp->dom_family == family)
    132      1.29   thorpej 			return (dp);
    133      1.29   thorpej 	return (NULL);
    134      1.29   thorpej }
    135      1.29   thorpej 
    136      1.47      matt const struct protosw *
    137      1.49      matt pffindtype(int family, int type)
    138       1.1       cgd {
    139      1.29   thorpej 	struct domain *dp;
    140      1.47      matt 	const struct protosw *pr;
    141      1.29   thorpej 
    142      1.29   thorpej 	dp = pffinddomain(family);
    143      1.29   thorpej 	if (dp == NULL)
    144      1.29   thorpej 		return (NULL);
    145       1.1       cgd 
    146       1.1       cgd 	for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
    147       1.1       cgd 		if (pr->pr_type && pr->pr_type == type)
    148       1.1       cgd 			return (pr);
    149      1.29   thorpej 
    150      1.29   thorpej 	return (NULL);
    151       1.1       cgd }
    152       1.1       cgd 
    153      1.47      matt const struct protosw *
    154      1.49      matt pffindproto(int family, int protocol, int type)
    155       1.1       cgd {
    156      1.29   thorpej 	struct domain *dp;
    157      1.47      matt 	const struct protosw *pr;
    158      1.47      matt 	const struct protosw *maybe = NULL;
    159       1.1       cgd 
    160       1.1       cgd 	if (family == 0)
    161      1.29   thorpej 		return (NULL);
    162      1.29   thorpej 
    163      1.29   thorpej 	dp = pffinddomain(family);
    164      1.29   thorpej 	if (dp == NULL)
    165      1.29   thorpej 		return (NULL);
    166      1.29   thorpej 
    167       1.1       cgd 	for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) {
    168       1.1       cgd 		if ((pr->pr_protocol == protocol) && (pr->pr_type == type))
    169       1.1       cgd 			return (pr);
    170       1.1       cgd 
    171       1.1       cgd 		if (type == SOCK_RAW && pr->pr_type == SOCK_RAW &&
    172      1.29   thorpej 		    pr->pr_protocol == 0 && maybe == NULL)
    173       1.1       cgd 			maybe = pr;
    174       1.1       cgd 	}
    175       1.1       cgd 	return (maybe);
    176      1.10       cgd }
    177      1.10       cgd 
    178      1.50    atatat /*
    179      1.50    atatat  * sysctl helper to stuff PF_LOCAL pcbs into sysctl structures
    180      1.50    atatat  */
    181      1.50    atatat static void
    182      1.50    atatat sysctl_dounpcb(struct kinfo_pcb *pcb, const struct socket *so)
    183      1.50    atatat {
    184      1.50    atatat 	struct unpcb *unp = sotounpcb(so);
    185      1.50    atatat 	struct sockaddr_un *un = unp->unp_addr;
    186      1.50    atatat 
    187      1.50    atatat 	memset(pcb, 0, sizeof(*pcb));
    188      1.50    atatat 
    189      1.50    atatat 	pcb->ki_family = so->so_proto->pr_domain->dom_family;
    190      1.50    atatat 	pcb->ki_type = so->so_proto->pr_type;
    191      1.50    atatat 	pcb->ki_protocol = so->so_proto->pr_protocol;
    192      1.50    atatat 	pcb->ki_pflags = unp->unp_flags;
    193      1.50    atatat 
    194      1.50    atatat 	pcb->ki_pcbaddr = PTRTOUINT64(unp);
    195      1.50    atatat 	/* pcb->ki_ppcbaddr = unp has no ppcb... */
    196      1.50    atatat 	pcb->ki_sockaddr = PTRTOUINT64(so);
    197      1.50    atatat 
    198      1.50    atatat 	pcb->ki_sostate = so->so_state;
    199      1.50    atatat 	/* pcb->ki_prstate = unp has no state... */
    200      1.50    atatat 
    201      1.50    atatat 	pcb->ki_rcvq = so->so_rcv.sb_cc;
    202      1.50    atatat 	pcb->ki_sndq = so->so_snd.sb_cc;
    203      1.50    atatat 
    204      1.50    atatat 	un = (struct sockaddr_un *)&pcb->ki_src;
    205      1.50    atatat 	/*
    206      1.50    atatat 	 * local domain sockets may bind without having a local
    207      1.50    atatat 	 * endpoint.  bleah!
    208      1.50    atatat 	 */
    209      1.50    atatat 	if (unp->unp_addr != NULL) {
    210      1.50    atatat 		un->sun_len = unp->unp_addr->sun_len;
    211      1.50    atatat 		un->sun_family = unp->unp_addr->sun_family;
    212      1.50    atatat 		strlcpy(un->sun_path, unp->unp_addr->sun_path,
    213      1.50    atatat 		    sizeof(pcb->ki_s));
    214      1.50    atatat 	}
    215      1.50    atatat 	else {
    216      1.50    atatat 		un->sun_len = offsetof(struct sockaddr_un, sun_path);
    217      1.50    atatat 		un->sun_family = pcb->ki_family;
    218      1.50    atatat 	}
    219      1.50    atatat 	if (unp->unp_conn != NULL) {
    220      1.50    atatat 		un = (struct sockaddr_un *)&pcb->ki_dst;
    221      1.50    atatat 		if (unp->unp_conn->unp_addr != NULL) {
    222      1.50    atatat 			un->sun_len = unp->unp_conn->unp_addr->sun_len;
    223      1.50    atatat 			un->sun_family = unp->unp_conn->unp_addr->sun_family;
    224      1.50    atatat 			un->sun_family = unp->unp_conn->unp_addr->sun_family;
    225      1.50    atatat 			strlcpy(un->sun_path, unp->unp_conn->unp_addr->sun_path,
    226      1.50    atatat 				sizeof(pcb->ki_d));
    227      1.50    atatat 		}
    228      1.50    atatat 		else {
    229      1.50    atatat 			un->sun_len = offsetof(struct sockaddr_un, sun_path);
    230      1.50    atatat 			un->sun_family = pcb->ki_family;
    231      1.50    atatat 		}
    232      1.50    atatat 	}
    233      1.50    atatat 
    234      1.50    atatat 	pcb->ki_inode = unp->unp_ino;
    235      1.50    atatat 	pcb->ki_vnode = PTRTOUINT64(unp->unp_vnode);
    236      1.50    atatat 	pcb->ki_conn = PTRTOUINT64(unp->unp_conn);
    237      1.50    atatat 	pcb->ki_refs = PTRTOUINT64(unp->unp_refs);
    238      1.50    atatat 	pcb->ki_nextref = PTRTOUINT64(unp->unp_nextref);
    239      1.50    atatat }
    240      1.50    atatat 
    241      1.50    atatat static int
    242      1.50    atatat sysctl_unpcblist(SYSCTLFN_ARGS)
    243      1.50    atatat {
    244      1.50    atatat 	struct file *fp;
    245      1.50    atatat 	struct socket *so;
    246      1.50    atatat 	struct kinfo_pcb pcb;
    247      1.50    atatat 	char *dp;
    248      1.50    atatat 	u_int op, arg;
    249      1.50    atatat 	size_t len, needed, elem_size, out_size;
    250      1.50    atatat 	int error, elem_count, pf, type, pf2;
    251      1.50    atatat 
    252      1.50    atatat 	if (namelen == 1 && name[0] == CTL_QUERY)
    253      1.52    atatat 		return (sysctl_query(SYSCTLFN_CALL(rnode)));
    254      1.50    atatat 
    255      1.50    atatat 	if (namelen != 4)
    256      1.50    atatat 		return (EINVAL);
    257      1.50    atatat 
    258  1.55.8.1      yamt 	if (oldp != NULL) {
    259  1.55.8.1      yamt 		len = *oldlenp;
    260  1.55.8.1      yamt 		elem_size = name[2];
    261  1.55.8.1      yamt 		elem_count = name[3];
    262  1.55.8.1      yamt 		if (elem_size != sizeof(pcb))
    263  1.55.8.1      yamt 			return EINVAL;
    264  1.55.8.1      yamt 	} else {
    265  1.55.8.1      yamt 		len = 0;
    266  1.55.8.1      yamt 		elem_size = sizeof(pcb);
    267  1.55.8.1      yamt 		elem_count = INT_MAX;
    268  1.55.8.1      yamt 	}
    269      1.50    atatat 	error = 0;
    270      1.50    atatat 	dp = oldp;
    271      1.50    atatat 	op = name[0];
    272      1.50    atatat 	arg = name[1];
    273  1.55.8.1      yamt 	out_size = elem_size;
    274      1.50    atatat 	needed = 0;
    275      1.50    atatat 
    276      1.50    atatat 	if (name - oname != 4)
    277      1.50    atatat 		return (EINVAL);
    278      1.50    atatat 
    279      1.50    atatat 	pf = oname[1];
    280      1.50    atatat 	type = oname[2];
    281      1.50    atatat 	pf2 = (oldp == NULL) ? 0 : pf;
    282      1.50    atatat 
    283      1.50    atatat 	/*
    284      1.50    atatat 	 * there's no "list" of local domain sockets, so we have
    285      1.50    atatat 	 * to walk the file list looking for them.  :-/
    286      1.50    atatat 	 */
    287      1.50    atatat 	LIST_FOREACH(fp, &filehead, f_list) {
    288  1.55.8.1      yamt 		if (kauth_authorize_process(l->l_proc->p_cred,
    289  1.55.8.1      yamt 		    KAUTH_PROCESS_CANSEE, l->l_proc, fp->f_cred, NULL,
    290  1.55.8.1      yamt 		    NULL) != 0)
    291      1.53      elad 			continue;
    292      1.50    atatat 		if (fp->f_type != DTYPE_SOCKET)
    293      1.50    atatat 			continue;
    294      1.50    atatat 		so = (struct socket *)fp->f_data;
    295      1.50    atatat 		if (so->so_type != type)
    296      1.50    atatat 			continue;
    297      1.50    atatat 		if (so->so_proto->pr_domain->dom_family != pf)
    298      1.50    atatat 			continue;
    299      1.50    atatat 		if (len >= elem_size && elem_count > 0) {
    300      1.50    atatat 			sysctl_dounpcb(&pcb, so);
    301      1.50    atatat 			error = copyout(&pcb, dp, out_size);
    302      1.50    atatat 			if (error)
    303      1.50    atatat 				break;
    304      1.50    atatat 			dp += elem_size;
    305      1.50    atatat 			len -= elem_size;
    306      1.50    atatat 		}
    307      1.50    atatat 		if (elem_count > 0) {
    308      1.50    atatat 			needed += elem_size;
    309      1.50    atatat 			if (elem_count != INT_MAX)
    310      1.50    atatat 				elem_count--;
    311      1.50    atatat 		}
    312      1.50    atatat 	}
    313      1.50    atatat 
    314      1.50    atatat 	*oldlenp = needed;
    315      1.50    atatat 	if (oldp == NULL)
    316      1.50    atatat 		*oldlenp += PCB_SLOP * sizeof(struct kinfo_pcb);
    317      1.50    atatat 
    318      1.50    atatat 	return (error);
    319      1.50    atatat }
    320      1.50    atatat 
    321      1.44    atatat SYSCTL_SETUP(sysctl_net_setup, "sysctl net subtree setup")
    322      1.10       cgd {
    323      1.46    atatat 	sysctl_createv(clog, 0, NULL, NULL,
    324      1.46    atatat 		       CTLFLAG_PERMANENT,
    325      1.44    atatat 		       CTLTYPE_NODE, "net", NULL,
    326      1.44    atatat 		       NULL, 0, NULL, 0,
    327      1.44    atatat 		       CTL_NET, CTL_EOL);
    328      1.46    atatat 	sysctl_createv(clog, 0, NULL, NULL,
    329      1.46    atatat 		       CTLFLAG_PERMANENT,
    330      1.48    atatat 		       CTLTYPE_NODE, "local",
    331      1.48    atatat 		       SYSCTL_DESCR("PF_LOCAL related settings"),
    332      1.44    atatat 		       NULL, 0, NULL, 0,
    333      1.44    atatat 		       CTL_NET, PF_LOCAL, CTL_EOL);
    334      1.50    atatat 	sysctl_createv(clog, 0, NULL, NULL,
    335      1.50    atatat 		       CTLFLAG_PERMANENT,
    336      1.50    atatat 		       CTLTYPE_NODE, "stream",
    337      1.50    atatat 		       SYSCTL_DESCR("SOCK_STREAM settings"),
    338      1.50    atatat 		       NULL, 0, NULL, 0,
    339      1.50    atatat 		       CTL_NET, PF_LOCAL, SOCK_STREAM, CTL_EOL);
    340      1.50    atatat 	sysctl_createv(clog, 0, NULL, NULL,
    341      1.50    atatat 		       CTLFLAG_PERMANENT,
    342      1.50    atatat 		       CTLTYPE_NODE, "dgram",
    343      1.50    atatat 		       SYSCTL_DESCR("SOCK_DGRAM settings"),
    344      1.50    atatat 		       NULL, 0, NULL, 0,
    345      1.50    atatat 		       CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_EOL);
    346      1.10       cgd 
    347      1.50    atatat 	sysctl_createv(clog, 0, NULL, NULL,
    348      1.50    atatat 		       CTLFLAG_PERMANENT,
    349      1.50    atatat 		       CTLTYPE_STRUCT, "pcblist",
    350      1.50    atatat 		       SYSCTL_DESCR("SOCK_STREAM protocol control block list"),
    351      1.50    atatat 		       sysctl_unpcblist, 0, NULL, 0,
    352      1.50    atatat 		       CTL_NET, PF_LOCAL, SOCK_STREAM, CTL_CREATE, CTL_EOL);
    353      1.50    atatat 	sysctl_createv(clog, 0, NULL, NULL,
    354      1.50    atatat 		       CTLFLAG_PERMANENT,
    355      1.50    atatat 		       CTLTYPE_STRUCT, "pcblist",
    356      1.50    atatat 		       SYSCTL_DESCR("SOCK_DGRAM protocol control block list"),
    357      1.50    atatat 		       sysctl_unpcblist, 0, NULL, 0,
    358      1.50    atatat 		       CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_CREATE, CTL_EOL);
    359       1.1       cgd }
    360       1.1       cgd 
    361       1.4    andrew void
    362      1.49      matt pfctlinput(int cmd, struct sockaddr *sa)
    363       1.1       cgd {
    364      1.31  augustss 	struct domain *dp;
    365      1.47      matt 	const struct protosw *pr;
    366       1.1       cgd 
    367      1.49      matt 	DOMAIN_FOREACH(dp)
    368       1.1       cgd 		for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
    369       1.1       cgd 			if (pr->pr_ctlinput)
    370      1.13  christos 				(*pr->pr_ctlinput)(cmd, sa, NULL);
    371      1.34    itojun }
    372      1.34    itojun 
    373      1.34    itojun void
    374      1.49      matt pfctlinput2(int cmd, struct sockaddr *sa, void *ctlparam)
    375      1.34    itojun {
    376      1.34    itojun 	struct domain *dp;
    377      1.47      matt 	const struct protosw *pr;
    378      1.34    itojun 
    379      1.34    itojun 	if (!sa)
    380      1.34    itojun 		return;
    381      1.49      matt 
    382      1.49      matt 	DOMAIN_FOREACH(dp) {
    383      1.34    itojun 		/*
    384      1.34    itojun 		 * the check must be made by xx_ctlinput() anyways, to
    385      1.34    itojun 		 * make sure we use data item pointed to by ctlparam in
    386      1.34    itojun 		 * correct way.  the following check is made just for safety.
    387      1.34    itojun 		 */
    388      1.34    itojun 		if (dp->dom_family != sa->sa_family)
    389      1.34    itojun 			continue;
    390      1.34    itojun 
    391      1.34    itojun 		for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
    392      1.34    itojun 			if (pr->pr_ctlinput)
    393      1.34    itojun 				(*pr->pr_ctlinput)(cmd, sa, ctlparam);
    394      1.34    itojun 	}
    395       1.1       cgd }
    396       1.1       cgd 
    397       1.4    andrew void
    398      1.49      matt pfslowtimo(void *arg)
    399       1.1       cgd {
    400      1.31  augustss 	struct domain *dp;
    401      1.47      matt 	const struct protosw *pr;
    402       1.1       cgd 
    403      1.19   thorpej 	pfslowtimo_now++;
    404      1.19   thorpej 
    405      1.49      matt 	DOMAIN_FOREACH(dp) {
    406       1.1       cgd 		for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
    407       1.1       cgd 			if (pr->pr_slowtimo)
    408       1.1       cgd 				(*pr->pr_slowtimo)();
    409      1.49      matt 	}
    410      1.30   thorpej 	callout_reset(&pfslowtimo_ch, hz / 2, pfslowtimo, NULL);
    411       1.1       cgd }
    412       1.1       cgd 
    413       1.4    andrew void
    414      1.49      matt pffasttimo(void *arg)
    415       1.1       cgd {
    416      1.31  augustss 	struct domain *dp;
    417      1.47      matt 	const struct protosw *pr;
    418      1.19   thorpej 
    419      1.19   thorpej 	pffasttimo_now++;
    420       1.1       cgd 
    421      1.49      matt 	DOMAIN_FOREACH(dp) {
    422       1.1       cgd 		for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
    423       1.1       cgd 			if (pr->pr_fasttimo)
    424       1.1       cgd 				(*pr->pr_fasttimo)();
    425      1.49      matt 	}
    426      1.30   thorpej 	callout_reset(&pffasttimo_ch, hz / 5, pffasttimo, NULL);
    427       1.1       cgd }
    428