NetBSD Problem Report #57648

From sc.dying@gmail.com  Sun Oct  8 20:31:06 2023
Return-Path: <sc.dying@gmail.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id E9B4E1A9238
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  8 Oct 2023 20:31:05 +0000 (UTC)
Message-Id: <1b5bf970-1dfd-47b4-b1f5-aded0de7a5a8@gmail.com>
Date: Sun, 8 Oct 2023 20:30:49 +0000
From: sc.dying@gmail.com
To: gnats-bugs@NetBSD.org
Subject: ure(4) ignores multicasts in promisc mode

>Number:         57648
>Category:       kern
>Synopsis:       ure(4) ignores multicasts in promisc mode
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 08 20:35:01 +0000 2023
>Closed-Date:    Tue Oct 17 14:28:34 +0000 2023
>Last-Modified:  Tue Oct 17 14:28:34 +0000 2023
>Originator:     sc.dying@gmail.com
>Release:        NetBSD-10.99.10 (and netbsd-10)
>Organization:
>Environment:

>Description:
	ure(4) ignores multicast-but-not-broadcast packets in promisc
	mode because ure forgets setting multicast filter to accept all.

>How-To-Repeat:
	code comparison with netbsd-9
>Fix:

Please apply this patch.

--- sys/dev/usb/if_ure.c.orig	2022-09-16 22:11:45.019756111 +0000
+++ sys/dev/usb/if_ure.c	2023-10-08 19:35:26.905586897 +0000
@@ -358,6 +358,7 @@ ure_uno_mcast(struct ifnet *ifp)
 		/* run promisc. mode */
 		rxmode |= URE_RCR_AM;	/* ??? */
 		rxmode |= URE_RCR_AAP;
+		mchash[0] = mchash[1] = ~0U;
 		goto update;
 	}
 	ec->ec_flags &= ~ETHER_F_ALLMULTI;

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/57648: ure(4) ignores multicasts in promisc mode
Date: Mon, 9 Oct 2023 08:07:16 +0200

 On Sun, Oct 08, 2023 at 08:35:01PM +0000, sc.dying@gmail.com wrote:
 > >How-To-Repeat:
 > 	code comparison with netbsd-9

 Have you tested it?

 > Please apply this patch.
 > 
 > --- sys/dev/usb/if_ure.c.orig	2022-09-16 22:11:45.019756111 +0000
 > +++ sys/dev/usb/if_ure.c	2023-10-08 19:35:26.905586897 +0000
 > @@ -358,6 +358,7 @@ ure_uno_mcast(struct ifnet *ifp)
 >  		/* run promisc. mode */
 >  		rxmode |= URE_RCR_AM;	/* ??? */
 >  		rxmode |= URE_RCR_AAP;
 > +		mchash[0] = mchash[1] = ~0U;

 Shouldn't this be a no-op due to URE_RCR_AM being set?

 Martin

From: sc.dying@gmail.com
To: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org, gnats-admin@netbsd.org
Cc: 
Subject: Re: kern/57648: ure(4) ignores multicasts in promisc mode
Date: Mon, 9 Oct 2023 07:43:05 +0000

 On 2023/10/09 6:10, Martin Husemann wrote:
 > The following reply was made to PR kern/57648; it has been noted by GNATS.
 > 
 > From: Martin Husemann <martin@duskware.de>
 > To: gnats-bugs@netbsd.org
 > Cc: 
 > Subject: Re: kern/57648: ure(4) ignores multicasts in promisc mode
 > Date: Mon, 9 Oct 2023 08:07:16 +0200
 > 
 >  On Sun, Oct 08, 2023 at 08:35:01PM +0000, sc.dying@gmail.com wrote:
 >  > >How-To-Repeat:
 >  > 	code comparison with netbsd-9
 >  
 >  Have you tested it?

 Yes, patched code builds and works.

 ping6 to a address that is not any of ure under test
 generates ND multicast packet.
 If usbnet promisc bug is fixed, you can confirm that
 ure in promisc mode cannot observe this multicast
 on tcpdump.

 >  
 >  > Please apply this patch.
 >  > 
 >  > --- sys/dev/usb/if_ure.c.orig	2022-09-16 22:11:45.019756111 +0000
 >  > +++ sys/dev/usb/if_ure.c	2023-10-08 19:35:26.905586897 +0000
 >  > @@ -358,6 +358,7 @@ ure_uno_mcast(struct ifnet *ifp)
 >  >  		/* run promisc. mode */
 >  >  		rxmode |= URE_RCR_AM;	/* ??? */
 >  >  		rxmode |= URE_RCR_AAP;
 >  > +		mchash[0] = mchash[1] = ~0U;
 >  
 >  Shouldn't this be a no-op due to URE_RCR_AM being set?

 I'm not sure this is a bug.
 netbsd-9's if_ure.c line 366 and
 linux's drivers/net/usb/r8152.c line 2736
 describe so.

 >  
 >  Martin
 >  

