Index | Thread | Search

From:
Vitaliy Makkoveev <otto@bsdbox.dev>
Subject:
Re: multicast and ethernet simplex counter
To:
Alexander Bluhm <alexander.bluhm@gmx.net>
Cc:
tech@openbsd.org
Date:
Fri, 5 Jan 2024 03:59:17 +0300

Download raw body.

Thread
> On 4 Jan 2024, at 21:53, Alexander Bluhm <alexander.bluhm@gmx.net> wrote:
> 
> 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?
> 

ok by me

>> 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);
>> 	}
>