Module Name:    src
Committed By:   ozaki-r
Date:           Fri Apr  7 03:31:50 UTC 2017

Modified Files:
        src/sys/netinet: ip_encap.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/netinet/ip_encap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/ip_encap.c
diff -u src/sys/netinet/ip_encap.c:1.62 src/sys/netinet/ip_encap.c:1.63
--- src/sys/netinet/ip_encap.c:1.62	Thu Dec 22 04:54:54 2016
+++ src/sys/netinet/ip_encap.c	Fri Apr  7 03:31:50 2017
@@ -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];	/
 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

Reply via email to