From owner-svn-src-head@FreeBSD.ORG Fri Jul 12 12:36:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AB184446; Fri, 12 Jul 2013 12:36:13 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 83638122B; Fri, 12 Jul 2013 12:36:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6CCaDC4095417; Fri, 12 Jul 2013 12:36:13 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6CCaDCW095414; Fri, 12 Jul 2013 12:36:13 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201307121236.r6CCaDCW095414@svn.freebsd.org> From: Hiroki Sato Date: Fri, 12 Jul 2013 12:36:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253262 - in head: lib/libc/gen sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2013 12:36:13 -0000 Author: hrs Date: Fri Jul 12 12:36:12 2013 New Revision: 253262 URL: http://svnweb.freebsd.org/changeset/base/253262 Log: Add a leaf node CTL_NET.PF_ROUTE.0.AF.NET_RT_DUMP.0.FIB. This returns routing table with the specified FIB number, not td->td_proc->p_fibnum. Modified: head/lib/libc/gen/sysctl.3 head/sys/net/rtsock.c Modified: head/lib/libc/gen/sysctl.3 ============================================================================== --- head/lib/libc/gen/sysctl.3 Fri Jul 12 12:18:07 2013 (r253261) +++ head/lib/libc/gen/sysctl.3 Fri Jul 12 12:36:12 2013 (r253262) @@ -28,7 +28,7 @@ .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd February 11, 2012 +.Dd May 17, 2013 .Dt SYSCTL 3 .Os .Sh NAME @@ -547,14 +547,14 @@ The length of each message is contained The third level name is a protocol number, which is currently always 0. The fourth level name is an address family, which may be set to 0 to select all address families. -The fifth and sixth level names are as follows: -.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent -.It Sy "Fifth level name Sixth level is:" -.It "NET_RT_FLAGS rtflags" -.It "NET_RT_DUMP None" -.It "NET_RT_IFLIST 0 or if_index" -.It "NET_RT_IFMALIST 0 or if_index" -.It "NET_RT_IFLISTL 0 or if_index" +The fifth, sixth, and seventh level names are as follows: +.Bl -column "Fifth level " "Sixth level " -offset indent +.It Sy "Fifth level Sixth level Seventh level" +.It "NET_RT_FLAGS rtflags None" +.It "NET_RT_DUMP None None or fib number" +.It "NET_RT_IFLIST 0 or if_index None" +.It "NET_RT_IFMALIST 0 or if_index None" +.It "NET_RT_IFLISTL 0 or if_index None" .El .Pp The Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Fri Jul 12 12:18:07 2013 (r253261) +++ head/sys/net/rtsock.c Fri Jul 12 12:36:12 2013 (r253262) @@ -1905,6 +1905,7 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) u_int namelen = arg2; struct radix_node_head *rnh = NULL; /* silence compiler. */ int i, lim, error = EINVAL; + int fib = 0; u_char af; struct walkarg w; @@ -1912,7 +1913,17 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) namelen--; if (req->newptr) return (EPERM); - if (namelen != 3) + if (name[1] == NET_RT_DUMP) { + if (namelen == 3) + fib = req->td->td_proc->p_fibnum; + else if (namelen == 4) + fib = (name[3] == -1) ? + req->td->td_proc->p_fibnum : name[3]; + else + return ((namelen < 3) ? EISDIR : ENOTDIR); + if (fib < 0 || fib >= rt_numfibs) + return (EINVAL); + } else if (namelen != 3) return ((namelen < 3) ? EISDIR : ENOTDIR); af = name[0]; if (af > AF_MAX) @@ -1951,7 +1962,7 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) * take care of routing entries */ for (error = 0; error == 0 && i <= lim; i++) { - rnh = rt_tables_get_rnh(req->td->td_proc->p_fibnum, i); + rnh = rt_tables_get_rnh(fib, i); if (rnh != NULL) { RADIX_NODE_HEAD_RLOCK(rnh); error = rnh->rnh_walktree(rnh,