Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Feb 2011 00:14:13 +0000 (UTC)
From:      Daniel Eischen <deischen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r218627 - in head/sys: kern netinet
Message-ID:  <201102130014.p1D0ED5Q019625@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



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