summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2011-02-13 00:14:13 +0000
committerdeischen <deischen@FreeBSD.org>2011-02-13 00:14:13 +0000
commitcc0a83ec21a32f6d6d309198429b6e90ceebd223 (patch)
tree5045d42718d9a42a8fde924ecbfccbd498bbefa5 /sys/kern
parent2fb060368627dc29279d5ac969e6c3eb6b0e7ea3 (diff)
downloadFreeBSD-src-cc0a83ec21a32f6d6d309198429b6e90ceebd223.zip
FreeBSD-src-cc0a83ec21a32f6d6d309198429b6e90ceebd223.tar.gz
Allow the SO_SETFIB socket option to select the default (0)
routing table. Reviewed by: julian
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_socket.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 32e507c..738bef9 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -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;
OpenPOWER on IntegriCloud