Bug introduced in 11-0-RELEASE. I have eMachines eM250-1915 and it is Broadcom based wireless NIC. I have used it with NDIS driver until 10.2-RELEASE. After upgrading to 11.0 and re-creating NDIS kernel module, it no longer works. kldload mentions about ndis0 but ifconfig does not show driver become available like below on 11.0. % kldload /boot/modules/bcmwl5_sys.ko ndis0: <Broadcom 802.11g Network Adapter> mem 0x57100000-0x57103fff irq 16 at device 0.0 on pci1 ndis0: NDIS API version: 5.1 % ifconfig alc0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=c3198<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MCAST,WOL_MAGIC,VLAN_HWTSO,LINKSTATE> ether 70:5a:b6:16:82:6e nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> media: Ethernet autoselect lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6> inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 inet 127.0.0.1 netmask 0xff000000 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> groups: lo
sysctl net.wlan.devices ?
(In reply to Andriy Voskoboinyk from comment #1) $ sysctl net.wlan.devices net.wlan.devices: ndis0
It looks rev 286410 (due to compile error, I tested with 286416) is when a problem started. With rev 286416, kldload crashes the system. With 11.0-RELEASE, kernel doesn't crash but ndis does not function.
On 11.0-RELEASE, I also see pci-one error as following today. ndis print is the same as last time. I reran ndisgen and tried. $ kldload ./bcmwl5_sys3.ko pci1: <network> at device 0.0 (no driver attached) ndis0: <Broadcom 802.11g Network Adapter> mem 0x57100000-0x57103fff irq 16 at device 0.0 on pci1 ndis0: NDIS API version: 5.1 I had booted 10.2-RELEASE and ndis didn't have issues.
11.0-RELEASE output, typed by hand. $ pciconf -lv ... ndis@pci0:1:0:0: class=0x028000 card=0xe01b105b chip=0x431514e4 rev=0x01 hdr=0x00 vendor = 'Broadcom Corporation' device = 'BCM4312 802.11b/g LP-PHY' class = netowork
https://svnweb.freebsd.org/base?view=revision&revision=286410 was the trigger. Per comment, "ndis, ... were not tested. ...But the ndis driver is complex, and it is likely to be broken with this commit." NDIS causes kernel panic with ssid is specified. When ssid isn't specified, "list scan" works.
Created attachment 182606 [details] Add ifp pointer check ifnet *ifp pointer became a member of a union. direct pointer access to ifp resulted in incompatible structure in net80211 mode. Thus, I added flag check and adjusted few of callbacks. This is tested on 11.0-REELASE. For longer term solution, I think it is best to split ifnet and ieee80211 handling. However, I tried with less changes to minimize impact and ease branch merge for this.
Assign to glebius@, who committed r286410.
A commit references this bug: Author: glebius Date: Mon May 22 20:00:02 UTC 2017 New revision: 318677 URL: https://svnweb.freebsd.org/changeset/base/318677 Log: Fix regression in ndis(4) after r286410. This adds a bunch of checks for whether this is a Ethernet or 802.11 device and does proper dereferencing. PR: 213237 Submitted by: <ota j.email.ne.jp> MFC after: 2 weeks Changes: head/sys/compat/ndis/kern_ndis.c head/sys/compat/ndis/subr_ndis.c head/sys/dev/if_ndis/if_ndis.c head/sys/dev/if_ndis/if_ndisvar.h
I tested my laptop with NDIS with the latest 12-CURRENT and confirmed working.
A commit references this bug: Author: glebius Date: Thu Jun 8 22:12:10 UTC 2017 New revision: 319726 URL: https://svnweb.freebsd.org/changeset/base/319726 Log: MFC r318677: Fix regression in ndis(4) after r286410. This adds a bunch of checks for whether this is a Ethernet or 802.11 device and does proper dereferencing. PR: 213237 Submitted by: <ota j.email.ne.jp> Approved by: re (marius) Changes: _U stable/11/ stable/11/sys/compat/ndis/kern_ndis.c stable/11/sys/compat/ndis/subr_ndis.c stable/11/sys/dev/if_ndis/if_ndis.c stable/11/sys/dev/if_ndis/if_ndisvar.h