diff options
author | Peter Hessler <phessler@cvs.openbsd.org> | 2015-07-18 00:02:31 +0000 |
---|---|---|
committer | Peter Hessler <phessler@cvs.openbsd.org> | 2015-07-18 00:02:31 +0000 |
commit | 4cf2f948a975738f0b9a353e864b962be2d6506f (patch) | |
tree | 249da369165b50fb08b15220c42493e137da1391 /sys | |
parent | 4b6ee675ec46af3634c1ae5afa961358b3a02fe5 (diff) |
On systems with a full routing table (550k+), we often want to be able to
look at the routes with a priority, or to display all routes that do not
have a specific priority (normally, don't show bgp).
OK mpi@ benno@
previous versions OK deraadt@ sthen@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/rtsock.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index fdfec18b13c..a8684186a94 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.163 2015/07/16 18:17:27 claudio Exp $ */ +/* $OpenBSD: rtsock.c,v 1.164 2015/07/18 00:02:30 phessler Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -1210,6 +1210,19 @@ sysctl_dumpentry(struct radix_node *rn, void *v, u_int id) if (w->w_op == NET_RT_FLAGS && !(rt->rt_flags & w->w_arg)) return 0; + if (w->w_op == NET_RT_DUMP && w->w_arg) { + u_int8_t prio = w->w_arg & RTP_MASK; + if (w->w_arg < 0) { + prio = (-w->w_arg) & RTP_MASK; + /* Show all routes that are not this priority */ + if (prio == (rt->rt_priority & RTP_MASK)) + return 0; + } else { + if (prio != (rt->rt_priority & RTP_MASK) && + prio != RTP_ANY) + return 0; + } + } bzero(&info, sizeof(info)); info.rti_info[RTAX_DST] = rt_key(rt); info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; |