1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-11 14:10:34 +00:00

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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=218627
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:
error = sooptcopyin(sopt, &optval, sizeof optval,
sizeof optval);
if (optval < 1 || optval > rt_numfibs) {
if (optval < 0 || optval > rt_numfibs) {
error = EINVAL;
goto bad;
}
if ((so->so_proto->pr_domain->dom_family == PF_INET) ||
(so->so_proto->pr_domain->dom_family == PF_ROUTE)) {
if (so->so_proto != NULL &&
((so->so_proto->pr_domain->dom_family == PF_INET) ||
(so->so_proto->pr_domain->dom_family == PF_ROUTE))) {
so->so_fibnum = optval;
/* 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);
} else {
so->so_fibnum = 0;

View File

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