svn commit: r224281 - stable/8/sys/kern

Daniel Eischen deischen at FreeBSD.org
Sat Jul 23 12:55:02 UTC 2011


Author: deischen
Date: Sat Jul 23 12:55:01 2011
New Revision: 224281
URL: http://svn.freebsd.org/changeset/base/224281

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

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

Modified: stable/8/sys/kern/uipc_socket.c
==============================================================================
--- stable/8/sys/kern/uipc_socket.c	Sat Jul 23 08:55:05 2011	(r224280)
+++ stable/8/sys/kern/uipc_socket.c	Sat Jul 23 12:55:01 2011	(r224281)
@@ -2490,15 +2490,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;


More information about the svn-src-stable-8 mailing list