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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to