- Introduce protosw_init().
- Utilize it in net_init_domain(). - Utilize it pf_proto_register(), fixing panic on natd start. Reviewed by: ru, phk, obrien
This commit is contained in:
parent
154eb44539
commit
350bc1206a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=137586
@ -97,24 +97,16 @@ struct pr_usrreqs nousrreqs = {
|
||||
.pru_sosetlabel = pru_sosetlabel_null
|
||||
};
|
||||
|
||||
/*
|
||||
* Add a new protocol domain to the list of supported domains
|
||||
* Note: you cant unload it again because a socket may be using it.
|
||||
* XXX can't fail at this time.
|
||||
*/
|
||||
static void
|
||||
net_init_domain(struct domain *dp)
|
||||
protosw_init(struct protosw *pr)
|
||||
{
|
||||
struct protosw *pr;
|
||||
struct pr_usrreqs *pu;
|
||||
|
||||
if (dp->dom_init)
|
||||
(*dp->dom_init)();
|
||||
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++){
|
||||
pu = pr->pr_usrreqs;
|
||||
KASSERT(pu != NULL,
|
||||
("domaininit: %ssw[%d] has no usrreqs!",
|
||||
dp->dom_name, (int)(pr - dp->dom_protosw)));
|
||||
KASSERT(pu != NULL, ("protosw_init: %ssw[%d] has no usrreqs!",
|
||||
pr->pr_domain->dom_name,
|
||||
(int)(pr - pr->pr_domain->dom_protosw)));
|
||||
|
||||
#define DEFAULT(foo, bar) if ((foo) == NULL) (foo) = (bar)
|
||||
DEFAULT(pu->pru_accept, pru_accept_notsupp);
|
||||
DEFAULT(pu->pru_connect, pru_connect_notsupp);
|
||||
@ -129,10 +121,24 @@ net_init_domain(struct domain *dp)
|
||||
DEFAULT(pu->pru_sopoll, sopoll);
|
||||
DEFAULT(pu->pru_sosetlabel, pru_sosetlabel_null);
|
||||
#undef DEFAULT
|
||||
|
||||
if (pr->pr_init)
|
||||
(*pr->pr_init)();
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a new protocol domain to the list of supported domains
|
||||
* Note: you cant unload it again because a socket may be using it.
|
||||
* XXX can't fail at this time.
|
||||
*/
|
||||
static void
|
||||
net_init_domain(struct domain *dp)
|
||||
{
|
||||
struct protosw *pr;
|
||||
|
||||
if (dp->dom_init)
|
||||
(*dp->dom_init)();
|
||||
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
|
||||
protosw_init(pr);
|
||||
/*
|
||||
* update global information about maximums
|
||||
*/
|
||||
@ -298,8 +304,7 @@ pf_proto_register(family, npr)
|
||||
mtx_unlock(&Giant);
|
||||
|
||||
/* Initialize and activate the protocol. */
|
||||
if (fpr->pr_init)
|
||||
(fpr->pr_init)();
|
||||
protosw_init(fpr);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user