Allow the SO_SETFIB socket option to select the default (0)

routing table.

Reviewed by:	julian
This commit is contained in:
Daniel Eischen 2011-02-13 00:14:13 +00:00
parent e9749129ad
commit f7e6ce6d7a
2 changed files with 9 additions and 4 deletions

View File

@ -2449,15 +2449,16 @@ sosetopt(struct socket *so, struct sockopt *sopt)
case SO_SETFIB: case SO_SETFIB:
error = sooptcopyin(sopt, &optval, sizeof optval, error = sooptcopyin(sopt, &optval, sizeof optval,
sizeof optval); sizeof optval);
if (optval < 1 || optval > rt_numfibs) { if (optval < 0 || optval > rt_numfibs) {
error = EINVAL; error = EINVAL;
goto bad; goto bad;
} }
if ((so->so_proto->pr_domain->dom_family == PF_INET) || if (so->so_proto != NULL &&
(so->so_proto->pr_domain->dom_family == PF_ROUTE)) { ((so->so_proto->pr_domain->dom_family == PF_INET) ||
(so->so_proto->pr_domain->dom_family == PF_ROUTE))) {
so->so_fibnum = optval; so->so_fibnum = optval;
/* Note: ignore error */ /* Note: ignore error */
if (so->so_proto && so->so_proto->pr_ctloutput) if (so->so_proto->pr_ctloutput)
(*so->so_proto->pr_ctloutput)(so, sopt); (*so->so_proto->pr_ctloutput)(so, sopt);
} else { } else {
so->so_fibnum = 0; so->so_fibnum = 0;

View File

@ -486,6 +486,10 @@ udp_input(struct mbuf *m, int off)
INP_RUNLOCK(inp); INP_RUNLOCK(inp);
continue; continue;
} }
if (imo == NULL) {
INP_RUNLOCK(inp);
continue;
}
bzero(&group, sizeof(struct sockaddr_in)); bzero(&group, sizeof(struct sockaddr_in));
group.sin_len = sizeof(struct sockaddr_in); group.sin_len = sizeof(struct sockaddr_in);
group.sin_family = AF_INET; group.sin_family = AF_INET;