diff options
-rw-r--r-- | sys/netinet/ip_input.c | 10 | ||||
-rw-r--r-- | sys/netinet/ip_var.h | 8 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 6 | ||||
-rw-r--r-- | sys/netinet6/ip6_var.h | 9 | ||||
-rw-r--r-- | usr.bin/netstat/inet.c | 3 | ||||
-rw-r--r-- | usr.bin/netstat/inet6.c | 4 |
6 files changed, 27 insertions, 13 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index adab68741b0..4ff68820c80 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.377 2022/08/06 15:57:59 bluhm Exp $ */ +/* $OpenBSD: ip_input.c,v 1.378 2022/08/12 14:49:15 bluhm Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -1372,8 +1372,10 @@ save_rte(struct mbuf *m, u_char *option, struct in_addr dst) return; mtag = m_tag_get(PACKET_TAG_SRCROUTE, sizeof(*isr), M_NOWAIT); - if (mtag == NULL) + if (mtag == NULL) { + ipstat_inc(ips_idropped); return; + } isr = (struct ip_srcrt *)(mtag + 1); memcpy(isr->isr_hdr, option, olen); @@ -1406,8 +1408,10 @@ ip_srcroute(struct mbuf *m0) if (isr->isr_nhops == 0) return (NULL); m = m_get(M_DONTWAIT, MT_SOOPTS); - if (m == NULL) + if (m == NULL) { + ipstat_inc(ips_idropped); return (NULL); + } #define OPTSIZ (sizeof(isr->isr_nop) + sizeof(isr->isr_hdr)) diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index 2eb8c6f3cba..43e0799bae3 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_var.h,v 1.95 2022/08/04 18:05:09 bluhm Exp $ */ +/* $OpenBSD: ip_var.h,v 1.96 2022/08/12 14:49:15 bluhm Exp $ */ /* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */ /* @@ -70,7 +70,7 @@ struct ipstat { u_long ips_noproto; /* unknown or unsupported protocol */ u_long ips_delivered; /* datagrams delivered to upper level*/ u_long ips_localout; /* total ip packets generated here */ - u_long ips_odropped; /* lost packets due to nobufs, etc. */ + u_long ips_odropped; /* lost output due to nobufs, etc. */ u_long ips_reassembled; /* total packets reassembled ok */ u_long ips_fragmented; /* datagrams successfully fragmented */ u_long ips_ofragments; /* output fragments created */ @@ -88,6 +88,7 @@ struct ipstat { u_long ips_outswcsum; /* software checksummed on output */ u_long ips_notmember; /* multicasts for unregistered groups */ u_long ips_wrongif; /* packet received on wrong interface */ + u_long ips_idropped; /* lost input due to nobufs, etc. */ }; struct ipoption { @@ -115,7 +116,7 @@ enum ipstat_counters { ips_noproto, /* unknown or unsupported protocol */ ips_delivered, /* datagrams delivered to upper level*/ ips_localout, /* total ip packets generated here */ - ips_odropped, /* lost packets due to nobufs, etc. */ + ips_odropped, /* lost output packets due to nobufs, etc. */ ips_reassembled, /* total packets reassembled ok */ ips_fragmented, /* datagrams successfully fragmented */ ips_ofragments, /* output fragments created */ @@ -133,6 +134,7 @@ enum ipstat_counters { ips_outswcsum, /* software checksummed on output */ ips_notmember, /* multicasts for unregistered groups */ ips_wrongif, /* packet received on wrong interface */ + ips_idropped, /* lost input packets due to nobufs, etc. */ ips_ncounters }; diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index d71441d8dbb..045fb00206d 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.251 2022/08/12 12:08:54 bluhm Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.252 2022/08/12 14:49:15 bluhm Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -1219,8 +1219,10 @@ ip6_pullexthdr(struct mbuf *m, size_t off, int nxt) n = NULL; } } - if (!n) + if (n == NULL) { + ip6stat_inc(ip6s_idropped); return NULL; + } n->m_len = 0; if (elen >= m_trailingspace(n)) { diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index 9ea94ff8eb2..021f7f04610 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_var.h,v 1.93 2022/06/29 22:45:24 bluhm Exp $ */ +/* $OpenBSD: ip6_var.h,v 1.94 2022/08/12 14:49:15 bluhm Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -153,7 +153,7 @@ struct ip6stat { u_int64_t ip6s_redirectsent; /* packets forwarded on same net */ u_int64_t ip6s_delivered; /* datagrams delivered to upper level*/ u_int64_t ip6s_localout; /* total ip packets generated here */ - u_int64_t ip6s_odropped; /* lost packets due to nobufs, etc. */ + u_int64_t ip6s_odropped; /* lost output due to nobufs, etc. */ u_int64_t ip6s_reassembled; /* total packets reassembled ok */ u_int64_t ip6s_fragmented; /* datagrams successfully fragmented */ u_int64_t ip6s_ofragments; /* output fragments created */ @@ -198,7 +198,8 @@ struct ip6stat { u_int64_t ip6s_forward_cachehit; u_int64_t ip6s_forward_cachemiss; - u_int64_t ip6s_wrongif; + u_int64_t ip6s_wrongif; /* packet received on wrong interface */ + u_int64_t ip6s_idropped; /* lost input due to nobufs, etc. */ }; #ifdef _KERNEL @@ -245,6 +246,8 @@ enum ip6stat_counters { ip6s_forward_cachehit = ip6s_sources_deprecated + 16, ip6s_forward_cachemiss, ip6s_wrongif, + ip6s_idropped, + ip6s_ncounters, }; diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 98994cb373a..2157946fc19 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.c,v 1.173 2021/12/05 22:36:19 deraadt Exp $ */ +/* $OpenBSD: inet.c,v 1.174 2022/08/12 14:49:15 bluhm Exp $ */ /* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */ /* @@ -612,6 +612,7 @@ ip_stats(char *name) 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"); 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 #undef p1 } diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c index 6f307e68d86..38d63988b03 100644 --- a/usr.bin/netstat/inet6.c +++ b/usr.bin/netstat/inet6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet6.c,v 1.55 2021/01/26 18:22:35 deraadt Exp $ */ +/* $OpenBSD: inet6.c,v 1.56 2022/08/12 14:49:15 bluhm Exp $ */ /* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */ /* * Copyright (c) 1983, 1988, 1993 @@ -481,6 +481,8 @@ ip6_stats(char *name) p1(ip6s_forward_cachehit, "\t%llu forward cache hit\n"); p1(ip6s_forward_cachemiss, "\t%llu forward cache miss\n"); + p(ip6s_idropped, + "\t%llu input packet%s dropped due to no bufs, etc.\n"); #undef p #undef p1 } |