2011-04-27 16:25:18

by Larry Finger

[permalink] [raw]
Subject: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

From: Jeff Chua <[email protected]>

Driver r8712u is unable to handle ad-hoc mode. The issue is that when
the driver first starts, there will not be an SSID for association.
The fix is to always call the "select and join from scan" routine when
in ad-hoc mode.

Note: Ad-hoc mode worked intermittently before. If the driver had
previously been associated, then things were OK.

Signed-off-by: Jeff Chua <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Cc: Stable <[email protected]>
---

Index: linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_set.c
===================================================================
--- linux-2.6.orig/drivers/staging/rtl8712/rtl871x_ioctl_set.c
+++ linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_set.c
@@ -68,7 +68,10 @@ static u8 do_join(struct _adapter *padap
pmlmepriv->fw_state |= _FW_UNDER_LINKING;
pmlmepriv->pscanned = plist;
pmlmepriv->to_join = true;
- if (_queue_empty(queue) == true) {
+
+ /* adhoc mode will start with an empty queue, but skip checking */
+ if (!check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) &&
+ _queue_empty(queue)) {
if (pmlmepriv->fw_state & _FW_UNDER_LINKING)
pmlmepriv->fw_state ^= _FW_UNDER_LINKING;
/* when set_ssid/set_bssid for do_join(), but scanning queue


2011-04-28 15:08:28

by clemens fischer

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

> Larry Finger:

> From: Jeff Chua <[email protected]>
>
> Driver r8712u is unable to handle ad-hoc mode. The issue is that when
> the driver first starts, there will not be an SSID for association.
> The fix is to always call the "select and join from scan" routine when
> in ad-hoc mode.
>
> Note: Ad-hoc mode worked intermittently before. If the driver had
> previously been associated, then things were OK.
>
> Signed-off-by: Jeff Chua <[email protected]>
> Signed-off-by: Larry Finger <[email protected]>
> Cc: Stable <[email protected]>
> ---
>
> Index: linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_set.c
> ===================================================================
> --- linux-2.6.orig/drivers/staging/rtl8712/rtl871x_ioctl_set.c
> +++ linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_set.c
> @@ -68,7 +68,10 @@ static u8 do_join(struct _adapter *padap
> pmlmepriv->fw_state |= _FW_UNDER_LINKING;
> pmlmepriv->pscanned = plist;
> pmlmepriv->to_join = true;
> - if (_queue_empty(queue) == true) {
> +
> + /* adhoc mode will start with an empty queue, but skip checking */
> + if (!check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) &&
> + _queue_empty(queue)) {
> if (pmlmepriv->fw_state & _FW_UNDER_LINKING)
> pmlmepriv->fw_state ^= _FW_UNDER_LINKING;
> /* when set_ssid/set_bssid for do_join(), but scanning queue

Thanks for CC'ing me.

This patch doesn't solve my problem[1], unfortunately. I am using
iwconfig(8) to setup things, and it is still impossible to set the ESSID
and the power saving mode. In my case it was even possible to get into
Ad-hoc mode without the patch and without ever beeing associated.

[1] https://bugzilla.kernel.org/show_bug.cgi?id=33352


regards, clemens fischer

2011-04-28 15:31:35

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

On 04/28/2011 10:08 AM, clemens fischer wrote:
>> Larry Finger:
>
>> From: Jeff Chua<[email protected]>
>>
>> Driver r8712u is unable to handle ad-hoc mode. The issue is that when
>> the driver first starts, there will not be an SSID for association.
>> The fix is to always call the "select and join from scan" routine when
>> in ad-hoc mode.
>>
>> Note: Ad-hoc mode worked intermittently before. If the driver had
>> previously been associated, then things were OK.
>>
>> Signed-off-by: Jeff Chua<[email protected]>
>> Signed-off-by: Larry Finger<[email protected]>
>> Cc: Stable<[email protected]>
>> ---
>>
>> Index: linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_set.c
>> ===================================================================
>> --- linux-2.6.orig/drivers/staging/rtl8712/rtl871x_ioctl_set.c
>> +++ linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_set.c
>> @@ -68,7 +68,10 @@ static u8 do_join(struct _adapter *padap
>> pmlmepriv->fw_state |= _FW_UNDER_LINKING;
>> pmlmepriv->pscanned = plist;
>> pmlmepriv->to_join = true;
>> - if (_queue_empty(queue) == true) {
>> +
>> + /* adhoc mode will start with an empty queue, but skip checking */
>> + if (!check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)&&
>> + _queue_empty(queue)) {
>> if (pmlmepriv->fw_state& _FW_UNDER_LINKING)
>> pmlmepriv->fw_state ^= _FW_UNDER_LINKING;
>> /* when set_ssid/set_bssid for do_join(), but scanning queue
>
> Thanks for CC'ing me.
>
> This patch doesn't solve my problem[1], unfortunately. I am using
> iwconfig(8) to setup things, and it is still impossible to set the ESSID
> and the power saving mode. In my case it was even possible to get into
> Ad-hoc mode without the patch and without ever beeing associated.
>
> [1] https://bugzilla.kernel.org/show_bug.cgi?id=33352

Does this one help? It should be in addition to the previous patch.

Larry


Attachments:
r8712u_set_essid (845.00 B)

2011-04-28 18:06:03

by Jeff Chua

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

On Thu, Apr 28, 2011 at 11:31 PM, Larry Finger
<[email protected]> wrote:
> On 04/28/2011 10:08 AM, clemens fischer wrote:
>> This patch doesn't solve my problem[1], unfortunately. ?I am using
>> iwconfig(8) to setup things, and it is still impossible to set the ESSID
>> and the power saving mode. ?In my case it was even possible to get into
>> Ad-hoc mode without the patch and without ever beeing associated.

iwconfig doesn't work by itself to set adhoc mode (I haven't figure
why either). You can get into "adhoc mode", but you won't see
ESSID:XXXX.

Can you please try "wpa_supplicant" instead?


Jeff

2011-04-28 20:15:35

by clemens fischer

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

> Jeff Chua:

> iwconfig doesn't work by itself to set adhoc mode (I haven't figure
> why either). You can get into "adhoc mode", but you won't see
> ESSID:XXXX.
>
> Can you please try "wpa_supplicant" instead?

Well, I never figured out how to configure adhoc-mode using
"wpa_supplicant", could you please send a minimal working config entry?


regards, clemens fischer

2011-04-28 20:54:56

by clemens fischer

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

> Larry Finger:

> On 04/28/2011 10:08 AM, clemens fischer wrote:
>
> >[1] https://bugzilla.kernel.org/show_bug.cgi?id=33352
>
> Does this one help? It should be in addition to the previous patch.

So far it doesn't, but I'm having trouble with (wpa_supplicant &&
adhoc-mode). With "iwconfig", it doesn't help.

> Index: linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> ===================================================================
> --- linux-2.6.orig/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> +++ linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> @@ -990,8 +990,6 @@ static int r8711_wx_set_wap(struct net_d
> struct wlan_network *pnetwork = NULL;
> enum NDIS_802_11_AUTHENTICATION_MODE authmode;
>
> - if (padapter->bup == false)
> - return -1;
> if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
> return -1;
> if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true)
> @@ -1182,8 +1180,6 @@ static int r8711_wx_set_essid(struct net
> struct list_head *phead;
> u32 len;
>
> - if (padapter->bup == false)
> - return -1;
> if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
> return -1;
> if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))


regards, clemens

2011-04-29 00:36:50

by Jeff Chua

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

On Fri, Apr 29, 2011 at 4:15 AM, clemens fischer
<[email protected]> wrote:
>> Jeff Chua:
>
>> iwconfig doesn't work by itself to set adhoc mode (I haven't figure
>> why either). You can get into "adhoc mode", but you won't see
>> ESSID:XXXX.
>>
>> Can you please try "wpa_supplicant" instead?
>
> Well, I never figured out how to configure adhoc-mode using
> "wpa_supplicant", could you please send a minimal working config entry?

Clemens,

Try this. This is my working config.


# /etc/wpa1.conf
ap_scan=2 # 0 does not work. 1 is ok. 2 is fast.

network={
auth_alg=SHARED
mode=1 # ad-hoc
group=WEP104
ssid="yourSSID"
wep_key0=1234567890ABCDEF123456678
wep_tx_keyidx=0
key_mgmt=NONE
priority=0
scan_ssid=0
frequency=2412
}


# modprobe r8712u
# iwconfig <- you should be able to see 'wlan0' or 'wlan1' if
you've more than 1 wireless
# ifconfig wlan0 up
# wpa_supplicant -i wlan0 -c /etc/wpa1.conf


That should work.

Jeff

2011-04-29 21:15:57

by clemens fischer

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

> Jeff Chua:

> Try this. This is my working config.
>
> # /etc/wpa1.conf
> ap_scan=2 # 0 does not work. 1 is ok. 2 is fast.
>
> network={
> auth_alg=SHARED
> mode=1 # ad-hoc
> group=WEP104
> ssid="yourSSID"
> wep_key0=1234567890ABCDEF123456678
> wep_tx_keyidx=0
> key_mgmt=NONE
> priority=0
> scan_ssid=0
> frequency=2412
> }
>
> # modprobe r8712u
> # iwconfig <- you should be able to see 'wlan0' or 'wlan1' if
> you've more than 1 wireless
> # ifconfig wlan0 up
> # wpa_supplicant -i wlan0 -c /etc/wpa1.conf

Sorry, no dice here. But before you start weeping, it doesn't seem to
be a problem with the driver.

0 3 # iwconfig wlan0
wlan0 IEEE 802.11bgn ESSID:"manamana" Nickname:"rtl_wifi"
Mode:Ad-Hoc Frequency:2.412 GHz Cell: 02:11:87:68:0D:A4
Bit Rate:150 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=100/100 Signal level=58/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

0 4 # wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
CTRL-EVENT-DISCONNECTED bssid=00:00:00:00:00:00 reason=0
Trying to associate with SSID 'manamana'
CTRL-EVENT-DISCONNECTED bssid=00:00:00:00:00:00 reason=0
Associated with 02:11:87:68:0d:a4
CTRL-EVENT-CONNECTED - Connection to 02:11:87:68:0d:a4 completed (auth) [id=0 id_str=]
Associated with 02:11:87:68:0d:a4
CTRL-EVENT-CONNECTED - Connection to 02:11:87:68:0d:a4 completed (reauth) [id=0 id_str=]

I cannot find out what it is: "dnsmasq(8)" even gives out a lease, the
firewall doesn't block any packets etc. Note that "wpa_supplicant(8)"
could set the ESSID while "iwconfig(8)" couldn't. I think it has to do
with my mobile, a window$-mobile-6.1 device, because I cannot see the
typical log entries:

client provides name: wince
vendor class: Microsoft Windows CE
DHCPREQUEST(wlan0) 192.168.3.2 ...
DHCPACK(wlan0) 192.168.3.2 ...
requested options: 1:netmask, ...

The old driver "r8192s_usb" that could be configured with "iwconfig(8)"
made these settings:

0 3 # iwconfig wlan0
wlan0 802.11b/g link ESSID:"mana"
Mode:Ad-Hoc Frequency=2.412 GHz Cell: 12:7D:42:55:8D:38
Bit Rate=54 Mb/s
Retry min limit:7 RTS thr:off Fragment thr:off
Encryption key:7370-6F74-74 Security mode:restricted
Power Management period:5s mode:All packets received
Link Quality=0/100 Signal level=0 dBm Noise level=0 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

Here's a cut out from my setup script:

wlan_settings="${wlan_settings} essid ${station_id}"
wlan_settings="${wlan_settings} mode Ad-Hoc"
wlan_settings="${wlan_settings} channel 5"
wlan_settings="${wlan_settings} power 5s all"
wlan_settings="${wlan_settings} key restricted ${wlan_passkey}"

To match the "iwconfig(8)" output from the working setup better, I put
this line into "/etc/modprobe.d/modprobe.conf":

options r8712u ht_enable=0

and got this, using "wpa_supplicant(8)":

0 3 # iwconfig wlan0
wlan0 IEEE 802.11bg ESSID:"mana" Nickname:"rtl_wifi"
Mode:Ad-Hoc Frequency:2.412 GHz Cell: 02:11:87:DB:EC:D7
Bit Rate:54 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=100/100 Signal level=96/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

Note the lower "Bit Rate", but this didn't make things better. BTW,
documentation of the "r8712u" module parameters would be nice.

wifi_test:int vrtl_carrier_sense:int
video_mode:int vcs_type:int
chip_version:int busy_thresh:int
rfintfs:int ht_enable:int
lbkmode:int cbw40_enable:int
hci:int ampdu_enable:int
network_mode:int rf_config:int
channel:int power_mgnt:int
mp_mode:int low_power:int
wmm_enable:int
ifname: Net interface name, wlan%d=default (string)
initmac:MAC-Address, default: use FUSE (charp)

I mean, the names can be got from "modinfo(8)", but then people must
read driver sources, which is not exactly user-friendly.

All in all, I think "r8712u" is getting better and I would love to use
it, if only because "r8192s_usb" leaks memory
(CONFIG_ARCH_WANT_FRAME_POINTERS debug/kmemleak).


regards, clemens

2011-04-29 21:52:27

by Jeff Chua

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

On Sat, Apr 30, 2011 at 5:15 AM, clemens fischer
<[email protected]> wrote:

> I cannot find out what it is: ?"dnsmasq(8)" even gives out a lease, the
> firewall doesn't block any packets etc. ?Note that "wpa_supplicant(8)"
> could set the ESSID while "iwconfig(8)" couldn't. ?I think it has to do
> with my mobile, a window$-mobile-6.1 device, because I cannot see the
> typical log entries:
>
> ?client provides name: wince
> ?vendor class: Microsoft Windows CE
> ?DHCPREQUEST(wlan0) 192.168.3.2 ...
> ?DHCPACK(wlan0) 192.168.3.2 ...
> ?requested options: 1:netmask, ...

It looks like dhcpd has given you an IP. That's good. Can you try to
ping your mobile from your server. Does ping return anything?

# ping 192.168.3.2


Jeff

2011-04-29 22:25:54

by clemens fischer

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

> Jeff Chua:

> On Sat, Apr 30, 2011 at 5:15 AM, clemens fischer
> <[email protected]> wrote:
>
> > I cannot find out what it is: ?"dnsmasq(8)" even gives out a lease, the
> > firewall doesn't block any packets etc. ?Note that "wpa_supplicant(8)"
> > could set the ESSID while "iwconfig(8)" couldn't. ?I think it has to do
> > with my mobile, a window$-mobile-6.1 device, because I cannot see the
> > typical log entries:
> >
> > ?client provides name: wince
> > ?vendor class: Microsoft Windows CE
> > ?DHCPREQUEST(wlan0) 192.168.3.2 ...
> > ?DHCPACK(wlan0) 192.168.3.2 ...
> > ?requested options: 1:netmask, ...
>
> It looks like dhcpd has given you an IP. That's good. Can you try to
> ping your mobile from your server. Does ping return anything?
>
> # ping 192.168.3.2

You misunderstood: The log entries shown were from the configuration
using the old driver whereas "r8712u" has only DHCP offers in the logs
but no ACKs. But since you asked, "ping(8)" returns:

From 192.168.3.1 icmp_seq=8 Destination Host Unreachable

192.168.3.1 is the IP of the wlan0 interface of the linux host acting
as the router/DNS-resolver/DHCP-provider.


regards, clemens

2011-04-29 22:36:33

by Jeff Chua

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

On Sat, Apr 30, 2011 at 6:25 AM, clemens fischer
<[email protected]> wrote:
> whereas "r8712u" has only DHCP offers in the logs but no ACKs.

Are you saying you're seeing dhcpd being offered in the log? Please
post the log from the time your mobile starts up the r8712u.

Thanks,
Jeff

2011-04-30 00:36:12

by clemens fischer

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

> Larry Finger:

> On 04/28/2011 10:08 AM, clemens fischer wrote:
> >>Larry Finger:
> >
> >>From: Jeff Chua<[email protected]>
> >>
> >>Driver r8712u is unable to handle ad-hoc mode. The issue is that when
> >>the driver first starts, there will not be an SSID for association.
> >>The fix is to always call the "select and join from scan" routine when
> >>in ad-hoc mode.
> >>
> >>Note: Ad-hoc mode worked intermittently before. If the driver had
> >>previously been associated, then things were OK.
> >>
> >>Signed-off-by: Jeff Chua<[email protected]>
> >>Signed-off-by: Larry Finger<[email protected]>
> >>Cc: Stable<[email protected]>
> >>---
> >>
> >>Index: linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_set.c
> >>===================================================================
> >>--- linux-2.6.orig/drivers/staging/rtl8712/rtl871x_ioctl_set.c
> >>+++ linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_set.c
> >>@@ -68,7 +68,10 @@ static u8 do_join(struct _adapter *padap
> >> pmlmepriv->fw_state |= _FW_UNDER_LINKING;
> >> pmlmepriv->pscanned = plist;
> >> pmlmepriv->to_join = true;
> >>- if (_queue_empty(queue) == true) {
> >>+
> >>+ /* adhoc mode will start with an empty queue, but skip checking */
> >>+ if (!check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)&&
> >>+ _queue_empty(queue)) {
> >> if (pmlmepriv->fw_state& _FW_UNDER_LINKING)
> >> pmlmepriv->fw_state ^= _FW_UNDER_LINKING;
> >> /* when set_ssid/set_bssid for do_join(), but scanning queue
> >
> >Thanks for CC'ing me.
> >
> >This patch doesn't solve my problem[1], unfortunately. I am using
> >iwconfig(8) to setup things, and it is still impossible to set the ESSID
> >and the power saving mode. In my case it was even possible to get into
> >Ad-hoc mode without the patch and without ever beeing associated.
> >
> >[1] https://bugzilla.kernel.org/show_bug.cgi?id=33352
>
> Does this one help? It should be in addition to the previous patch.
>
> Larry

> Index: linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> ===================================================================
> --- linux-2.6.orig/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> +++ linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> @@ -990,8 +990,6 @@ static int r8711_wx_set_wap(struct net_d
> struct wlan_network *pnetwork = NULL;
> enum NDIS_802_11_AUTHENTICATION_MODE authmode;
>
> - if (padapter->bup == false)
> - return -1;
> if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
> return -1;
> if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true)
> @@ -1182,8 +1180,6 @@ static int r8711_wx_set_essid(struct net
> struct list_head *phead;
> u32 len;
>
> - if (padapter->bup == false)
> - return -1;
> if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
> return -1;
> if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))

BTW, which version is this patch against? I applied both of them to the
one tagged "v2.6.38.4", and they applied with a negative offset of about
-5 lines.

Should I rather use [1]?

[1] git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git


regards, clemens

2011-04-30 01:42:04

by clemens fischer

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

> Jeff Chua:

> On Sat, Apr 30, 2011 at 6:25 AM, clemens fischer
> <[email protected]> wrote:
> > whereas "r8712u" has only DHCP offers in the logs but no ACKs.
>
> Are you saying you're seeing dhcpd being offered in the log? Please
> post the log from the time your mobile starts up the r8712u.

Presently I cannot reproduce this peculiar situation. The win-CE device
provides next to nothing regarding helpful logs, but I know that it said
"connected" at various occasions without any link being active. Also,
it seems DHCP leases are not verified, instead the remaining lease time
being taken for granted.

The only thing I can present are the following link-level messages from
an unsuccessful attempt using "r8712u" (sorry for the overlong lines):

2011-04-30_03:18:07 + exec /command/chpst -v -m 11333000 /usr/sbin/tcpdump -v -e -n -l -t -i wlan0 -Z nobody -s 512
2011-04-30_03:18:07 tcpdump: listening on wlan0, link-type EN10MB (Ethernet), capture size 512 bytes
2011-04-30_03:18:07 00:22:43:4e:2a:82 > ff:ff:ff:ff:ff:ff, 802.3, length 126: LLC, dsap RS511 (0x4e) Group, ssap Unknown (0x8c) Command, ctrl 0x1b: Unnumbered, 0b, Flags [Poll], length 112
2011-04-30_03:18:07 00:22:43:4e:2a:82 > ff:ff:ff:ff:ff:ff, 802.3, length 58: LLC, dsap Unknown (0x52) Individual, ssap Unknown (0xfc) Command, ctrl 0x0059: Supervisory, Reject, rcv seq 0, Flags [Command], length 44
2011-04-30_03:18:08 00:22:43:4e:2a:82 > 33:33:00:01:00:03, 802.3, length 101: LLC, dsap Unknown (0x5a) Group, ssap Unknown (0xee) Response, ctrl 0x2f: Unnumbered, 2f, Flags [Response], length 87
2011-04-30_03:18:08 00:22:43:4e:2a:82 > 33:33:00:00:00:02, 802.3, length 102: LLC, dsap Unknown (0x60) Group, ssap Unknown (0xf6) Response, ctrl 0x002d: Supervisory, ?, rcv seq 0, Flags [Response], length 88
2011-04-30_03:18:08 00:22:43:4e:2a:82 > ff:ff:ff:ff:ff:ff, 802.3, length 58: LLC, dsap Unknown (0x62) Individual, ssap Unknown (0x16) Command, ctrl 0xeb: Unnumbered, eb, Flags [Command], length 44
2011-04-30_03:18:09 00:22:43:4e:2a:82 > 33:33:00:01:00:03, 802.3, length 101: LLC, dsap Unknown (0x6a) Group, ssap Unknown (0x16) Response, ctrl 0x007a: Information, send seq 61, rcv seq 0, Flags [Response], length 87
2011-04-30_03:18:09 00:22:43:4e:2a:82 > 33:33:ff:4e:2a:82, 802.3, length 102: LLC, dsap Unknown (0x78) Individual, ssap Unknown (0xe4) Response, ctrl 0x0099: Supervisory, Reject, rcv seq 0, Flags [Response], length 88
2011-04-30_03:18:10 00:22:43:4e:2a:82 > 33:33:00:00:00:02, 802.3, length 86: LLC, dsap Unknown (0x88) Individual, ssap Unknown (0x18) Command, ctrl 0x0036: Information, send seq 27, rcv seq 0, Flags [Command], length 72
2011-04-30_03:18:11 00:22:43:4e:2a:82 > 33:33:00:01:00:03, 802.3, length 101: LLC, dsap Unknown (0x8a) Individual, ssap Unknown (0xc0) Command, ctrl 0x0060: Information, send seq 48, rcv seq 0, Flags [Command], length 87
2011-04-30_03:18:12 00:22:43:4e:2a:82 > 33:33:00:01:00:03, 802.3, length 102: LLC, dsap Unknown (0xa0) Group, ssap Unknown (0x80) Command, ctrl 0x004a: Information, send seq 37, rcv seq 0, Flags [Command], length 88
2011-04-30_03:18:15 00:22:43:4e:2a:82 > 33:33:00:00:00:02, 802.3, length 86: LLC, dsap Unknown (0xc6) Group, ssap RS511 (0x4e) Response, ctrl 0xd3: Unnumbered, c3, Flags [Final], length 72
2011-04-30_03:18:16 00:22:43:4e:2a:82 > 33:33:00:01:00:03, 802.3, length 102: LLC, dsap Unknown (0xd6) Individual, ssap Unknown (0x8c) Response, ctrl 0x43: Unnumbered, disc, Flags [Response], length 88
2011-04-30_03:18:21 00:22:43:4e:2a:82 > ff:ff:ff:ff:ff:ff, 802.3, length 358: LLC, dsap Unknown (0x2c) Individual, ssap Unknown (0x74) Response, ctrl 0xe3: Unnumbered, test, Flags [Response], length 344
2011-04-30_03:18:22 00:22:43:4e:2a:82 > ff:ff:ff:ff:ff:ff, 802.3, length 358: LLC, dsap Unknown (0x3a) Group, ssap Unknown (0x84) Response, ctrl 0x009e: Information, send seq 79, rcv seq 0, Flags [Response], length 344
2011-04-30_03:18:25 00:22:43:4e:2a:82 > ff:ff:ff:ff:ff:ff, 802.3, length 358: LLC, dsap Unknown (0x62) Group, ssap Null (0x00) Command, ctrl 0xcf: Unnumbered, cf, Flags [Command], length 344
2011-04-30_03:18:29 00:22:43:4e:2a:82 > ff:ff:ff:ff:ff:ff, 802.3, length 358: LLC, dsap Unknown (0x9e) Group, ssap Unknown (0x3a) Response, ctrl 0x0038: Information, send seq 28, rcv seq 0, Flags [Response], length 344
2011-04-30_03:18:56 00:22:43:4e:2a:82 > ff:ff:ff:ff:ff:ff, 802.3, length 108: LLC, dsap Unknown (0x38) Group, ssap Unknown (0xba) Response, ctrl 0x0052: Information, send seq 41, rcv seq 0, Flags [Response], length 94
2011-04-30_03:18:56 00:22:43:4e:2a:82 > 33:33:00:01:00:03, 802.3, length 106: LLC, dsap Unknown (0x3a) Individual, ssap Unknown (0x26) Response, ctrl 0x0068: Information, send seq 52, rcv seq 0, Flags [Response], length 92
2011-04-30_03:18:56 00:22:43:4e:2a:82 > ff:ff:ff:ff:ff:ff, 802.3, length 108: LLC, dsap Unknown (0x3c) Group, ssap Unknown (0x28) Command, ctrl 0x002d: Supervisory, ?, rcv seq 0, Flags [Command], length 94
2011-04-30_03:18:56 00:22:43:4e:2a:82 > 33:33:00:01:00:03, 802.3, length 109: LLC, dsap Unknown (0x3c) Group, ssap Unknown (0x3c) Command, ctrl 0x00d2: Information, send seq 105, rcv seq 0, Flags [Command], length 95
2011-04-30_03:18:57 00:22:43:4e:2a:82 > ff:ff:ff:ff:ff:ff, 802.3, length 108: LLC, dsap Unknown (0x48) Individual, ssap Unknown (0xf2) Command, ctrl 0x23: Unnumbered, 23, Flags [Command], length 94
2011-04-30_03:18:57 00:22:43:4e:2a:82 > 33:33:00:01:00:03, 802.3, length 106: LLC, dsap Unknown (0x48) Group, ssap Unknown (0x5c) Response, ctrl 0xd3: Unnumbered, c3, Flags [Final], length 92
2011-04-30_03:18:57 00:22:43:4e:2a:82 > ff:ff:ff:ff:ff:ff, 802.3, length 108: LLC, dsap Unknown (0x4c) Individual, ssap Unknown (0x46) Command, ctrl 0xc3: Unnumbered, c3, Flags [Command], length 94
2011-04-30_03:18:57 00:22:43:4e:2a:82 > 33:33:00:01:00:03, 802.3, length 109: LLC, dsap Unknown (0x4c) Individual, ssap Unknown (0x50) Command, ctrl 0x0015: Supervisory, Receiver not Ready, rcv seq 0, Flags [Command], length 95
2011-04-30_03:18:58 00:22:43:4e:2a:82 > ff:ff:ff:ff:ff:ff, 802.3, length 108: LLC, dsap Unknown (0x5c) Individual, ssap Unknown (0xda) Response, ctrl 0x00a1: Supervisory, Receiver Ready, rcv seq 0, Flags [Response], length 94
2011-04-30_03:18:58 00:22:43:4e:2a:82 > 33:33:00:01:00:03, 802.3, length 111: LLC, dsap Unknown (0x5c) Individual, ssap Unknown (0xee) Command, ctrl 0x00ad: Supervisory, ?, rcv seq 0, Flags [Command], length 97
2011-04-30_03:18:59 00:22:43:4e:2a:82 > ff:ff:ff:ff:ff:ff, 802.3, length 108: LLC, dsap Unknown (0x6c) Individual, ssap IP (0x06) Response, ctrl 0x03: Unnumbered, ui, Flags [Response], length 94
2011-04-30_03:18:59 00:22:43:4e:2a:82 > 33:33:00:01:00:03, 802.3, length 111: LLC, dsap Unknown (0x6c) Individual, ssap Unknown (0x10) Command, ctrl 0x0081: Supervisory, Receiver Ready, rcv seq 0, Flags [Command], length 97


regards, clemens

2011-04-30 05:05:07

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

On 04/29/2011 07:36 PM, clemens fischer wrote:
>> Larry Finger:
>
>> On 04/28/2011 10:08 AM, clemens fischer wrote:
>>>> Larry Finger:
>>>
>>>> From: Jeff Chua<[email protected]>
>>>>
>>>> Driver r8712u is unable to handle ad-hoc mode. The issue is that when
>>>> the driver first starts, there will not be an SSID for association.
>>>> The fix is to always call the "select and join from scan" routine when
>>>> in ad-hoc mode.
>>>>
>>>> Note: Ad-hoc mode worked intermittently before. If the driver had
>>>> previously been associated, then things were OK.
>>>>
>>>> Signed-off-by: Jeff Chua<[email protected]>
>>>> Signed-off-by: Larry Finger<[email protected]>
>>>> Cc: Stable<[email protected]>
>>>> ---
>>>>
>>>> Index: linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_set.c
>>>> ===================================================================
>>>> --- linux-2.6.orig/drivers/staging/rtl8712/rtl871x_ioctl_set.c
>>>> +++ linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_set.c
>>>> @@ -68,7 +68,10 @@ static u8 do_join(struct _adapter *padap
>>>> pmlmepriv->fw_state |= _FW_UNDER_LINKING;
>>>> pmlmepriv->pscanned = plist;
>>>> pmlmepriv->to_join = true;
>>>> - if (_queue_empty(queue) == true) {
>>>> +
>>>> + /* adhoc mode will start with an empty queue, but skip checking */
>>>> + if (!check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)&&
>>>> + _queue_empty(queue)) {
>>>> if (pmlmepriv->fw_state& _FW_UNDER_LINKING)
>>>> pmlmepriv->fw_state ^= _FW_UNDER_LINKING;
>>>> /* when set_ssid/set_bssid for do_join(), but scanning queue
>>>
>>> Thanks for CC'ing me.
>>>
>>> This patch doesn't solve my problem[1], unfortunately. I am using
>>> iwconfig(8) to setup things, and it is still impossible to set the ESSID
>>> and the power saving mode. In my case it was even possible to get into
>>> Ad-hoc mode without the patch and without ever beeing associated.
>>>
>>> [1] https://bugzilla.kernel.org/show_bug.cgi?id=33352
>>
>> Does this one help? It should be in addition to the previous patch.
>>
>> Larry
>
>> Index: linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
>> ===================================================================
>> --- linux-2.6.orig/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
>> +++ linux-2.6/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
>> @@ -990,8 +990,6 @@ static int r8711_wx_set_wap(struct net_d
>> struct wlan_network *pnetwork = NULL;
>> enum NDIS_802_11_AUTHENTICATION_MODE authmode;
>>
>> - if (padapter->bup == false)
>> - return -1;
>> if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
>> return -1;
>> if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true)
>> @@ -1182,8 +1180,6 @@ static int r8711_wx_set_essid(struct net
>> struct list_head *phead;
>> u32 len;
>>
>> - if (padapter->bup == false)
>> - return -1;
>> if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
>> return -1;
>> if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
>
> BTW, which version is this patch against? I applied both of them to the
> one tagged "v2.6.38.4", and they applied with a negative offset of about
> -5 lines.
>
> Should I rather use [1]?
>
> [1] git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

My patches are against the mainline tree that you quote above; however, as long
as they apply, it won't matter. Offsets don;t really make much difference.

Larry

2011-04-30 12:21:21

by clemens fischer

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

> clemens fischer:

> > Jeff Chua:
>
> > On Sat, Apr 30, 2011 at 6:25 AM, clemens fischer
> > <[email protected]> wrote:
> > > whereas "r8712u" has only DHCP offers in the logs but no ACKs.
> >
> > Are you saying you're seeing dhcpd being offered in the log? Please
> > post the log from the time your mobile starts up the r8712u.
>
> Presently I cannot reproduce this peculiar situation. The win-CE
> device provides next to nothing regarding helpful logs, but I know
> that it said "connected" at various occasions without any link being
> active. Also, it seems DHCP leases are not verified, instead the
> remaining lease time being taken for granted.

Whatever I did late in the past night: sleeping ten hours helped a lot!

I can now confirm that "r8712u" works in Ad-hoc mode using
"wpa_supplicant(8)", it gets its IP from DHCP, connects everywhere and
lets me get spam and all that.

I have a couple of fancy scripts overseeing things, much less intrusive
than network-managers, but I disabled parts of them and did everything
manually.

In the end it may well have been the windows-mobile device hanging on to
its (dead) DHCP lease, but without that mobiles logs I won't know.

I still wish "r8712u" would let me use wireless-tools/iwconfig, but
I can live with "wpa_supplicant(8)".

Thanks for your effort, guys!


regards, clemens

2011-04-30 23:08:16

by Jeff Chua

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

On Sat, Apr 30, 2011 at 8:21 PM, clemens fischer
<[email protected]> wrote:
>> clemens fischer:
> Whatever I did late in the past night: sleeping ten hours helped a lot!
> I can now confirm that "r8712u" works in Ad-hoc mode using
> "wpa_supplicant(8)", it gets its IP from DHCP, connects everywhere and
> lets me get spam and all that.

Clemens,

Glad to head that!

> I still wish "r8712u" would let me use wireless-tools/iwconfig, but
> I can live with "wpa_supplicant(8)".

You wish just came true. To use plain iwconfig with wpa_supplicant,
here's what you need to do ...
just remember that the "order" is important ... you must set the
encryption key "before" you bring up the interface!!! This applies to
non-realtek devices as well.

# modprobe r8712u
# iwconfig wlan0 key restricted your-encrypted-password-same-as-wpa-psk-string
# ifconfig wlan0 up <-- this comes after you set up the encryption above!
# iwconfig wlan0 mode ad-hoc essid your-ssid
# ifconfig wlan0 your-ip
# dhcpd wlan0

Larry, thanks again for your help getting me started on this. The
device is working great!

Jeff

2011-05-01 16:40:23

by clemens fischer

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

> Jeff Chua:

> On Sat, Apr 30, 2011 at 8:21 PM, clemens fischer
>
> > I still wish "r8712u" would let me use wireless-tools/iwconfig, but
> > I can live with "wpa_supplicant(8)".
>
> You wish just came true. To use plain iwconfig with wpa_supplicant,
> here's what you need to do ...
> just remember that the "order" is important ... you must set the
> encryption key "before" you bring up the interface!!! This applies to
> non-realtek devices as well.
>
> # modprobe r8712u
> # iwconfig wlan0 key restricted your-encrypted-password-same-as-wpa-psk-string
> # ifconfig wlan0 up <-- this comes after you set up the encryption above!
> # iwconfig wlan0 mode ad-hoc essid your-ssid
> # ifconfig wlan0 your-ip
> # dhcpd wlan0

Yet not all parameters can be set with "iwconfig(8)":

iwconfig wlan0 essid mana mode Ad-Hoc channel 5 power 5s all key restricted s:xyz12
udevd-work[3589]: '/root/bin/wlan-dev.sh' (stderr) 'Error for wireless
request "Set Power Management" (8B2C) :'
udevd-work[3589]: '/root/bin/wlan-dev.sh' (stderr) ' SET failed on
device wlan0 ; Operation not permitted.'

Iwconfig(8) lets me set the power saving mode and which type of packets
wake the device up. wpa_supplicant(8) has nothing like this, it manages
channels and WPE keys and does this well, but not power settings.

This was my reason for prefering iwconfig(8) in the first place after
realizing that this little USB WLAN stick cannot be used for WPE, only
for Ad-hoc with WPA.


regards, clemens

2011-05-01 17:21:14

by Jeff Chua

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

On Mon, May 2, 2011 at 12:40 AM, clemens fischer
<[email protected]> wrote:
>> Jeff Chua:

>> You wish just came true. To use plain iwconfig with wpa_supplicant,

That was my mistake. It should read "To use plain iwconfig _WITHOUT_
wpa_supplicant" ...

>> here's what you need to do ...
>> just remember that the "order" is important ... you must set the
>> encryption key "before" you bring up the interface!!! This applies to
>> non-realtek devices as well.


> This was my reason for prefering iwconfig(8) in the first place after
> realizing that this little USB WLAN stick cannot be used for WPE, only
> for Ad-hoc with WPA.

huh? WPE ... do you mean WEP?

Jeff

2011-05-01 19:55:54

by clemens fischer

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

> Jeff Chua:

> On Mon, May 2, 2011 at 12:40 AM, clemens fischer
>
> >> Jeff Chua:
>
> >> You wish just came true. To use plain iwconfig with wpa_supplicant,
>
> That was my mistake. It should read "To use plain iwconfig _WITHOUT_
> wpa_supplicant" ...

Ahh! Very good! Have to try it now... and it works indeed! This is
nice. I never tried all combinations in the order of applying sbin/ip
and sbin/iwconfig. Did you simply try or was the hint burried in the
sources somewhere?

To clarify things: I needed to make an access-point, but didn't want to
buy proper, ie. supported hardware at this time, so I settled for adhoc.
It works good enough, even if I have to monitor traffic from time to
time for breakins due to weak WEP security.

> >> here's what you need to do ...
> >> just remember that the "order" is important ... you must set the
> >> encryption key "before" you bring up the interface!!! This applies to
> >> non-realtek devices as well.
>
>
> > This was my reason for prefering iwconfig(8) in the first place after
> > realizing that this little USB WLAN stick cannot be used for WPE, only
> > for Ad-hoc with WPA.
>
> huh? WPE ... do you mean WEP?

Sorry. You're right. WPE is short for "Want Peppered Encheladas", of
course.

BTW, thanks for taking this topic all through with me, you are a big
help =8^)


regards, clemens

2011-05-02 05:08:26

by Jeff Chua

[permalink] [raw]
Subject: Re: [PATCH] staging: r8712u: Fix driver to support ad-hoc mode

On Mon, May 2, 2011 at 3:55 AM, clemens fischer
<[email protected]> wrote:
>> Jeff Chua:
>
>> On Mon, May 2, 2011 at 12:40 AM, clemens fischer
>>
>> >> Jeff Chua:
>>
>> >> You wish just came true. To use plain iwconfig with wpa_supplicant,
>>
>> That was my mistake. It should read "To use plain iwconfig _WITHOUT_
>> wpa_supplicant" ...
>
> Ahh! ?Very good! ?Have to try it now... and it works indeed! ?This is
> nice. ?I never tried all combinations in the order of applying sbin/ip
> and sbin/iwconfig. ?Did you simply try or was the hint burried in the
> sources somewhere?

On the intel 4965 and even newer iwlagn module, it's still works the
same ... meaning configuring the wep keys first before bringing up the
interface. There was bug 3 years in the intel 4965 module very similar
to this one. Back the, Thomas and Johannes were kind enough to help
tracing down the bug.

> To clarify things: ?I needed to make an access-point, but didn't want to
> buy proper, ie. supported hardware at this time, so I settled for adhoc.
> It works good enough, even if I have to monitor traffic from time to
> time for breakins due to weak WEP security.

Just be careful of the "tiny" usb stick. It's small, very small, so
the signal is also "weak" (30% weaker ... my guess only) compared to
the build-in wireless on my X220 notebook.

Jeff