Index | Thread | Search

From:
Alexander Bluhm <alexander.bluhm@gmx.net>
Subject:
Re: multicast and ethernet simplex counter
To:
tech@openbsd.org
Date:
Thu, 4 Jan 2024 19:53:03 +0100

Download raw body.

Thread
On Fri, Dec 29, 2023 at 11:14:23PM +0100, Alexander Bluhm wrote:
> Hi,
> 
> Counting multicast packets sent to local stack or packets that are
> reflected by simplex interfaces does not make much sense.  They are
> not received or output by any ethernet device.  Counting as lo0
> output is also questionable.  The easiest solution to make this MP
> safe is to delete the code.
> 
> ok?

Anyone?

> Index: net/if.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/net/if.c,v
> diff -u -p -r1.714 if.c
> --- net/if.c	29 Dec 2023 11:43:04 -0000	1.714
> +++ net/if.c	29 Dec 2023 15:06:54 -0000
> @@ -839,11 +839,8 @@ if_input_local(struct ifnet *ifp, struct
>  	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);
>  	}