From 50a9baacb4f8e57e98d549545dd9cc55233f86ea Mon Sep 17 00:00:00 2001 From: suz Date: Wed, 10 Apr 2002 04:18:42 +0000 Subject: fixed a kernel crash when enabling multicast on vlan interface owing to a NULL argument to vlan_ioctl() at if_allmulti(). Reviewed by: ume MFC after: 1 week --- sys/net/if.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sys/net') diff --git a/sys/net/if.c b/sys/net/if.c index 854a879..1b64e91 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1646,11 +1646,13 @@ if_allmulti(ifp, onswitch) { int error = 0; int s = splimp(); + struct ifreq ifr; if (onswitch) { if (ifp->if_amcount++ == 0) { ifp->if_flags |= IFF_ALLMULTI; - error = ifp->if_ioctl(ifp, SIOCSIFFLAGS, 0); + ifr.ifr_flags = ifp->if_flags; + error = ifp->if_ioctl(ifp, SIOCSIFFLAGS, (caddr_t)&ifr); } } else { if (ifp->if_amcount > 1) { @@ -1658,7 +1660,8 @@ if_allmulti(ifp, onswitch) } else { ifp->if_amcount = 0; ifp->if_flags &= ~IFF_ALLMULTI; - error = ifp->if_ioctl(ifp, SIOCSIFFLAGS, 0); + ifr.ifr_flags = ifp->if_flags; + error = ifp->if_ioctl(ifp, SIOCSIFFLAGS, (caddr_t)&ifr); } } splx(s); @@ -1870,9 +1873,11 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, int len) */ if ((ifp->if_flags & IFF_UP) != 0) { ifp->if_flags &= ~IFF_UP; - (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, NULL); + ifr.ifr_flags = ifp->if_flags; + (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, (caddr_t)&ifr); ifp->if_flags |= IFF_UP; - (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, NULL); + ifr.ifr_flags = ifp->if_flags; + (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, (caddr_t)&ifr); #ifdef INET /* * Also send gratuitous ARPs to notify other nodes about -- cgit v1.1