diff options
author | Andrey V. Elsukov <ae@FreeBSD.org> | 2018-10-23 13:03:03 +0000 |
---|---|---|
committer | Andrey V. Elsukov <ae@FreeBSD.org> | 2018-10-23 13:03:03 +0000 |
commit | 221022e190cf8c0e1462ead5e3c33f7093a95ce2 (patch) | |
tree | 559e33e4f2b2fb02f797725d2df0383480a9f1e3 | |
parent | 5acedb55c0c249dd7c02bbfda09f10a9267f76fd (diff) |
Notes
-rw-r--r-- | sys/net/if_ipsec.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/net/if_ipsec.c b/sys/net/if_ipsec.c index a603d0b237bd..8dad10cd33bd 100644 --- a/sys/net/if_ipsec.c +++ b/sys/net/if_ipsec.c @@ -273,6 +273,13 @@ vnet_ipsec_uninit(const void *unused __unused) if_clone_detach(V_ipsec_cloner); free(V_ipsec_idhtbl, M_IPSEC); + /* + * Use V_ipsec_idhtbl pointer as indicator that VNET is going to be + * destroyed, it is used by ipsec_srcaddr() callback. + */ + V_ipsec_idhtbl = NULL; + IPSEC_WAIT(); + #ifdef INET if (IS_DEFAULT_VNET(curvnet)) ip_encap_unregister_srcaddr(ipsec4_srctab); @@ -785,6 +792,10 @@ ipsec_srcaddr(void *arg __unused, const struct sockaddr *sa, struct ipsec_softc *sc; struct secasindex *saidx; + /* Check that VNET is ready */ + if (V_ipsec_idhtbl == NULL) + return; + MPASS(in_epoch(net_epoch_preempt)); CK_LIST_FOREACH(sc, ipsec_srchash(sa), srchash) { if (sc->family == 0) |