From nobody  Fri Mar 21 00:35:12 1997
Received: (from nobody@localhost)
          by freefall.freebsd.org (8.8.5/8.8.5) id AAA04341;
          Fri, 21 Mar 1997 00:35:12 -0800 (PST)
Message-Id: <199703210835.AAA04341@freefall.freebsd.org>
Date: Fri, 21 Mar 1997 00:35:12 -0800 (PST)
From: itojun@itojun.org
To: freebsd-gnats-submit@freebsd.org
Subject: multicast support necessery in some drivers.
X-Send-Pr-Version: www-1.0

>Number:         3048
>Category:       i386
>Synopsis:       multicast support necessery in some drivers.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 21 00:40:01 PST 1997
>Closed-Date:    Sat Aug 23 14:56:23 MEST 1997
>Last-Modified:  Sat Aug 23 14:56:47 MEST 1997
>Originator:     Jun-ichiro Itoh
>Release:        2.2-RELEASE
>Organization:
>Environment:
FreeBSD fennel.csl.sony.co.jp 2.2-RELEASE FreeBSD 2.2-RELEASE #0: Fri Mar 21 16:39:26 JST 1997     root@fennel.csl.sony.co.jp:/usr/src/sys/compile/PAO  i386

>Description:
Current situation:
- Some drivers (ep, zp) have IFF_MULTICAST raised, without multicast support.

Should be:
- drivers that has multicast support must have IFF_MULTICAST raised, and proper handling
  of multicast packets.
- drivers that does not have multicast support, and that does have promisc mode support,
  should have IFF_MULTICAST raised, and set to PROMISC mode if more than one multicast
  address filter has set by SIOCADDMULTI. (It eats your CPU time, however, it enables
  you to accept multicast packets)
- drivers that does not have multicast support nor promisc mode support, should have
  IFF_MULTICAST cleared.
>How-To-Repeat:
always.
>Fix:
If there's nobody working on it, I'll make some patches.  Please drop me a note.
Thanks.

>Release-Note:
>Audit-Trail:

From: Jun-ichiro Itoh <itojun@csl.sony.co.jp>
To: freebsd-gnats-submit@freebsd.org, itojun@itojun.org
Cc: itojun@csl.sony.co.jp
Subject: Re: i386/3048: multicast support necessery in some drivers.
Date: Sat, 22 Mar 1997 22:58:56 +0900

 	A quick patch to ep driver would be as follows.
 
 itojun
 
 
 ---
 *** if_ep.c-	Fri Mar 21 19:18:35 1997
 --- if_ep.c	Fri Mar 21 19:30:20 1997
 ***************
 *** 131,136 ****
 --- 131,138 ----
   static	void epstart __P((struct ifnet *));
   static	void epstop __P((struct ep_softc *));
   static	void epwatchdog __P((struct ifnet *));
 + static	size_t ep_countmcast __P((struct ep_softc *));
 + static	void ep_setmcast __P((struct ep_softc *));
   
   #if 0
   static	int send_ID_sequence __P((int));
 ***************
 *** 768,779 ****
   
       outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS);
   
 ! 	if(ifp->if_flags & IFF_PROMISC)
 ! 		outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL |
 ! 		 FIL_GROUP | FIL_BRDCST | FIL_ALL);
 ! 	else
 ! 		outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL |
 ! 		 FIL_GROUP | FIL_BRDCST);
   
   	 /*
   	  * S.B.
 --- 770,776 ----
   
       outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS);
   
 ! 	ep_setmcast(sc);
   
   	 /*
   	  * S.B.
 ***************
 *** 1486,1497 ****
   		}
   		break; 
   	case SIOCADDMULTI:
   	case SIOCDELMULTI:
 ! 	    /* Now this driver has no support for programmable
 ! 	     * multicast filters. If some day it will gain this
 ! 	     * support this part of code must be extended.
 ! 	     */
 ! 	    error=0;
   	    break;
         default:
   		error = EINVAL;
 --- 1483,1502 ----
   		}
   		break; 
   	case SIOCADDMULTI:
 + 	    error = ether_addmulti(ifr, &sc->arpcom);
 + 	    if (error == ENETRESET) {
 + 		/* update multicast filter list. */
 + 		ep_setmcast(sc);
 + 		error = 0;
 + 	    }
 + 	    break;
   	case SIOCDELMULTI:
 ! 	    error = ether_delmulti(ifr, &sc->arpcom);
 ! 	    if (error == ENETRESET) {
 ! 		/* update multicast filter list. */
 ! 		ep_setmcast(sc);
 ! 		error = 0;
 ! 	    }
   	    break;
         default:
   		error = EINVAL;
 ***************
 *** 1628,1631 ****
 --- 1633,1681 ----
       splx(s);
   }
   
 + static size_t
 + ep_countmcast(sc)
 +     struct ep_softc *sc;
 + {
 +     register struct ether_multi *enm;
 +     register struct ether_multistep step;
 +     size_t count;
 + 
 +     count = 0;
 +     ETHER_FIRST_MULTI(step, &sc->arpcom, enm);
 +     while (enm != NULL) {
 + 	count++;
 + 	ETHER_NEXT_MULTI(step, enm);
 +     }
 + 
 +     return count;
 + }
 + 
 + static void
 + ep_setmcast(sc)
 +     struct ep_softc *sc;
 + {
 +     struct ifnet *ifp = (struct ifnet *)sc;
 +     int dopromisc = 0;
 + 
 +     if (ifp->if_flags & IFF_PROMISC)
 + 	dopromisc = 1;
 +     else if (ifp->if_flags & IFF_MULTICAST) {
 + 	if (ifp->if_flags & IFF_ALLMULTI)
 + 	    dopromisc = 1;
 + 	else if (ep_countmcast(sc))
 + 	    dopromisc = 1;
 + 	else
 + 	    dopromisc = 0;
 +     } else
 + 	dopromisc = 0;
 + 
 +     if (dopromisc) {
 + 	outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL |
 + 	 FIL_GROUP | FIL_BRDCST | FIL_ALL);
 +     } else {
 + 	outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL |
 + 	 FIL_GROUP | FIL_BRDCST);
 +     }
 + }
   #endif				/* NEP > 0 */

