Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Aug 2011 14:29:33 +0000 (UTC)
From:      Daniel Eischen <deischen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r224941 - stable/7/sys/kern
Message-ID:  <201108171429.p7HETXEF009106@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: deischen
Date: Wed Aug 17 14:29:33 2011
New Revision: 224941
URL: http://svn.freebsd.org/changeset/base/224941

Log:
  MFC r218627
  
  Allow SO_SETFIB to select/set the default routing table.
  
  Requested by: Andrew Boyer aboyer at averesystems dot com.

Modified:
  stable/7/sys/kern/uipc_socket.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/uipc_socket.c
==============================================================================
--- stable/7/sys/kern/uipc_socket.c	Wed Aug 17 14:28:58 2011	(r224940)
+++ stable/7/sys/kern/uipc_socket.c	Wed Aug 17 14:29:33 2011	(r224941)
@@ -2207,15 +2207,16 @@ sosetopt(struct socket *so, struct socko
 		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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201108171429.p7HETXEF009106>