Subject: sys/dev/ic/an.c:an_ioctl, SIOCSIFFLAGS case
To: None <tech-net@netbsd.org>
From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
List: tech-net
Date: 05/24/2001 16:51:37
	in an driver, what is the intention of the following code?
	it seems odd to me that it takes & between new if_flags value and
	old value.  i guess it should be ifp->if_flags only.

itojun


---
	switch(command) {
	case SIOCSIFFLAGS:
		if ((ifp->if_flags & sc->an_if_flags &
		    (IFF_UP | IFF_RUNNING)) == (IFF_UP | IFF_RUNNING)) {
			if (ifp->if_flags & IFF_PROMISC &&
			    !(sc->an_if_flags & IFF_PROMISC)) {
				an_promisc(sc, 1);
				break;
			}
			if (!(ifp->if_flags & IFF_PROMISC) &&
			    sc->an_if_flags & IFF_PROMISC) {
				an_promisc(sc, 0);
				break;
			}
		}
		error = ether_ioctl(ifp, command, data);
		sc->an_if_flags = ifp->if_flags;
		break;