From: Bill Fenner <fenner@parc.xerox.com>
To: itojun@itojun.org
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: i386/3048: multicast support necessery in some drivers. 
Date: Mon, 24 Mar 1997 13:48:49 PST

 itojun@itojun.org wrote:
 >- Some drivers (ep, zp) have IFF_MULTICAST raised, without multicast support.
 
 ep's multicast support works on a 3c509 in 2.2-RELEASE; I'm using it on
 a machine I installed last Friday.
 
   Bill

From: itojun@itojun.org
To: Bill Fenner <fenner@parc.xerox.com>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: i386/3048: multicast support necessery in some drivers. 
Date: Tue, 25 Mar 1997 09:14:57 +0900

 >>- Some drivers (ep, zp) have IFF_MULTICAST raised, without multicast support.
 >ep's multicast support works on a 3c509 in 2.2-RELEASE; I'm using it on
 >a machine I installed last Friday.
 
 	I have to check again with this.  Thanks.
 	(SIOCADDMULTI and SIOCDELMULTI has a comment that says "they are
 	unsupported")
 
 itojun

From: Bill Fenner <fenner@parc.xerox.com>
To: fenner@parc.xerox.com, itojun@itojun.org
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: i386/3048: multicast support necessery in some drivers.
Date: Mon, 24 Mar 1997 16:24:39 PST

 >	(SIOCADDMULTI and SIOCDELMULTI has a comment that says "they are
 >	unsupported")
 
 The comment says that programmable filters aren't supported.
 Since there is always at least one group membership (224.0.0.1)
 on each interface, the ep driver doesn't bother keeping track
 of specific group memberships; it just configures the card to
 receive all multicast.
 
   Bill

From: Bill Fenner <fenner@parc.xerox.com>
To: freebsd-gnats-submit@freebsd.org
Cc:  Subject: Re: i386/3048: multicast support in some drivers
Date: Wed, 26 Mar 1997 09:13:32 PST

 To settle the issue of whether or not the Etherlink cards
 support multicast group filters, I quote from the EtherLink
 III Paralell Tasking ISA, EISA, Micro Channel, and PCMCIA
 Adapter Drivers Technical Reference:
 
 
 At power-up, the Receive filter defaults to zero and must be
 set with this command before any packets can be received.
 Enabling group address reception implies broadcast reception.
 There is no individual filtering of group/multicast
 addresses. Promiscuous mode implies all others.
 
 
 Thus, the comment in the if_ep.c driver is a little misleading;
 it's the card that doesn't support individual group filters.
 
   Bill
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Sat Aug 23 14:56:23 MEST 1997 
State-Changed-Why:  
See the audit-trail for a discussion. 
>Unformatted:
