diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-08-12 14:49:16 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-08-12 14:49:16 +0000 |
commit | fbc32b0f00f23ab9c4f91506e631838033f150be (patch) | |
tree | 58b8e3e8956551aa24d55d6a6fca43cc8750f867 /sys/netinet6 | |
parent | c5809ba8cfd83d3a6df37582a7645dc07eb9240e (diff) |
There are some places in ip and ip6 input where operations fail due
to out of memory. Use a generic idropped counter for those.
OK mvs@
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/ip6_input.c | 6 | ||||
-rw-r--r-- | sys/netinet6/ip6_var.h | 9 |
2 files changed, 10 insertions, 5 deletions
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, }; |