Commit a forgotten change for "Prepare netipsec for rump-ification"

- Allow encapinit to be called twice (by ifinit and ipe4_attach)
  - ifinit didn't call encapinit if IPSEC is enabled (ipe4_attach called
    it instead), however, on a rump kernel ipe4_attach may not be called
    even if IPSEC is enabled. So we need to allow ifinit to call it anyway
This commit is contained in:
ozaki-r 2017-04-07 03:31:50 +00:00
parent 2667b4dcaa
commit 0d787d119d

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_encap.c,v 1.62 2016/12/22 04:54:54 knakahara Exp $ */
/* $NetBSD: ip_encap.c,v 1.63 2017/04/07 03:31:50 ozaki-r Exp $ */
/* $KAME: ip_encap.c,v 1.73 2001/10/02 08:30:58 itojun Exp $ */
/*
@ -68,7 +68,7 @@
#define USE_RADIX
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.62 2016/12/22 04:54:54 knakahara Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.63 2017/04/07 03:31:50 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_mrouting.h"
@ -161,6 +161,7 @@ struct radix_node_head *encap_head[2]; /* 0 for AF_INET, 1 for AF_INET6 */
static bool encap_head_updating = false;
#endif
static bool encap_initialized = false;
/*
* must be done before other encap interfaces initialization.
*/
@ -168,6 +169,9 @@ void
encapinit(void)
{
if (encap_initialized)
return;
encaptab.psz = pserialize_create();
encaptab.elem_class = psref_class_create("encapelem", IPL_SOFTNET);
if (encaptab.elem_class == NULL)
@ -176,6 +180,8 @@ encapinit(void)
mutex_init(&encap_whole.lock, MUTEX_DEFAULT, IPL_NONE);
cv_init(&encap_whole.cv, "ip_encap cv");
encap_whole.busy = NULL;
encap_initialized = true;
}
void