From owner-freebsd-wireless@freebsd.org Wed Sep 16 06:06:04 2015 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EE839CE65D for ; Wed, 16 Sep 2015 06:06:04 +0000 (UTC) (envelope-from mgrooms@shrew.net) Received: from mx2.shrew.net (mx2.shrew.net [38.97.5.132]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1923214BF for ; Wed, 16 Sep 2015 06:06:03 +0000 (UTC) (envelope-from mgrooms@shrew.net) Received: from mail.shrew.net (mail.shrew.prv [10.24.10.20]) by mx2.shrew.net (8.14.7/8.14.7) with ESMTP id t8G642dV035773 for ; Wed, 16 Sep 2015 01:04:02 -0500 (CDT) (envelope-from mgrooms@shrew.net) Received: from [10.22.200.30] (cpe-72-179-24-154.austin.res.rr.com [72.179.24.154]) by mail.shrew.net (Postfix) with ESMTPSA id 14802187E50 for ; Wed, 16 Sep 2015 01:03:51 -0500 (CDT) Subject: Re: urtwn and hostap To: freebsd-wireless@freebsd.org References: <55F90187.10809@shrew.net> From: Matthew Grooms Message-ID: <55F906CB.9030007@shrew.net> Date: Wed, 16 Sep 2015 01:06:03 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <55F90187.10809@shrew.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (mx2.shrew.net [10.24.10.11]); Wed, 16 Sep 2015 01:04:02 -0500 (CDT) X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2015 06:06:04 -0000 On 9/16/2015 12:43 AM, Matthew Grooms wrote: > Hey wireless folks, > > I wanted to setup a Raspberry Pi as a FreeBSD AP and purchased a > picked up a few Edimax 802.11 adapters to play with. Unfortunately > these aren't supported in hostap mode. As it turns out these Edimax > adapters use the RTL8188CUS chipset so I poked around the net and > noticed that Linux does support the host AP feature with it's > RTL8188CUS driver. I was also able to find a patch for OpenBSD that > added support for the RTL8188EU chipset to the urtwn driver ... > > http://marc.info/?l=openbsd-tech&m=143577648117514&w=2 > > So I ordered one of these which arrived from China a few weeks later ... > > http://www.amazon.com/gp/product/B00L28AN88?psc=1&redirect=true&ref_=oh_aui_detailpage_o05_s00 > > > Next I took a stab at porting the patch to FreeBSD. With the attached > patch applied, I was able to setup a wlan0 device with the hostap > feature. After bridging it with the LAN I could associate with my > android phone, obtain an IP address via DHCP, browse a few web pages > and watch all the packets pass through the bridge. Sadly, when I > attempted to destroy the wlan0 device I got a kernel panic. The > screenshot for that is also attached and I'm not sure if I'm going to > be able to figure this one out without some help. I'm pretty out of my > element here. I assume it's happening in ieee80211_free_node() when > IEEE80211_NODE_LOCK() is called. To be clear, the crash only occurs > when the adapter is configured in hostap mode with the patch applied. > Anyone have any suggestions as to what I should be looking at to > prevent this crash? > > If I can get this working for the RTL8188EU, I'll also take a stab at > getting the RTL8188CUS chipset working in hostap mode. That is, > assuming I can glean enough info from drivers that support this > feature on other open source platforms. It appears to be extremely > popular with the Raspberry PI crowd ... > > http://www.amazon.com/Edimax-EW-7811Un-150Mbps-Raspberry-Supports/dp/B003MTTJOY > > It looks like my screenshot got scrubbed. Here is my hopefully faithful transcription ... Fatal trap 9: general protection fault while in kernel mode cpuid = 3; apic id = 03 instruction pointer = 0x20:0xffffffff80a01105 stack pointer = 0x28:0xfffffe0092fe86f0 frame pointer = 0x28:0xfffffe0092fe8740 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 716 (ifconfig) [thread pid 716 tid 100082 ] Stopped at __mtx_lock_flags+0x55: movq (%r13),%rax db> bt Tracing pid 716 tid 100082 td 0xffffff800512814d0 __mtx_lock_flags() at __mtx_lock_flags+0x55/frame 0xfffffe0092fe8740 ieee80211_free_node() at ieee80211_free_node()_0x38/frame 0xfffffe0092fe8780 ieee80211_node_vdetach() at ieee80211_node_vdetach()+0x2d/frame 0xfffffe0092fe87a0 ieee80211_vap_detach() at ieee80211_vap_detach()+0x35e/frame 0xfffffe0092fe87d0 urtwn_vap_delete() at urtwn_vap_delete()+0xe/frame 0xfffffe0092fe87f0 if_clone_destroyif() at if_clone_destroyif()+0x1aa/frame 0xfffffe0092fe8840 if_clone_destroy() at if_clone_destroy()0x8e/frame 0xfffffe0092fe8860 kern_ioctl() at kern_ioctl()+0x230/frame 0xfffffe0092fe88c0 sys_ioctl() at sys_ioctl()+0x153/frame 0xfffffe0092fe89a0 amd64_syscall() at amd64_syscall()+0x282/frame 0xfffffe0092fe8ab0 Xfast_syscall() at Xfast_syscall()+0xfb/frame 0xfffffe0092fe8ab0 -- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x8011e8c8a, rsp = 0x7fffffffe2f8, rbp = 0x7fffffffe310 -- db> -Matthew