From: Martin Husemann <martin@duskware.de>
To: sc.dying@gmail.com
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/57648: ure(4) ignores multicasts in promisc mode
Date: Mon, 9 Oct 2023 09:46:55 +0200

 On Mon, Oct 09, 2023 at 07:43:05AM +0000, sc.dying@gmail.com wrote:
 > Yes, patched code builds and works.

 I meant: have you verified the unpatched code actually does not work?

 > ping6 to a address that is not any of ure under test
 > generates ND multicast packet.
 > If usbnet promisc bug is fixed, you can confirm that
 > ure in promisc mode cannot observe this multicast
 > on tcpdump.

 Yes, that is a good test for this case (and I wouldn't be suprised if
 the AM flag does not do what the name seems to imply).

 Martin

From: sc.dying@gmail.com
To: Martin Husemann <martin@duskware.de>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/57648: ure(4) ignores multicasts in promisc mode
Date: Mon, 9 Oct 2023 08:00:13 +0000

 On 2023/10/09 7:46, Martin Husemann wrote:
 > On Mon, Oct 09, 2023 at 07:43:05AM +0000, sc.dying@gmail.com wrote:
 >> Yes, patched code builds and works.
 > 
 > I meant: have you verified the unpatched code actually does not work?

 Ah, without patch, it does not work.

 While testing usbnet patch, I've noticed
 ping and arping (uses broadcast) work, but
 ping6 (uses multicast) does not.
 That's why I sent this PR.

 > 
 >> ping6 to a address that is not any of ure under test
 >> generates ND multicast packet.
 >> If usbnet promisc bug is fixed, you can confirm that
 >> ure in promisc mode cannot observe this multicast
 >> on tcpdump.
 > 
 > Yes, that is a good test for this case (and I wouldn't be suprised if
 > the AM flag does not do what the name seems to imply).
 > 
 > Martin

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57648 CVS commit: src/sys/dev/usb
Date: Mon, 9 Oct 2023 11:28:05 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Mon Oct  9 11:28:05 UTC 2023

 Modified Files:
 	src/sys/dev/usb: if_ure.c

 Log Message:
 ure(4): Set all bits, not no bits, in multicast filter for promisc.

 This was lost in revision 1.40.

 PR kern/57648

 XXX pullup-10


 To generate a diff of this commit:
 cvs rdiff -u -r1.58 -r1.59 src/sys/dev/usb/if_ure.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 09 Oct 2023 17:46:32 +0000
State-Changed-Why:
fix committed, needs pullup-10
(regression since netbsd-9)


State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Thu, 12 Oct 2023 18:37:25 +0000
State-Changed-Why:
pullup-10 #413 https://releng.netbsd.org/cgi-bin/req-10.cgi?show=413


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57648 CVS commit: [netbsd-10] src/sys/dev/usb
Date: Sat, 14 Oct 2023 06:58:19 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Oct 14 06:58:19 UTC 2023

 Modified Files:
 	src/sys/dev/usb [netbsd-10]: if_ure.c

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #413):

 	sys/dev/usb/if_ure.c: revision 1.59

 ure(4): Set all bits, not no bits, in multicast filter for promisc.
 This was lost in revision 1.40.
 PR kern/57648


 To generate a diff of this commit:
 cvs rdiff -u -r1.58 -r1.58.4.1 src/sys/dev/usb/if_ure.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 17 Oct 2023 14:28:34 +0000
State-Changed-Why:
fixed and pulled up


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.