/*
- * Copyright (c) 2000-2011 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2012 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#include <sys/mbuf.h>
#include <sys/mcache.h>
#include <sys/errno.h>
+#include <sys/domain.h>
#include <sys/protosw.h>
#include <sys/queue.h>
MALLOC_DEFINE(M_NETADDR, "Export Host", "Export host address structure");
#endif
+static void encap_init(struct protosw *, struct domain *);
static void encap_add(struct encaptab *);
static int mask_match(const struct encaptab *, const struct sockaddr *,
const struct sockaddr *);
LIST_HEAD(, encaptab) encaptab = LIST_HEAD_INITIALIZER(&encaptab);
#endif
-void
-encap_init()
+static void
+encap_init(struct protosw *pp, struct domain *dp)
{
- static int initialized = 0;
+#pragma unused(dp)
+ static int encap_initialized = 0;
+
+ VERIFY((pp->pr_flags & (PR_INITIALIZED|PR_ATTACHED)) == PR_ATTACHED);
- if (initialized)
+ /* This gets called by more than one protocols, so initialize once */
+ if (encap_initialized)
return;
- initialized++;
+ encap_initialized = 1;
#if 0
/*
* we cannot use LIST_INIT() here, since drivers may want to call
#endif
}
+void
+encap4_init(struct protosw *pp, struct domain *dp)
+{
+ encap_init(pp, dp);
+}
+
+void
+encap6_init(struct ip6protosw *pp, struct domain *dp)
+{
+ encap_init((struct protosw *)pp, dp);
+}
+
#if INET
void
encap4_input(m, off)