kern/67862: if_udav failed to set the promiscuous mode

Shingo WATANABE nabe at nabechan.org
Sat Jun 12 06:20:12 GMT 2004


>Number:         67862
>Category:       kern
>Synopsis:       if_udav  failed to set the promiscuous mode
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jun 12 06:20:10 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Shingo WATANABE
>Release:        FreeBSD 5.2-CURRENT
>Organization:
personal
>Environment:
FreeBSD hack.nabechan.org 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Wed Jun  9 01:28:25 JST 2004     nabe at hack.nabechan.org:/usr/obj/usr/src/sys/HACK  i386

>Description:
The udav(4) driver was ported from NetBSD.  This driver works well except for the promiscuous mode.  To support the promiscuous mode udav(4) driver needs to handle the SIOCSIFFLAGS ioctl.  This problem is caused by the difference of ether_ioctl() function between FreeBSD and NetBSD.

I attached the patch to fix this problem, please commit this if it has not any problem.
regards
>How-To-Repeat:
try to launch tcpdump using udav(4) interface.
>Fix:
apply the following patch.

--- if_udav.c.org	2004-06-04 11:32:33.000000000 +0900
+++ if_udav.c	2004-06-04 11:51:24.000000000 +0900
@@ -1562,6 +1562,35 @@
 #endif
 
 	switch (cmd) {
+#if defined(__FreeBSD__)
+	case SIOCSIFFLAGS:
+		if (ifp->if_flags & IFF_UP) {
+			if (ifp->if_flags & IFF_RUNNING &&
+			    ifp->if_flags & IFF_PROMISC) {
+				UDAV_SETBIT(sc, UDAV_RCR,
+					    UDAV_RCR_ALL|UDAV_RCR_PRMSC);
+			} else if (ifp->if_flags & IFF_RUNNING &&
+				   !(ifp->if_flags & IFF_PROMISC)) {
+				if (ifp->if_flags & IFF_ALLMULTI)
+					UDAV_CLRBIT(sc, UDAV_RCR,
+						    UDAV_RCR_PRMSC);
+				else
+					UDAV_CLRBIT(sc, UDAV_RCR,
+						    UDAV_RCR_ALL|UDAV_RCR_PRMSC);
+			} else if (!(ifp->if_flags & IFF_RUNNING))
+				udav_init(sc);
+		} else {
+			if (ifp->if_flags & IFF_RUNNING)
+				udav_stop(ifp, 1);
+		}
+		error = 0;
+		break;
+	case SIOCADDMULTI:
+	case SIOCDELMULTI:
+		udav_setmulti(sc);
+		error = 0;
+		break;
+#endif
 	case SIOCGIFMEDIA:
 	case SIOCSIFMEDIA:
 		mii = GET_MII(sc);
@@ -1570,10 +1599,12 @@
 
 	default:
 		error = ether_ioctl(ifp, cmd, data);
+#if defined(__NetBSD__)
 		if (error == ENETRESET) {
 			udav_setmulti(sc);
 			error = 0;
 		}
+#endif
 		break;
 	}
 

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list