From: bluhm Date: Sat, 6 Jan 2024 11:42:11 +0000 (+0000) Subject: Do not count packets though multicast loopback and simplex interfaces. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7930701169eecf45ae650f8ea5723784f89412b7;p=openbsd Do not count packets though multicast loopback and simplex interfaces. Counting multicast packets sent to local stack or packets that are reflected by simplex interfaces does not make much sense. They are neither received nor output by any ethernet device. Counting these packets at lo0 or the loopback interface of the routing domain would be possible, but is not worth the effort. Make if_input_local() MP safe by deleting the if_opackets++ code. OK mvs@ --- diff --git a/sys/net/if.c b/sys/net/if.c index 8b9281d72aa..e76ec366f59 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.715 2024/01/06 10:58:45 bluhm Exp $ */ +/* $OpenBSD: if.c,v 1.716 2024/01/06 11:42:11 bluhm Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -839,11 +839,8 @@ if_input_local(struct ifnet *ifp, struct mbuf *m, sa_family_t af) if (ISSET(keepcksum, M_ICMP_CSUM_OUT)) m->m_pkthdr.csum_flags |= M_ICMP_CSUM_IN_OK; - if (ifp->if_counters == NULL) { - /* XXXSMP multicast loopback and simplex interfaces */ - ifp->if_opackets++; - ifp->if_obytes += m->m_pkthdr.len; - } else { + /* do not count multicast loopback and simplex interfaces */ + if (ISSET(ifp->if_flags, IFF_LOOPBACK)) { counters_pkt(ifp->if_counters, ifc_opackets, ifc_obytes, m->m_pkthdr.len); }