summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2024-02-05 23:16:40 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2024-02-05 23:16:40 +0000
commit048b9d583ea17a970c009f89d82d7b0ba4c64aed (patch)
treeae8bca5cd0eecfb2f7ee309a785df012661502c4 /sys/net
parent7d832ab8374871c9b0e813f25e1da995d31b16f7 (diff)
Add netstat counter for route cache.
To optimize route caching, count cache hits and misses. This is shown in netstat -s for both inet and inet6. Reuse the old IPv6 forward cache counter. Sort ip6s_wrongif consistently. For now only IPv4 cache counter has been implemented. OK mvs@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/route.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index 991b4805a49..adb37198527 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.427 2024/01/31 14:56:42 bluhm Exp $ */
+/* $OpenBSD: route.c,v 1.428 2024/02/05 23:16:39 bluhm Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -214,9 +214,11 @@ route_cache(struct route *ro, struct in_addr addr, u_int rtableid)
ro->ro_tableid == rtableid &&
ro->ro_dst.sa_family == AF_INET &&
satosin(&ro->ro_dst)->sin_addr.s_addr == addr.s_addr) {
+ ipstat_inc(ips_rtcachehit);
return;
}
+ ipstat_inc(ips_rtcachemiss);
rtfree(ro->ro_rt);
ro->ro_rt = NULL;
ro->ro_generation = gen;