Date: Sat, 10 Mar 2001 19:31:22 +0700 (NKZ) From: Vladimir Kurtukov <vk@hvv.svzserv.kemerovo.su> To: FreeBSD-gnats-submit@freebsd.org Subject: kern/25650: le nic driver causes kernel panic Message-ID: <200103101231.TAA13727@hvv.svzserv.kemerovo.su>
next in thread | raw e-mail | index | archive | help
>Number: 25650 >Category: kern >Synopsis: le nic driver causes kernel panic >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Mar 10 04:40:02 PST 2001 >Closed-Date: >Last-Modified: >Originator: Vladimir Kurtukov <vk@hvv.svzserv.kemerovo.su> >Release: FreeBSD 4.2-STABLE i386 >Organization: JSC SvzServ >Environment: FreeBSD p200.trust.kemerovo.su 4.2-STABLE FreeBSD 4.2-STABLE #11: Sat Mar 10 18:25:29 KRAT 2001 root@p200.trust.kemerovo.su:/usr/src/sys/compile/TRUST i386 This bug is in all 4.x versions >Description: le nic driver is broken: driver interface was changed but driver was incorrectly updated to new interface. Generic ether_ioctl from if_ethersubr.c make nic initialization in a way like this: ifp->if_init(ifp->if_softc); But lemac_init or lance_init functions from if_le.c have another syntax, they need unit number as an argument. Correct way for le driver is: (*sc->if_init)(ifp->if_unit); >How-To-Repeat: Compile in le driver into kernel and try to assign an IP address for it - result will be immediate kernel panic >Fix: Here is my patch (code taken from 3.5-STABLE): --- if_le.std Tue Jul 18 05:24:30 2000 +++ if_le.new Sat Mar 10 17:05:01 2001 @@ -441,7 +441,66 @@ s = splimp(); switch (cmd) { - case SIOCSIFADDR: + case SIOCSIFADDR: { + struct ifaddr *ifa = (struct ifaddr *)data; + + ifp->if_flags |= IFF_UP; + switch(ifa->ifa_addr->sa_family) { +#ifdef INET + case AF_INET: { + (*sc->if_init)(ifp->if_unit); + arp_ifinit((struct arpcom *)ifp, ifa); + break; + } +#endif /* INET */ +#ifdef IPX + /* This magic copied from if_is.c; I don't use XNS, + * so I have no way of telling if this actually + * works or not. + */ + case AF_IPX: { + struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr); + if (ipx_nullhost(*ina)) { + ina->x_host = *(union ipx_host *)(sc->le_ac.ac_enaddr); + } else { + ifp->if_flags &= ~IFF_RUNNING; + bcopy((caddr_t)ina->x_host.c_host, + (caddr_t)sc->le_ac.ac_enaddr, + sizeof sc->le_ac.ac_enaddr); + } + + (*sc->if_init)(ifp->if_unit); + break; + } +#endif /* IPX */ +#ifdef NS + /* This magic copied from if_is.c; I don't use XNS, + * so I have no way of telling if this actually + * works or not. + */ + case AF_NS: { + struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr); + if (ns_nullhost(*ina)) { + ina->x_host = *(union ns_host *)(sc->le_ac.ac_enaddr); + } else { + ifp->if_flags &= ~IFF_RUNNING; + bcopy((caddr_t)ina->x_host.c_host, + (caddr_t)sc->le_ac.ac_enaddr, + sizeof sc->le_ac.ac_enaddr); + } + + (*sc->if_init)(ifp->if_unit); + break; + } +#endif /* NS */ + default: { + (*sc->if_init)(ifp->if_unit); + break; + } + } + break; + } + case SIOCGIFADDR: case SIOCSIFMTU: error = ether_ioctl(ifp, cmd, data); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103101231.TAA13727>