Date: Fri, 12 Jul 2013 12:36:13 +0000 (UTC) From: Hiroki Sato <hrs@FreeBSD.org> 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 Message-ID: <201307121236.r6CCaDCW095414@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307121236.r6CCaDCW095414>