Author: deischen
Date: Sun Feb 13 00:14:13 2011
New Revision: 218627
URL: http://svn.freebsd.org/changeset/base/218627

Log:
  Allow the SO_SETFIB socket option to select the default (0)
  routing table.
  
  Reviewed by:  julian

Modified:
  head/sys/kern/uipc_socket.c
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c Sat Feb 12 23:44:05 2011        (r218626)
+++ head/sys/kern/uipc_socket.c Sun Feb 13 00:14:13 2011        (r218627)
@@ -2449,15 +2449,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;

Modified: head/sys/netinet/udp_usrreq.c
==============================================================================
--- head/sys/netinet/udp_usrreq.c       Sat Feb 12 23:44:05 2011        
(r218626)
+++ head/sys/netinet/udp_usrreq.c       Sun Feb 13 00:14:13 2011        
(r218627)
@@ -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;
_______________________________________________
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