Change initialzie of domains to use link sets. Switch to using STAILQ.
Add a convenience macro DOMAIN_FOREACH to interate through the domain.
This commit is contained in:
parent
fba432b011
commit
d341be30f4
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uipc_domain.c,v 1.48 2004/05/25 04:33:59 atatat Exp $ */
|
||||
/* $NetBSD: uipc_domain.c,v 1.49 2005/01/23 18:41:56 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
|
@ -32,17 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.48 2004/05/25 04:33:59 atatat Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ipsec.h"
|
||||
#include "opt_atalk.h"
|
||||
#include "opt_ccitt.h"
|
||||
#include "opt_iso.h"
|
||||
#include "opt_ns.h"
|
||||
#include "opt_mbuftrace.h"
|
||||
#include "opt_natm.h"
|
||||
#include "arp.h"
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.49 2005/01/23 18:41:56 matt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -53,13 +43,14 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.48 2004/05/25 04:33:59 atatat Exp
|
|||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/callout.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
void pffasttimo(void *);
|
||||
void pfslowtimo(void *);
|
||||
|
||||
struct domain *domains;
|
||||
struct domainhead domains = STAILQ_HEAD_INITIALIZER(domains);
|
||||
|
||||
struct callout pffasttimo_ch, pfslowtimo_ch;
|
||||
|
||||
|
@ -71,76 +62,25 @@ struct callout pffasttimo_ch, pfslowtimo_ch;
|
|||
u_int pfslowtimo_now;
|
||||
u_int pffasttimo_now;
|
||||
|
||||
#define ADDDOMAIN(x) { \
|
||||
extern struct domain __CONCAT(x,domain); \
|
||||
__CONCAT(x,domain.dom_next) = domains; \
|
||||
domains = &__CONCAT(x,domain); \
|
||||
}
|
||||
|
||||
void
|
||||
domaininit()
|
||||
{
|
||||
struct domain *dp;
|
||||
const struct protosw *pr;
|
||||
__link_set_decl(domains, struct domain);
|
||||
struct domain * const * dpp;
|
||||
struct domain *rt_domain = NULL;
|
||||
|
||||
#undef unix
|
||||
/*
|
||||
* KAME NOTE: ADDDOMAIN(route) is moved to the last part so that
|
||||
* it will be initialized as the *first* element. confusing!
|
||||
* Add all of the domains. Make sure the PF_ROUTE
|
||||
* domain is added last.
|
||||
*/
|
||||
#ifndef lint
|
||||
ADDDOMAIN(unix);
|
||||
#ifdef INET
|
||||
ADDDOMAIN(inet);
|
||||
#endif
|
||||
#ifdef INET6
|
||||
ADDDOMAIN(inet6);
|
||||
#endif
|
||||
#ifdef NS
|
||||
ADDDOMAIN(ns);
|
||||
#endif
|
||||
#ifdef ISO
|
||||
ADDDOMAIN(iso);
|
||||
#endif
|
||||
#ifdef CCITT
|
||||
ADDDOMAIN(ccitt);
|
||||
#endif
|
||||
#ifdef NATM
|
||||
ADDDOMAIN(natm);
|
||||
#endif
|
||||
#ifdef NETATALK
|
||||
ADDDOMAIN(atalk);
|
||||
#endif
|
||||
#if defined(IPSEC) || defined(FAST_IPSEC)
|
||||
ADDDOMAIN(key);
|
||||
#endif
|
||||
#ifdef INET
|
||||
#if NARP > 0
|
||||
ADDDOMAIN(arp);
|
||||
#endif
|
||||
#endif
|
||||
ADDDOMAIN(route);
|
||||
#endif /* ! lint */
|
||||
|
||||
for (dp = domains; dp; dp = dp->dom_next) {
|
||||
if (dp->dom_init)
|
||||
(*dp->dom_init)();
|
||||
#ifdef MBUFTRACE
|
||||
if (dp->dom_mowner.mo_name[0] == '\0') {
|
||||
strncpy(dp->dom_mowner.mo_name, dp->dom_name,
|
||||
sizeof(dp->dom_mowner.mo_name));
|
||||
MOWNER_ATTACH(&dp->dom_mowner);
|
||||
}
|
||||
#endif
|
||||
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
|
||||
if (pr->pr_init)
|
||||
(*pr->pr_init)();
|
||||
__link_set_foreach(dpp, domains) {
|
||||
if ((*dpp)->dom_family == PF_ROUTE)
|
||||
rt_domain = *dpp;
|
||||
else
|
||||
domain_attach(*dpp);
|
||||
}
|
||||
|
||||
if (max_linkhdr < 16) /* XXX */
|
||||
max_linkhdr = 16;
|
||||
max_hdr = max_linkhdr + max_protohdr;
|
||||
max_datalen = MHLEN - max_hdr;
|
||||
if (rt_domain)
|
||||
domain_attach(rt_domain);
|
||||
|
||||
callout_init(&pffasttimo_ch);
|
||||
callout_init(&pfslowtimo_ch);
|
||||
|
@ -149,21 +89,47 @@ domaininit()
|
|||
callout_reset(&pfslowtimo_ch, 1, pfslowtimo, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
domain_attach(struct domain *dp)
|
||||
{
|
||||
const struct protosw *pr;
|
||||
|
||||
STAILQ_INSERT_TAIL(&domains, dp, dom_link);
|
||||
|
||||
if (dp->dom_init)
|
||||
(*dp->dom_init)();
|
||||
|
||||
#ifdef MBUFTRACE
|
||||
if (dp->dom_mowner.mo_name[0] == '\0') {
|
||||
strncpy(dp->dom_mowner.mo_name, dp->dom_name,
|
||||
sizeof(dp->dom_mowner.mo_name));
|
||||
MOWNER_ATTACH(&dp->dom_mowner);
|
||||
}
|
||||
#endif
|
||||
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) {
|
||||
if (pr->pr_init)
|
||||
(*pr->pr_init)();
|
||||
}
|
||||
|
||||
if (max_linkhdr < 16) /* XXX */
|
||||
max_linkhdr = 16;
|
||||
max_hdr = max_linkhdr + max_protohdr;
|
||||
max_datalen = MHLEN - max_hdr;
|
||||
}
|
||||
|
||||
struct domain *
|
||||
pffinddomain(family)
|
||||
int family;
|
||||
pffinddomain(int family)
|
||||
{
|
||||
struct domain *dp;
|
||||
|
||||
for (dp = domains; dp != NULL; dp = dp->dom_next)
|
||||
DOMAIN_FOREACH(dp)
|
||||
if (dp->dom_family == family)
|
||||
return (dp);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
const struct protosw *
|
||||
pffindtype(family, type)
|
||||
int family, type;
|
||||
pffindtype(int family, int type)
|
||||
{
|
||||
struct domain *dp;
|
||||
const struct protosw *pr;
|
||||
|
@ -180,8 +146,7 @@ pffindtype(family, type)
|
|||
}
|
||||
|
||||
const struct protosw *
|
||||
pffindproto(family, protocol, type)
|
||||
int family, protocol, type;
|
||||
pffindproto(int family, int protocol, int type)
|
||||
{
|
||||
struct domain *dp;
|
||||
const struct protosw *pr;
|
||||
|
@ -228,31 +193,27 @@ SYSCTL_SETUP(sysctl_net_setup, "sysctl net subtree setup")
|
|||
}
|
||||
|
||||
void
|
||||
pfctlinput(cmd, sa)
|
||||
int cmd;
|
||||
struct sockaddr *sa;
|
||||
pfctlinput(int cmd, struct sockaddr *sa)
|
||||
{
|
||||
struct domain *dp;
|
||||
const struct protosw *pr;
|
||||
|
||||
for (dp = domains; dp; dp = dp->dom_next)
|
||||
DOMAIN_FOREACH(dp)
|
||||
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
|
||||
if (pr->pr_ctlinput)
|
||||
(*pr->pr_ctlinput)(cmd, sa, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
pfctlinput2(cmd, sa, ctlparam)
|
||||
int cmd;
|
||||
struct sockaddr *sa;
|
||||
void *ctlparam;
|
||||
pfctlinput2(int cmd, struct sockaddr *sa, void *ctlparam)
|
||||
{
|
||||
struct domain *dp;
|
||||
const struct protosw *pr;
|
||||
|
||||
if (!sa)
|
||||
return;
|
||||
for (dp = domains; dp; dp = dp->dom_next) {
|
||||
|
||||
DOMAIN_FOREACH(dp) {
|
||||
/*
|
||||
* the check must be made by xx_ctlinput() anyways, to
|
||||
* make sure we use data item pointed to by ctlparam in
|
||||
|
@ -268,33 +229,33 @@ pfctlinput2(cmd, sa, ctlparam)
|
|||
}
|
||||
|
||||
void
|
||||
pfslowtimo(arg)
|
||||
void *arg;
|
||||
pfslowtimo(void *arg)
|
||||
{
|
||||
struct domain *dp;
|
||||
const struct protosw *pr;
|
||||
|
||||
pfslowtimo_now++;
|
||||
|
||||
for (dp = domains; dp; dp = dp->dom_next)
|
||||
DOMAIN_FOREACH(dp) {
|
||||
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
|
||||
if (pr->pr_slowtimo)
|
||||
(*pr->pr_slowtimo)();
|
||||
}
|
||||
callout_reset(&pfslowtimo_ch, hz / 2, pfslowtimo, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
pffasttimo(arg)
|
||||
void *arg;
|
||||
pffasttimo(void *arg)
|
||||
{
|
||||
struct domain *dp;
|
||||
const struct protosw *pr;
|
||||
|
||||
pffasttimo_now++;
|
||||
|
||||
for (dp = domains; dp; dp = dp->dom_next)
|
||||
DOMAIN_FOREACH(dp) {
|
||||
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
|
||||
if (pr->pr_fasttimo)
|
||||
(*pr->pr_fasttimo)();
|
||||
}
|
||||
callout_reset(&pffasttimo_ch, hz / 5, pffasttimo, NULL);
|
||||
}
|
||||
|
|
|
@ -378,12 +378,13 @@ m_reclaim(void *arg, int flags)
|
|||
struct ifnet *ifp;
|
||||
int s = splvm();
|
||||
|
||||
for (dp = domains; dp; dp = dp->dom_next)
|
||||
DOMAIN_FOREACH(dp) {
|
||||
for (pr = dp->dom_protosw;
|
||||
pr < dp->dom_protoswNPROTOSW; pr++)
|
||||
if (pr->pr_drain)
|
||||
(*pr->pr_drain)();
|
||||
for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list))
|
||||
}
|
||||
TAILQ_FOREACH(ifp, &ifnet, if_list)
|
||||
if (ifp->if_drain)
|
||||
(*ifp->if_drain)(ifp);
|
||||
splx(s);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uipc_proto.c,v 1.15 2004/04/22 01:01:40 matt Exp $ */
|
||||
/* $NetBSD: uipc_proto.c,v 1.16 2005/01/23 18:41:56 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_proto.c,v 1.15 2004/04/22 01:01:40 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_proto.c,v 1.16 2005/01/23 18:41:56 matt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_proto.c,v 1.15 2004/04/22 01:01:40 matt Exp $")
|
|||
* Definitions of protocols supported in the UNIX domain.
|
||||
*/
|
||||
|
||||
extern struct domain unixdomain; /* or at least forward */
|
||||
DOMAIN_DEFINE(unixdomain); /* forward define and add to link set */
|
||||
|
||||
const struct protosw unixsw[] = {
|
||||
{ SOCK_STREAM, &unixdomain, 0, PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS|PR_LISTEN,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vfs_subr.c,v 1.240 2005/01/12 21:51:52 christos Exp $ */
|
||||
/* $NetBSD: vfs_subr.c,v 1.241 2005/01/23 18:41:56 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -78,7 +78,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.240 2005/01/12 21:51:52 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.241 2005/01/23 18:41:56 matt Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ddb.h"
|
||||
|
@ -2345,12 +2345,13 @@ vfs_hang_addrlist(mp, nep, argp)
|
|||
* Seems silly to initialize every AF when most are not
|
||||
* used, do so on demand here
|
||||
*/
|
||||
for (dom = domains; dom; dom = dom->dom_next)
|
||||
DOMAIN_FOREACH(dom) {
|
||||
if (dom->dom_family == i && dom->dom_rtattach) {
|
||||
dom->dom_rtattach((void **)&nep->ne_rtable[i],
|
||||
dom->dom_rtoffset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((rnh = nep->ne_rtable[i]) == 0) {
|
||||
error = ENOBUFS;
|
||||
goto out;
|
||||
|
|
10
sys/net/if.c
10
sys/net/if.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if.c,v 1.151 2005/01/09 12:18:46 yamt Exp $ */
|
||||
/* $NetBSD: if.c,v 1.152 2005/01/23 18:41:56 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -97,7 +97,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.151 2005/01/09 12:18:46 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.152 2005/01/23 18:41:56 matt Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
|
@ -480,7 +480,7 @@ if_attach(ifp)
|
|||
(struct mbuf **)PFIL_IFNET_ATTACH, ifp, PFIL_IFNET);
|
||||
#endif
|
||||
|
||||
if (domains)
|
||||
if (!STAILQ_EMPTY(&domains))
|
||||
if_attachdomain1(ifp);
|
||||
|
||||
/* Announce the interface. */
|
||||
|
@ -510,7 +510,7 @@ if_attachdomain1(ifp)
|
|||
|
||||
/* address family dependent data region */
|
||||
memset(ifp->if_afdata, 0, sizeof(ifp->if_afdata));
|
||||
for (dp = domains; dp; dp = dp->dom_next) {
|
||||
DOMAIN_FOREACH(dp) {
|
||||
if (dp->dom_ifattach)
|
||||
ifp->if_afdata[dp->dom_family] =
|
||||
(*dp->dom_ifattach)(ifp);
|
||||
|
@ -647,7 +647,7 @@ if_detach(ifp)
|
|||
(void) (*rnh->rnh_walktree)(rnh, if_rt_walktree, ifp);
|
||||
}
|
||||
|
||||
for (dp = domains; dp; dp = dp->dom_next) {
|
||||
DOMAIN_FOREACH(dp) {
|
||||
if (dp->dom_ifdetach && ifp->if_afdata[dp->dom_family])
|
||||
(*dp->dom_ifdetach)(ifp,
|
||||
ifp->if_afdata[dp->dom_family]);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: radix.c,v 1.25 2004/12/06 02:59:23 christos Exp $ */
|
||||
/* $NetBSD: radix.c,v 1.26 2005/01/23 18:41:56 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1993
|
||||
|
@ -36,7 +36,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: radix.c,v 1.25 2004/12/06 02:59:23 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: radix.c,v 1.26 2005/01/23 18:41:56 matt Exp $");
|
||||
|
||||
#ifndef _NET_RADIX_H_
|
||||
#include <sys/param.h>
|
||||
|
@ -945,7 +945,7 @@ rn_init()
|
|||
#ifdef _KERNEL
|
||||
struct domain *dom;
|
||||
|
||||
for (dom = domains; dom; dom = dom->dom_next)
|
||||
DOMAIN_FOREACH(dom)
|
||||
if (dom->dom_maxrtkey > max_keylen)
|
||||
max_keylen = dom->dom_maxrtkey;
|
||||
#ifdef INET
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: route.c,v 1.63 2004/09/30 00:14:05 christos Exp $ */
|
||||
/* $NetBSD: route.c,v 1.64 2005/01/23 18:41:56 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -98,7 +98,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.63 2004/09/30 00:14:05 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.64 2005/01/23 18:41:56 matt Exp $");
|
||||
|
||||
#include "opt_ns.h"
|
||||
|
||||
|
@ -148,7 +148,7 @@ void
|
|||
rtable_init(void **table)
|
||||
{
|
||||
struct domain *dom;
|
||||
for (dom = domains; dom; dom = dom->dom_next)
|
||||
DOMAIN_FOREACH(dom)
|
||||
if (dom->dom_rtattach)
|
||||
dom->dom_rtattach(&table[dom->dom_family],
|
||||
dom->dom_rtoffset);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rtsock.c,v 1.72 2004/10/23 19:13:22 christos Exp $ */
|
||||
/* $NetBSD: rtsock.c,v 1.73 2005/01/23 18:41:57 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.72 2004/10/23 19:13:22 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.73 2005/01/23 18:41:57 matt Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
|
@ -81,7 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.72 2004/10/23 19:13:22 christos Exp $")
|
|||
|
||||
#include <machine/stdarg.h>
|
||||
|
||||
extern struct domain routedomain; /* or at least forward */
|
||||
DOMAIN_DEFINE(routedomain); /* forward declare and add to link set */
|
||||
|
||||
struct sockaddr route_dst = { 2, PF_ROUTE, };
|
||||
struct sockaddr route_src = { 2, PF_ROUTE, };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_arp.c,v 1.100 2004/12/04 16:10:25 peter Exp $ */
|
||||
/* $NetBSD: if_arp.c,v 1.101 2005/01/23 18:41:57 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -75,7 +75,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.100 2004/12/04 16:10:25 peter Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.101 2005/01/23 18:41:57 matt Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_inet.h"
|
||||
|
@ -141,8 +141,6 @@ int arpt_refresh = (5*60); /* time left before refreshing */
|
|||
#define rt_expire rt_rmx.rmx_expire
|
||||
#define rt_pksent rt_rmx.rmx_pksent
|
||||
|
||||
extern struct domain arpdomain;
|
||||
|
||||
static void arprequest __P((struct ifnet *,
|
||||
struct in_addr *, struct in_addr *, u_int8_t *));
|
||||
static void arptfree __P((struct llinfo_arp *));
|
||||
|
@ -215,8 +213,10 @@ lla_snprintf(adrp, len)
|
|||
return p;
|
||||
}
|
||||
|
||||
DOMAIN_DEFINE(arpdomain); /* forward declare and add to link set */
|
||||
|
||||
const struct protosw arpsw[] = {
|
||||
{ 0, 0, 0, 0,
|
||||
{ 0, &arpdomain, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, arp_drain,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: in_proto.c,v 1.65 2004/09/04 23:30:07 manu Exp $ */
|
||||
/* $NetBSD: in_proto.c,v 1.66 2005/01/23 18:41:57 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.65 2004/09/04 23:30:07 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.66 2005/01/23 18:41:57 matt Exp $");
|
||||
|
||||
#include "opt_mrouting.h"
|
||||
#include "opt_eon.h" /* ISO CLNL over IP */
|
||||
|
@ -146,6 +146,8 @@ __KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.65 2004/09/04 23:30:07 manu Exp $");
|
|||
#include <netinet/ip_gre.h>
|
||||
#endif
|
||||
|
||||
DOMAIN_DEFINE(inetdomain); /* forward declare and add to link set */
|
||||
|
||||
const struct protosw inetsw[] = {
|
||||
{ 0, &inetdomain, 0, 0,
|
||||
0, ip_output, 0, 0,
|
||||
|
@ -286,7 +288,7 @@ const struct protosw inetsw[] = {
|
|||
|
||||
struct domain inetdomain =
|
||||
{ PF_INET, "internet", 0, 0, 0,
|
||||
inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])], 0,
|
||||
inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])],
|
||||
rn_inithead, 32, sizeof(struct sockaddr_in) };
|
||||
|
||||
u_char ip_protox[IPPROTO_MAX];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: in6_proto.c,v 1.57 2004/04/22 01:01:41 matt Exp $ */
|
||||
/* $NetBSD: in6_proto.c,v 1.58 2005/01/23 18:41:57 matt Exp $ */
|
||||
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -62,7 +62,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.57 2004/04/22 01:01:41 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.58 2005/01/23 18:41:57 matt Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ipsec.h"
|
||||
|
@ -127,7 +127,7 @@ __KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.57 2004/04/22 01:01:41 matt Exp $");
|
|||
* TCP/IP protocol family: IP6, ICMP6, UDP, TCP.
|
||||
*/
|
||||
|
||||
extern struct domain inet6domain;
|
||||
DOMAIN_DEFINE(inet6domain); /* forward declare and add to link set */
|
||||
|
||||
const struct ip6protosw inet6sw[] = {
|
||||
{ 0, &inet6domain, IPPROTO_IPV6, 0,
|
||||
|
@ -235,7 +235,7 @@ const struct ip6protosw inet6sw[] = {
|
|||
struct domain inet6domain =
|
||||
{ AF_INET6, "internet6", 0, 0, 0,
|
||||
(struct protosw *)inet6sw,
|
||||
(struct protosw *)&inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])], 0,
|
||||
(struct protosw *)&inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])],
|
||||
rn_inithead,
|
||||
offsetof(struct sockaddr_in6, sin6_addr) << 3,
|
||||
sizeof(struct sockaddr_in6),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: keysock.c,v 1.5 2004/06/10 01:39:59 jonathan Exp $ */
|
||||
/* $NetBSD: keysock.c,v 1.6 2005/01/23 18:41:57 matt Exp $ */
|
||||
/* $FreeBSD: src/sys/netipsec/keysock.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */
|
||||
/* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $ */
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.5 2004/06/10 01:39:59 jonathan Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.6 2005/01/23 18:41:57 matt Exp $");
|
||||
|
||||
#include "opt_ipsec.h"
|
||||
|
||||
|
@ -676,10 +676,9 @@ SYSCTL_NODE(_net, PF_KEY, key, CTLFLAG_RW, 0, "Key Family");
|
|||
* Definitions of protocols supported in the KEY domain.
|
||||
*/
|
||||
|
||||
/* This extern declaration is all that's common... */
|
||||
#ifdef __FreeBSD__
|
||||
extern struct domain keydomain;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
struct pr_usrreqs key_usrreqs = {
|
||||
key_abort, pru_accept_notsupp, key_attach, key_bind,
|
||||
key_connect,
|
||||
|
@ -714,6 +713,7 @@ DOMAIN_SET(key);
|
|||
|
||||
#else /* !__FreeBSD__ */
|
||||
|
||||
DOMAIN_DEFINE(keydomain);
|
||||
|
||||
struct protosw keysw[] = {
|
||||
{ SOCK_RAW, &keydomain, PF_KEY_V2, PR_ATOMIC|PR_ADDR,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: iso_proto.c,v 1.16 2004/04/22 01:01:41 matt Exp $ */
|
||||
/* $NetBSD: iso_proto.c,v 1.17 2005/01/23 18:41:57 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -65,11 +65,9 @@ SOFTWARE.
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: iso_proto.c,v 1.16 2004/04/22 01:01:41 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: iso_proto.c,v 1.17 2005/01/23 18:41:57 matt Exp $");
|
||||
|
||||
#include "opt_iso.h"
|
||||
|
||||
#ifdef ISO
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/protosw.h>
|
||||
|
@ -97,6 +95,8 @@ const int isoctlerrmap[PRC_NCMDS] = {
|
|||
ENOPROTOOPT
|
||||
};
|
||||
|
||||
DOMAIN_DEFINE(isodomain); /* forward declare and add to link set */
|
||||
|
||||
const struct protosw isosw[] = {
|
||||
/*
|
||||
* We need a datagram entry through which net mgmt programs can get
|
||||
|
@ -180,9 +180,7 @@ struct domain isodomain = {
|
|||
0, /* dispose of internalized rights */
|
||||
isosw, /* protosw */
|
||||
&isosw[sizeof(isosw) / sizeof(isosw[0])], /* NPROTOSW */
|
||||
0, /* next */
|
||||
rn_inithead, /* rtattach */
|
||||
48, /* rtoffset */
|
||||
sizeof(struct sockaddr_iso) /* maxkeylen */
|
||||
};
|
||||
#endif /* ISO */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: keysock.c,v 1.39 2004/07/24 09:15:56 yamt Exp $ */
|
||||
/* $NetBSD: keysock.c,v 1.40 2005/01/23 18:41:57 matt Exp $ */
|
||||
/* $KAME: keysock.c,v 1.32 2003/08/22 05:45:08 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.39 2004/07/24 09:15:56 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.40 2005/01/23 18:41:57 matt Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
|
@ -447,7 +447,7 @@ key_sendup_mbuf(so, m, target)
|
|||
* Definitions of protocols supported in the KEY domain.
|
||||
*/
|
||||
|
||||
extern struct domain keydomain;
|
||||
DOMAIN_DEFINE(keydomain);
|
||||
|
||||
const struct protosw keysw[] = {
|
||||
{ SOCK_RAW, &keydomain, PF_KEY_V2, PR_ATOMIC|PR_ADDR,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: natm.h,v 1.5 2003/06/29 22:32:08 fvdl Exp $ */
|
||||
/* $NetBSD: natm.h,v 1.6 2005/01/23 18:41:57 matt Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -116,7 +116,7 @@ LIST_HEAD(npcblist, natmpcb);
|
|||
|
||||
/* global data structures */
|
||||
|
||||
struct npcblist natm_pcbs; /* global list of pcbs */
|
||||
extern struct npcblist natm_pcbs; /* global list of pcbs */
|
||||
extern struct ifqueue natmintrq; /* natm packet input queue */
|
||||
#define NATM_STAT
|
||||
#ifdef NATM_STAT
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: natm_proto.c,v 1.5 2001/11/13 01:37:45 lukem Exp $ */
|
||||
/* $NetBSD: natm_proto.c,v 1.6 2005/01/23 18:41:57 matt Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: natm_proto.c,v 1.5 2001/11/13 01:37:45 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: natm_proto.c,v 1.6 2005/01/23 18:41:57 matt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -56,42 +56,36 @@ __KERNEL_RCSID(0, "$NetBSD: natm_proto.c,v 1.5 2001/11/13 01:37:45 lukem Exp $")
|
|||
|
||||
#include <netnatm/natm.h>
|
||||
|
||||
extern struct domain natmdomain;
|
||||
DOMAIN_DEFINE(natmdomain);
|
||||
|
||||
static void natm_init __P((void));
|
||||
static void natm_init(void);
|
||||
|
||||
struct protosw natmsw[] = {
|
||||
const struct protosw natmsw[] = {
|
||||
{ SOCK_STREAM, &natmdomain, PROTO_NATMAAL5, PR_CONNREQUIRED,
|
||||
0, 0, 0, 0,
|
||||
natm_usrreq,
|
||||
0, 0, 0, 0,
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
natm5_sysctl
|
||||
#endif
|
||||
},
|
||||
{ SOCK_DGRAM, &natmdomain, PROTO_NATMAAL5, PR_CONNREQUIRED | PR_ATOMIC,
|
||||
0, 0, 0, 0,
|
||||
natm_usrreq,
|
||||
0, 0, 0, 0,
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
natm5_sysctl
|
||||
#endif
|
||||
},
|
||||
{ SOCK_STREAM, &natmdomain, PROTO_NATMAAL0, PR_CONNREQUIRED,
|
||||
0, 0, 0, 0,
|
||||
natm_usrreq,
|
||||
0, 0, 0, 0,
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
natm0_sysctl
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
struct domain natmdomain =
|
||||
{ PF_NATM, "natm", natm_init, 0, 0,
|
||||
natmsw, &natmsw[sizeof(natmsw)/sizeof(natmsw[0])], 0,
|
||||
0, 0, 0};
|
||||
natmsw, &natmsw[sizeof(natmsw)/sizeof(natmsw[0])] };
|
||||
|
||||
struct npcblist natm_pcbs = LIST_HEAD_INITIALIZER(natm_pcbs);
|
||||
struct ifqueue natmintrq; /* natm packet input queue */
|
||||
int natmqmaxlen = IFQ_MAXLEN; /* max # of packets on queue */
|
||||
#ifdef NATM_STAT
|
||||
|
@ -101,16 +95,7 @@ u_int natm_sookcnt = 0; /* # mbufs ok */
|
|||
u_int natm_sookbytes = 0; /* # of bytes ok */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void natm_init()
|
||||
|
||||
void natm_init(void)
|
||||
{
|
||||
LIST_INIT(&natm_pcbs);
|
||||
bzero(&natmintrq, sizeof(natmintrq));
|
||||
natmintrq.ifq_maxlen = natmqmaxlen;
|
||||
natmintrq.ifq_maxlen = natmqmaxlen;
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
DOMAIN_SET(natm);
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ns_proto.c,v 1.13 2004/04/22 01:01:41 matt Exp $ */
|
||||
/* $NetBSD: ns_proto.c,v 1.14 2005/01/23 18:41:56 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1984, 1985, 1986, 1987, 1993
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ns_proto.c,v 1.13 2004/04/22 01:01:41 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ns_proto.c,v 1.14 2005/01/23 18:41:56 matt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -59,7 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: ns_proto.c,v 1.13 2004/04/22 01:01:41 matt Exp $");
|
|||
#include <netns/spp_timer.h>
|
||||
#include <netns/spp_var.h>
|
||||
|
||||
extern struct domain nsdomain;
|
||||
DOMAIN_DEFINE(nsdomain); /* forward declare and add to link set */
|
||||
|
||||
const struct protosw nssw[] = {
|
||||
{ 0, &nsdomain, 0, 0,
|
||||
|
@ -96,6 +96,6 @@ const struct protosw nssw[] = {
|
|||
|
||||
struct domain nsdomain =
|
||||
{ PF_NS, "network systems", 0, 0, 0,
|
||||
nssw, &nssw[sizeof(nssw)/sizeof(nssw[0])], 0,
|
||||
nssw, &nssw[sizeof(nssw)/sizeof(nssw[0])],
|
||||
rn_inithead, 16, sizeof(struct sockaddr_ns)};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: domain.h,v 1.19 2004/05/22 22:52:16 jonathan Exp $ */
|
||||
/* $NetBSD: domain.h,v 1.20 2005/01/23 18:41:56 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
|
@ -48,7 +48,7 @@ struct ifnet;
|
|||
|
||||
struct domain {
|
||||
int dom_family; /* AF_xxx */
|
||||
char *dom_name;
|
||||
const char *dom_name;
|
||||
void (*dom_init) /* initialize domain data structures */
|
||||
(void);
|
||||
int (*dom_externalize) /* externalize access rights */
|
||||
|
@ -56,7 +56,6 @@ struct domain {
|
|||
void (*dom_dispose) /* dispose of internalized rights */
|
||||
(struct mbuf *);
|
||||
const struct protosw *dom_protosw, *dom_protoswNPROTOSW;
|
||||
struct domain *dom_next;
|
||||
int (*dom_rtattach) /* initialize routing table */
|
||||
(void **, int);
|
||||
int dom_rtoffset; /* an arg to rtattach, in bits */
|
||||
|
@ -65,11 +64,20 @@ struct domain {
|
|||
(struct ifnet *);
|
||||
void (*dom_ifdetach) /* detach af-dependent data on ifnet */
|
||||
(struct ifnet *, void *);
|
||||
STAILQ_ENTRY(domain) dom_link;
|
||||
struct mowner dom_mowner;
|
||||
};
|
||||
|
||||
STAILQ_HEAD(domainhead,domain);
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern struct domain *domains;
|
||||
#define DOMAIN_DEFINE(name) \
|
||||
extern struct domain name; \
|
||||
__link_set_add_data(domains, name)
|
||||
|
||||
#define DOMAIN_FOREACH(dom) STAILQ_FOREACH(dom, &domains, dom_link)
|
||||
extern struct domainhead domains;
|
||||
void domain_attach(struct domain *);
|
||||
void domaininit(void);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue