netipsec: use SYSINIT(9) instead of dom_init/dom_destroy
While here, use just static initializer for key_cb. Differential revision: https://reviews.freebsd.org/D33539
This commit is contained in:
parent
340c7343f4
commit
9880323a99
@ -8300,8 +8300,9 @@ spdcache_destroy(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
void
|
|
||||||
key_init(void)
|
static void
|
||||||
|
key_vnet_init(void *arg __unused)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -8327,9 +8328,13 @@ key_init(void)
|
|||||||
|
|
||||||
LIST_INIT(&V_acqtree);
|
LIST_INIT(&V_acqtree);
|
||||||
LIST_INIT(&V_spacqtree);
|
LIST_INIT(&V_spacqtree);
|
||||||
|
}
|
||||||
|
VNET_SYSINIT(key_vnet_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND,
|
||||||
|
key_vnet_init, NULL);
|
||||||
|
|
||||||
if (!IS_DEFAULT_VNET(curvnet))
|
static void
|
||||||
return;
|
key_init(void *arg __unused)
|
||||||
|
{
|
||||||
|
|
||||||
ipsec_key_lft_zone = uma_zcreate("IPsec SA lft_c",
|
ipsec_key_lft_zone = uma_zcreate("IPsec SA lft_c",
|
||||||
sizeof(uint64_t) * 2, NULL, NULL, NULL, NULL,
|
sizeof(uint64_t) * 2, NULL, NULL, NULL, NULL,
|
||||||
@ -8353,10 +8358,11 @@ key_init(void)
|
|||||||
if (bootverbose)
|
if (bootverbose)
|
||||||
printf("IPsec: Initialized Security Association Processing.\n");
|
printf("IPsec: Initialized Security Association Processing.\n");
|
||||||
}
|
}
|
||||||
|
SYSINIT(key_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, key_init, NULL);
|
||||||
|
|
||||||
#ifdef VIMAGE
|
#ifdef VIMAGE
|
||||||
void
|
static void
|
||||||
key_destroy(void)
|
key_vnet_destroy(void *arg __unused)
|
||||||
{
|
{
|
||||||
struct secashead_queue sahdrainq;
|
struct secashead_queue sahdrainq;
|
||||||
struct secpolicy_queue drainq;
|
struct secpolicy_queue drainq;
|
||||||
@ -8451,10 +8457,18 @@ key_destroy(void)
|
|||||||
SPACQ_UNLOCK();
|
SPACQ_UNLOCK();
|
||||||
hashdestroy(V_acqaddrhashtbl, M_IPSEC_SAQ, V_acqaddrhash_mask);
|
hashdestroy(V_acqaddrhashtbl, M_IPSEC_SAQ, V_acqaddrhash_mask);
|
||||||
hashdestroy(V_acqseqhashtbl, M_IPSEC_SAQ, V_acqseqhash_mask);
|
hashdestroy(V_acqseqhashtbl, M_IPSEC_SAQ, V_acqseqhash_mask);
|
||||||
|
}
|
||||||
|
VNET_SYSUNINIT(key_vnet_destroy, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND,
|
||||||
|
key_vnet_destroy, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!IS_DEFAULT_VNET(curvnet))
|
/*
|
||||||
return;
|
* XXX: as long as domains are not unloadable, this function is never called,
|
||||||
|
* provided for consistensy and future unload support.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
key_destroy(void *arg __unused)
|
||||||
|
{
|
||||||
uma_zdestroy(ipsec_key_lft_zone);
|
uma_zdestroy(ipsec_key_lft_zone);
|
||||||
|
|
||||||
#ifndef IPSEC_DEBUG2
|
#ifndef IPSEC_DEBUG2
|
||||||
@ -8467,7 +8481,7 @@ key_destroy(void)
|
|||||||
SPACQ_LOCK_DESTROY();
|
SPACQ_LOCK_DESTROY();
|
||||||
SPI_ALLOC_LOCK_DESTROY();
|
SPI_ALLOC_LOCK_DESTROY();
|
||||||
}
|
}
|
||||||
#endif
|
SYSUNINIT(key_destroy, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, key_destroy, NULL);
|
||||||
|
|
||||||
/* record data transfer on SA, and update timestamps */
|
/* record data transfer on SA, and update timestamps */
|
||||||
void
|
void
|
||||||
|
@ -80,10 +80,6 @@ void key_delete_xform(const struct xformsw *);
|
|||||||
extern u_long key_random(void);
|
extern u_long key_random(void);
|
||||||
extern void key_freereg(struct socket *);
|
extern void key_freereg(struct socket *);
|
||||||
extern int key_parse(struct mbuf *, struct socket *);
|
extern int key_parse(struct mbuf *, struct socket *);
|
||||||
extern void key_init(void);
|
|
||||||
#ifdef VIMAGE
|
|
||||||
extern void key_destroy(void);
|
|
||||||
#endif
|
|
||||||
extern void key_sa_recordxfer(struct secasvar *, struct mbuf *);
|
extern void key_sa_recordxfer(struct secasvar *, struct mbuf *);
|
||||||
uint16_t key_portfromsaddr(struct sockaddr *);
|
uint16_t key_portfromsaddr(struct sockaddr *);
|
||||||
void key_porttosaddr(struct sockaddr *, uint16_t port);
|
void key_porttosaddr(struct sockaddr *, uint16_t port);
|
||||||
|
@ -71,7 +71,7 @@ struct key_cb {
|
|||||||
int key_count;
|
int key_count;
|
||||||
int any_count;
|
int any_count;
|
||||||
};
|
};
|
||||||
VNET_DEFINE_STATIC(struct key_cb, key_cb);
|
VNET_DEFINE_STATIC(struct key_cb, key_cb) = {};
|
||||||
#define V_key_cb VNET(key_cb)
|
#define V_key_cb VNET(key_cb)
|
||||||
|
|
||||||
static struct sockaddr key_src = { 2, PF_KEY, };
|
static struct sockaddr key_src = { 2, PF_KEY, };
|
||||||
@ -452,23 +452,10 @@ struct protosw keysw[] = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
|
||||||
key_init0(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
bzero((caddr_t)&V_key_cb, sizeof(V_key_cb));
|
|
||||||
key_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
struct domain keydomain = {
|
struct domain keydomain = {
|
||||||
.dom_family = PF_KEY,
|
.dom_family = PF_KEY,
|
||||||
.dom_name = "key",
|
.dom_name = "key",
|
||||||
.dom_init = key_init0,
|
|
||||||
#ifdef VIMAGE
|
|
||||||
.dom_destroy = key_destroy,
|
|
||||||
#endif
|
|
||||||
.dom_protosw = keysw,
|
.dom_protosw = keysw,
|
||||||
.dom_protoswNPROTOSW = &keysw[nitems(keysw)]
|
.dom_protoswNPROTOSW = &keysw[nitems(keysw)]
|
||||||
};
|
};
|
||||||
|
DOMAIN_SET(key);
|
||||||
VNET_DOMAIN_SET(key);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user