Remove apparently redundand checks for socket so_proto being non-NULL

from sosetopt() and sogetopt().  No exposed sockets may have so_proto
invalid.

Discussed with:	bz, rwatson
Reviewed by:	glebius
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2012-02-26 13:51:05 +00:00
parent 3cc28bd9bf
commit 9493639e35
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=232178

View File

@ -2447,7 +2447,7 @@ sosetopt(struct socket *so, struct sockopt *sopt)
CURVNET_SET(so->so_vnet);
error = 0;
if (sopt->sopt_level != SOL_SOCKET) {
if (so->so_proto && so->so_proto->pr_ctloutput) {
if (so->so_proto->pr_ctloutput != NULL) {
error = (*so->so_proto->pr_ctloutput)(so, sopt);
CURVNET_RESTORE();
return (error);
@ -2508,8 +2508,7 @@ sosetopt(struct socket *so, struct sockopt *sopt)
error = EINVAL;
goto bad;
}
if (so->so_proto != NULL &&
((so->so_proto->pr_domain->dom_family == PF_INET) ||
if (((so->so_proto->pr_domain->dom_family == PF_INET) ||
(so->so_proto->pr_domain->dom_family == PF_INET6) ||
(so->so_proto->pr_domain->dom_family == PF_ROUTE))) {
so->so_fibnum = optval;
@ -2641,11 +2640,8 @@ sosetopt(struct socket *so, struct sockopt *sopt)
error = ENOPROTOOPT;
break;
}
if (error == 0 && so->so_proto != NULL &&
so->so_proto->pr_ctloutput != NULL) {
(void) ((*so->so_proto->pr_ctloutput)
(so, sopt));
}
if (error == 0 && so->so_proto->pr_ctloutput != NULL)
(void)(*so->so_proto->pr_ctloutput)(so, sopt);
}
bad:
CURVNET_RESTORE();
@ -2695,7 +2691,7 @@ sogetopt(struct socket *so, struct sockopt *sopt)
CURVNET_SET(so->so_vnet);
error = 0;
if (sopt->sopt_level != SOL_SOCKET) {
if (so->so_proto && so->so_proto->pr_ctloutput)
if (so->so_proto->pr_ctloutput != NULL)
error = (*so->so_proto->pr_ctloutput)(so, sopt);
else
error = ENOPROTOOPT;