From owner-svn-src-all@FreeBSD.ORG Wed Nov 19 19:19:30 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E690A106567E; Wed, 19 Nov 2008 19:19:30 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5F608FC17; Wed, 19 Nov 2008 19:19:30 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJJJUte025838; Wed, 19 Nov 2008 19:19:30 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJJJUCk025834; Wed, 19 Nov 2008 19:19:30 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <200811191919.mAJJJUCk025834@svn.freebsd.org> From: Julian Elischer Date: Wed, 19 Nov 2008 19:19:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185101 - in head/sys: kern netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 19:19:31 -0000 Author: julian Date: Wed Nov 19 19:19:30 2008 New Revision: 185101 URL: http://svn.freebsd.org/changeset/base/185101 Log: Fix a scope problem in the multiple routing table code that stopped the SO_SETFIB socket option from working correctly. Obtained from: Ironport MFC after: 3 days Modified: head/sys/kern/uipc_socket.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_output.c head/sys/netinet/raw_ip.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Wed Nov 19 18:06:29 2008 (r185100) +++ head/sys/kern/uipc_socket.c Wed Nov 19 19:19:30 2008 (r185101) @@ -2218,6 +2218,9 @@ sosetopt(struct socket *so, struct socko if ((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) + (*so->so_proto->pr_ctloutput)(so, sopt); } else { so->so_fibnum = 0; } Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Wed Nov 19 18:06:29 2008 (r185100) +++ head/sys/netinet/ip_divert.c Wed Nov 19 19:19:30 2008 (r185101) @@ -322,6 +322,7 @@ div_output(struct socket *so, struct mbu */ m->m_pkthdr.rcvif = NULL; m->m_nextpkt = NULL; + M_SETFIB(m, so->so_fibnum); if (control) m_freem(control); /* XXX */ Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Wed Nov 19 18:06:29 2008 (r185100) +++ head/sys/netinet/ip_output.c Wed Nov 19 19:19:30 2008 (r185101) @@ -134,8 +134,10 @@ ip_output(struct mbuf *m, struct mbuf *o bzero(ro, sizeof (*ro)); } - if (inp != NULL) + if (inp != NULL) { + M_SETFIB(m, inp->inp_inc.inc_fibnum); INP_LOCK_ASSERT(inp); + } if (opt) { len = 0; @@ -824,6 +826,11 @@ ip_ctloutput(struct socket *so, struct s error = optval = 0; if (sopt->sopt_level != IPPROTO_IP) { + if ((sopt->sopt_level == SOL_SOCKET) && + (sopt->sopt_name == SO_SETFIB)) { + inp->inp_inc.inc_fibnum = so->so_fibnum; + return (0); + } return (EINVAL); } Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Wed Nov 19 18:06:29 2008 (r185100) +++ head/sys/netinet/raw_ip.c Wed Nov 19 19:19:30 2008 (r185101) @@ -450,8 +450,14 @@ rip_ctloutput(struct socket *so, struct struct inpcb *inp = sotoinpcb(so); int error, optval; - if (sopt->sopt_level != IPPROTO_IP) + if (sopt->sopt_level != IPPROTO_IP) { + if ((sopt->sopt_level == SOL_SOCKET) && + (sopt->sopt_name == SO_SETFIB)) { + inp->inp_inc.inc_fibnum = so->so_fibnum; + return (0); + } return (EINVAL); + } error = 0; switch (sopt->sopt_dir) {