diff options
-rw-r--r-- | sys/net/route.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_var.h | 6 | ||||
-rw-r--r-- | sys/netinet6/ip6_var.h | 10 | ||||
-rw-r--r-- | usr.bin/netstat/inet.c | 4 | ||||
-rw-r--r-- | usr.bin/netstat/inet6.c | 9 |
5 files changed, 20 insertions, 13 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; diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index 663671d1a26..cbe670b7fef 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_var.h,v 1.111 2024/02/03 22:50:09 mvs Exp $ */ +/* $OpenBSD: ip_var.h,v 1.112 2024/02/05 23:16:39 bluhm Exp $ */ /* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */ /* @@ -87,6 +87,8 @@ struct ipstat { u_long ips_inswcsum; /* software checksummed on input */ u_long ips_outswcsum; /* software checksummed on output */ u_long ips_notmember; /* multicasts for unregistered groups */ + u_long ips_rtcachehit; /* valid route found in cache */ + u_long ips_rtcachemiss; /* route cache with new destination */ u_long ips_wrongif; /* packet received on wrong interface */ u_long ips_idropped; /* lost input due to nobufs, etc. */ }; @@ -133,6 +135,8 @@ enum ipstat_counters { ips_inswcsum, /* software checksummed on input */ ips_outswcsum, /* software checksummed on output */ ips_notmember, /* multicasts for unregistered groups */ + ips_rtcachehit, /* valid route to destination found in cache */ + ips_rtcachemiss, /* route cache filled with new destination */ ips_wrongif, /* packet received on wrong interface */ ips_idropped, /* lost input packets due to nobufs, etc. */ diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index 887bd95fe18..06d6ce7572f 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_var.h,v 1.110 2024/02/03 22:50:09 mvs Exp $ */ +/* $OpenBSD: ip6_var.h,v 1.111 2024/02/05 23:16:39 bluhm Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -196,8 +196,8 @@ struct ip6stat { /* number of times that an deprecated address is chosen */ u_int64_t ip6s_sources_deprecated[16]; - u_int64_t ip6s_forward_cachehit; - u_int64_t ip6s_forward_cachemiss; + u_int64_t ip6s_rtcachehit; /* valid route found in cache */ + u_int64_t ip6s_rtcachemiss; /* route cache with new destination */ u_int64_t ip6s_wrongif; /* packet received on wrong interface */ u_int64_t ip6s_idropped; /* lost input due to nobufs, etc. */ }; @@ -243,8 +243,8 @@ enum ip6stat_counters { ip6s_sources_samescope = ip6s_sources_otherif + 16, ip6s_sources_otherscope = ip6s_sources_samescope + 16, ip6s_sources_deprecated = ip6s_sources_otherscope + 16, - ip6s_forward_cachehit = ip6s_sources_deprecated + 16, - ip6s_forward_cachemiss, + ip6s_rtcachehit = ip6s_sources_deprecated + 16, + ip6s_rtcachemiss, ip6s_wrongif, ip6s_idropped, diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 94089d5b8a1..560b8594bd8 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.c,v 1.179 2023/09/04 23:00:36 bluhm Exp $ */ +/* $OpenBSD: inet.c,v 1.180 2024/02/05 23:16:39 bluhm Exp $ */ /* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */ /* @@ -621,6 +621,8 @@ ip_stats(char *name) p(ips_inswcsum, "\t%lu input datagram%s software-checksummed\n"); p(ips_outswcsum, "\t%lu output datagram%s software-checksummed\n"); p(ips_notmember, "\t%lu multicast packet%s which we don't join\n"); + p1(ips_rtcachehit, "\t%lu route cache hit\n"); + p1(ips_rtcachemiss, "\t%lu route cache miss\n"); p(ips_wrongif, "\t%lu packet%s received on wrong interface\n"); p(ips_idropped, "\t%lu input packet%s dropped due to no bufs, etc.\n"); #undef p diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c index 38d63988b03..789ba6059fb 100644 --- a/usr.bin/netstat/inet6.c +++ b/usr.bin/netstat/inet6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet6.c,v 1.56 2022/08/12 14:49:15 bluhm Exp $ */ +/* $OpenBSD: inet6.c,v 1.57 2024/02/05 23:16:39 bluhm Exp $ */ /* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */ /* * Copyright (c) 1983, 1988, 1993 @@ -371,7 +371,6 @@ ip6_stats(char *name) p(ip6s_cantfrag, "\t%llu datagram%s that can't be fragmented\n"); p(ip6s_badscope, "\t%llu packet%s that violated scope rules\n"); p(ip6s_notmember, "\t%llu multicast packet%s which we don't join\n"); - p(ip6s_wrongif, "\t%llu packet%s received on wrong interface\n"); for (first = 1, i = 0; i < 256; i++) if (ip6stat.ip6s_nxthist[i] != 0) { if (first) { @@ -478,9 +477,9 @@ ip6_stats(char *name) PRINT_SCOPESTAT(ip6s_sources_deprecated[i], i); } } - - p1(ip6s_forward_cachehit, "\t%llu forward cache hit\n"); - p1(ip6s_forward_cachemiss, "\t%llu forward cache miss\n"); + p1(ip6s_rtcachehit, "\t%llu route cache hit\n"); + p1(ip6s_rtcachemiss, "\t%llu route cache miss\n"); + p(ip6s_wrongif, "\t%llu packet%s received on wrong interface\n"); p(ip6s_idropped, "\t%llu input packet%s dropped due to no bufs, etc.\n"); #undef p |