to out of memory. Use a generic idropped counter for those.
OK mvs@
-/* $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 $ */
/*
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);
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))
-/* $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 $ */
/*
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 */
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 {
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 */
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
};
-/* $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 $ */
/*
n = NULL;
}
}
- if (!n)
+ if (n == NULL) {
+ ip6stat_inc(ip6s_idropped);
return NULL;
+ }
n->m_len = 0;
if (elen >= m_trailingspace(n)) {
-/* $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 $ */
/*
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 */
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
ip6s_forward_cachehit = ip6s_sources_deprecated + 16,
ip6s_forward_cachemiss,
ip6s_wrongif,
+ ip6s_idropped,
+
ip6s_ncounters,
};
-/* $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 $ */
/*
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
}
-/* $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
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
}