From owner-freebsd-bugs Sat Mar 10 4:40:14 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id A8CF737B71B for ; Sat, 10 Mar 2001 04:40:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2ACe2d09050; Sat, 10 Mar 2001 04:40:02 -0800 (PST) (envelope-from gnats) Received: from hvv.svzserv.kemerovo.su (hvv.svzserv.kemerovo.su [213.184.65.67]) by hub.freebsd.org (Postfix) with ESMTP id C485637B718 for ; Sat, 10 Mar 2001 04:31:16 -0800 (PST) (envelope-from vk@hvv.svzserv.kemerovo.su) Received: (from vk@localhost) by hvv.svzserv.kemerovo.su (8.9.3/8.9.3) id TAA13727; Sat, 10 Mar 2001 19:31:22 +0700 (NKZ) (envelope-from vk) Message-Id: <200103101231.TAA13727@hvv.svzserv.kemerovo.su> Date: Sat, 10 Mar 2001 19:31:22 +0700 (NKZ) From: Vladimir Kurtukov Reply-To: vk@hvv.svzserv.kemerovo.su To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/25650: le nic driver causes kernel panic Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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 >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