Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Sep 2015 00:43:35 -0500
From:      Matthew Grooms <mgrooms@shrew.net>
To:        freebsd-wireless@freebsd.org
Subject:   urtwn and hostap
Message-ID:  <55F90187.10809@shrew.net>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------020602080509020909060107
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

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

Thanks in advance,

-Matthew

--------------020602080509020909060107
Content-Type: text/plain; charset=UTF-8;
 name="urtwn.diff"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="urtwn.diff"

SW5kZXg6IGRldi91c2Ivd2xhbi9pZl91cnR3bi5jCj09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIGRldi91
c2Ivd2xhbi9pZl91cnR3bi5jCShyZXZpc2lvbiAyODczNDIpCisrKyBkZXYvdXNiL3dsYW4v
aWZfdXJ0d24uYwkod29ya2luZyBjb3B5KQpAQCAtMTgxLDYgKzE4MSw4IEBACiBzdGF0aWMg
c3RydWN0IG1idWYgKgl1cnR3bl9yeGVvZihzdHJ1Y3QgdXNiX3hmZXIgKiwgc3RydWN0IHVy
dHduX2RhdGEgKiwKIAkJCSAgICBpbnQgKiwgaW50OF90ICopOwogc3RhdGljIHZvaWQJCXVy
dHduX3R4ZW9mKHN0cnVjdCB1c2JfeGZlciAqLCBzdHJ1Y3QgdXJ0d25fZGF0YSAqKTsKK2lu
dAkJCXVydHduX3R4YmNuKHN0cnVjdCBpZWVlODAyMTF2YXAgKnZhcCwKKwkJCSAgICBzdHJ1
Y3QgaWVlZTgwMjExX25vZGUgKik7CiBzdGF0aWMgaW50CQl1cnR3bl9hbGxvY19saXN0KHN0
cnVjdCB1cnR3bl9zb2Z0YyAqLAogCQkJICAgIHN0cnVjdCB1cnR3bl9kYXRhW10sIGludCwg
aW50KTsKIHN0YXRpYyBpbnQJCXVydHduX2FsbG9jX3J4X2xpc3Qoc3RydWN0IHVydHduX3Nv
ZnRjICopOwpAQCAtNDM2LDYgKzQzOCwxMCBAQAogCQl8IElFRUU4MDIxMV9DX1dQQQkJLyog
ODAyLjExaSAqLwogCQk7CiAKKwlpZiAoc2MtPmNoaXAgJiBVUlRXTl9DSElQXzg4RSkKKwkJ
aWMtPmljX2NhcHMgfD0KKwkJICAgIElFRUU4MDIxMV9DX0hPU1RBUDsJCS8qIEhvc3RBcCB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T09PT09PQotLS0g
ZGV2L3VzYi93bGFuL2lmX3VydHducmVnLmgJKHJldmlzaW9uIDI4NzM0MikKKysrIGRldi91
c2Ivd2xhbi9pZl91cnR3bnJlZy5oCSh3b3JraW5nIGNvcHkpCkBAIC0xMDE5LDcgKzEwMTks
OSBAQAogI2RlZmluZSBSOTJDX1RYRFcxX1FTRUxfTQkweDAwMDAxZjAwCiAjZGVmaW5lIFI5
MkNfVFhEVzFfUVNFTF9TCTgKICNkZWZpbmUgUjkyQ19UWERXMV9RU0VMX0JFCTB4MDAKKyNk
ZWZpbmUgUjg4RV9UWERXMV9RU0VMX0JFCTB4MDMKICNkZWZpbmUgUjkyQ19UWERXMV9RU0VM
X01HTlQJMHgxMgorI2RlZmluZSBSODhFX1RYRFcxX1FTRUxfTUdOVAkweDEwCiAjZGVmaW5l
IFI5MkNfVFhEVzFfUkFJRF9NCTB4MDAwZjAwMDAKICNkZWZpbmUgUjkyQ19UWERXMV9SQUlE
X1MJMTYKICNkZWZpbmUgUjkyQ19UWERXMV9DSVBIRVJfTQkweDAwYzAwMDAwCg==
--------------020602080509020909060107--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?55F90187.10809>