svn commit: r360631 - head/sys/net/route
Alexander V. Chernikov
melifaro at FreeBSD.org
Mon May 4 15:07:58 UTC 2020
Author: melifaro
Date: Mon May 4 15:07:57 2020
New Revision: 360631
URL: https://svnweb.freebsd.org/changeset/base/360631
Log:
Switch DDB show route to direct rnh_matchaddr() call instead of rtalloc1().
Eliminate the last rtalloc1() call to finish transition to the new routing
KPI defined in r359823.
Differential Revision: https://reviews.freebsd.org/D24663
Modified:
head/sys/net/route/route_ddb.c
Modified: head/sys/net/route/route_ddb.c
==============================================================================
--- head/sys/net/route/route_ddb.c Mon May 4 15:00:19 2020 (r360630)
+++ head/sys/net/route/route_ddb.c Mon May 4 15:07:57 2020 (r360631)
@@ -208,6 +208,8 @@ DB_SHOW_COMMAND(routetable, db_show_routetable_cmd)
_DB_FUNC(_show, route, db_show_route_cmd, db_show_table, CS_OWN, NULL)
{
char abuf[INET6_ADDRSTRLEN], *buf, *end;
+ struct rib_head *rh;
+ struct radix_node *rn;
void *dst_addrp;
struct rtentry *rt;
union {
@@ -244,8 +246,15 @@ _DB_FUNC(_show, route, db_show_route_cmd, db_show_tabl
if (inet_ntop(af, dst_addrp, abuf, sizeof(abuf)) != NULL)
db_printf("Looking up route to destination '%s'\n", abuf);
+ rt = NULL;
CURVNET_SET(vnet0);
- rt = rtalloc1((struct sockaddr *)&u, 0, RTF_RNH_LOCKED);
+
+ rh = rt_tables_get_rnh(RT_DEFAULT_FIB, af);
+
+ rn = rh->rnh_matchaddr(&u, &rh->head);
+ if (rn && ((rn->rn_flags & RNF_ROOT) == 0))
+ rt = (struct rtentry *)rn;
+
CURVNET_RESTORE();
if (rt == NULL) {
@@ -254,7 +263,6 @@ _DB_FUNC(_show, route, db_show_route_cmd, db_show_tabl
}
rt_dumpentry_ddb((void *)rt, NULL);
- RTFREE_LOCKED(rt);
return;
usage:
More information about the svn-src-all
mailing list