Several protocol switch functions (pru_abort, pru_detach, pru_sosetlabel)
return void, so don't implement no-op versions of these functions. Instead, consistently check if those switch pointers are NULL before invoking them.
This commit is contained in:
parent
b7a5696a9b
commit
2137fc50e6
@ -80,14 +80,12 @@ MTX_SYSINIT(domain, &dom_mtx, "domain list", MTX_DEF);
|
||||
* All functions return EOPNOTSUPP.
|
||||
*/
|
||||
struct pr_usrreqs nousrreqs = {
|
||||
.pru_abort = pru_abort_notsupp,
|
||||
.pru_accept = pru_accept_notsupp,
|
||||
.pru_attach = pru_attach_notsupp,
|
||||
.pru_bind = pru_bind_notsupp,
|
||||
.pru_connect = pru_connect_notsupp,
|
||||
.pru_connect2 = pru_connect2_notsupp,
|
||||
.pru_control = pru_control_notsupp,
|
||||
.pru_detach = pru_detach_notsupp,
|
||||
.pru_disconnect = pru_disconnect_notsupp,
|
||||
.pru_listen = pru_listen_notsupp,
|
||||
.pru_peeraddr = pru_peeraddr_notsupp,
|
||||
@ -100,7 +98,6 @@ struct pr_usrreqs nousrreqs = {
|
||||
.pru_sosend = pru_sosend_notsupp,
|
||||
.pru_soreceive = pru_soreceive_notsupp,
|
||||
.pru_sopoll = pru_sopoll_notsupp,
|
||||
.pru_sosetlabel = pru_sosetlabel_null
|
||||
};
|
||||
|
||||
static void
|
||||
@ -125,7 +122,6 @@ protosw_init(struct protosw *pr)
|
||||
DEFAULT(pu->pru_sosend, sosend);
|
||||
DEFAULT(pu->pru_soreceive, soreceive);
|
||||
DEFAULT(pu->pru_sopoll, sopoll);
|
||||
DEFAULT(pu->pru_sosetlabel, pru_sosetlabel_null);
|
||||
#undef DEFAULT
|
||||
if (pr->pr_init)
|
||||
(*pr->pr_init)();
|
||||
|
@ -1128,12 +1128,6 @@ sbcreatecontrol(p, size, type, level)
|
||||
* Some routines that return EOPNOTSUPP for entry points that are not
|
||||
* supported by a protocol. Fill in as needed.
|
||||
*/
|
||||
void
|
||||
pru_abort_notsupp(struct socket *so)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
pru_accept_notsupp(struct socket *so, struct sockaddr **nam)
|
||||
{
|
||||
@ -1171,12 +1165,6 @@ pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data,
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
|
||||
void
|
||||
pru_detach_notsupp(struct socket *so)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
pru_disconnect_notsupp(struct socket *so)
|
||||
{
|
||||
@ -1259,16 +1247,6 @@ pru_sopoll_notsupp(struct socket *so, int events, struct ucred *cred,
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
|
||||
/*
|
||||
* For protocol types that don't keep cached copies of labels in their
|
||||
* pcbs, provide a null sosetlabel that does a NOOP.
|
||||
*/
|
||||
void
|
||||
pru_sosetlabel_null(struct socket *so)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a copy of a sockaddr in a malloced buffer of type M_SONAME.
|
||||
*/
|
||||
|
@ -653,7 +653,8 @@ soclose(so)
|
||||
}
|
||||
|
||||
drop:
|
||||
(*so->so_proto->pr_usrreqs->pru_detach)(so);
|
||||
if (*so->so_proto->pr_usrreqs->pru_detach != NULL)
|
||||
(*so->so_proto->pr_usrreqs->pru_detach)(so);
|
||||
ACCEPT_LOCK();
|
||||
SOCK_LOCK(so);
|
||||
KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF"));
|
||||
@ -696,7 +697,8 @@ soabort(so)
|
||||
KASSERT((so->so_state & SQ_COMP) == 0, ("soabort: SQ_COMP"));
|
||||
KASSERT((so->so_state & SQ_INCOMP) == 0, ("soabort: SQ_INCOMP"));
|
||||
|
||||
(*so->so_proto->pr_usrreqs->pru_abort)(so);
|
||||
if (*so->so_proto->pr_usrreqs->pru_abort != NULL)
|
||||
(*so->so_proto->pr_usrreqs->pru_abort)(so);
|
||||
ACCEPT_LOCK();
|
||||
SOCK_LOCK(so);
|
||||
sofree(so);
|
||||
|
@ -1128,12 +1128,6 @@ sbcreatecontrol(p, size, type, level)
|
||||
* Some routines that return EOPNOTSUPP for entry points that are not
|
||||
* supported by a protocol. Fill in as needed.
|
||||
*/
|
||||
void
|
||||
pru_abort_notsupp(struct socket *so)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
pru_accept_notsupp(struct socket *so, struct sockaddr **nam)
|
||||
{
|
||||
@ -1171,12 +1165,6 @@ pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data,
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
|
||||
void
|
||||
pru_detach_notsupp(struct socket *so)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
pru_disconnect_notsupp(struct socket *so)
|
||||
{
|
||||
@ -1259,16 +1247,6 @@ pru_sopoll_notsupp(struct socket *so, int events, struct ucred *cred,
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
|
||||
/*
|
||||
* For protocol types that don't keep cached copies of labels in their
|
||||
* pcbs, provide a null sosetlabel that does a NOOP.
|
||||
*/
|
||||
void
|
||||
pru_sosetlabel_null(struct socket *so)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a copy of a sockaddr in a malloced buffer of type M_SONAME.
|
||||
*/
|
||||
|
@ -249,7 +249,6 @@ struct pr_usrreqs {
|
||||
/*
|
||||
* All nonvoid pru_*() functions below return EOPNOTSUPP.
|
||||
*/
|
||||
void pru_abort_notsupp(struct socket *so);
|
||||
int pru_accept_notsupp(struct socket *so, struct sockaddr **nam);
|
||||
int pru_attach_notsupp(struct socket *so, int proto, struct thread *td);
|
||||
int pru_bind_notsupp(struct socket *so, struct sockaddr *nam,
|
||||
@ -259,7 +258,6 @@ int pru_connect_notsupp(struct socket *so, struct sockaddr *nam,
|
||||
int pru_connect2_notsupp(struct socket *so1, struct socket *so2);
|
||||
int pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data,
|
||||
struct ifnet *ifp, struct thread *td);
|
||||
void pru_detach_notsupp(struct socket *so);
|
||||
int pru_disconnect_notsupp(struct socket *so);
|
||||
int pru_listen_notsupp(struct socket *so, int backlog, struct thread *td);
|
||||
int pru_peeraddr_notsupp(struct socket *so, struct sockaddr **nam);
|
||||
@ -278,7 +276,6 @@ int pru_soreceive_notsupp(struct socket *so, struct sockaddr **paddr,
|
||||
int *flagsp);
|
||||
int pru_sopoll_notsupp(struct socket *so, int events, struct ucred *cred,
|
||||
struct thread *td);
|
||||
void pru_sosetlabel_null(struct socket *so);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user