Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Commit a forgotten change for "Prepare netipsec ...



details:   https://anonhg.NetBSD.org/src/rev/c27b9d1e4b7e
branches:  trunk
changeset: 822791:c27b9d1e4b7e
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Apr 07 03:31:50 2017 +0000

description:
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

diffstat:

 sys/netinet/ip_encap.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 64c34b172b94 -r c27b9d1e4b7e sys/netinet/ip_encap.c
--- a/sys/netinet/ip_encap.c    Fri Apr 07 00:56:14 2017 +0000
+++ b/sys/netinet/ip_encap.c    Fri Apr 07 03:31:50 2017 +0000
@@ -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 @@
 static bool encap_head_updating = false;
 #endif
 
+static bool encap_initialized = false;
 /*
  * must be done before other encap interfaces initialization.
  */
@@ -168,6 +169,9 @@
 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 @@
        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



Home | Main Index | Thread Index | Old Index