setting bssid in adhoc mode

Paul B. Mahol onemda at gmail.com
Fri Sep 26 22:17:01 UTC 2008


On 9/26/08, Sam Leffler <sam at freebsd.org> wrote:
> Paul B. Mahol wrote:
>> On 9/26/08, John Hay <jhay at meraka.org.za> wrote:
>>
>>> On Thu, Sep 25, 2008 at 08:59:37PM +0200, Paul B. Mahol wrote:
>>>
>>>> On 9/25/08, John Hay <jhay at meraka.org.za> wrote:
>>>>
>>>>> On Thu, Sep 25, 2008 at 04:41:30PM +0200, Paul B. Mahol wrote:
>>>>>
>>>>>> On 9/22/08, John Hay <jhay at meraka.org.za> wrote:
>>>>>>
>>>>>>> Hi
>>>>>>>
>>>>>>> I'm trying out the new ath/wlan stuff in current. Should one still be
>>>>>>> able to set the bssid in adhoc mode? We normally lock the bssid in
>>>>>>> an adhoc network because of problems that the network split and does
>>>>>>> not merge, if you do not do it.
>>>>>>>
>>>>>>> What I have done is this:
>>>>>>>
>>>>>>> # ifconfig wlan0 create wlandev ath0 wlanmode adhoc
>>>>>>> # ifconfig wlan0 ssid ptamesh up
>>>>>>>
>>>>>>> Up to here works well. It will scan and if it finds another node with
>>>>>>> the
>>>>>>> same ssid, it will "lock" on that channel and use the correct bssid.
>>>>>>>
>>>>>>> If it does not find another node with the same ssid, it will start it
>>>>>>> own thing on channel 10. But it looks like one cannot set the bssid.
>>>>>>>
>>>>>>> # ifconfig wlan0 bssid 02:07:ca:fe:ba:be
>>>>>>> ifconfig: 02:07:ca:fe:ba:be: bad value
>>>>>>>
>>>>>> I had similar experience with STA mode, instead I use ap (ap is alias
>>>>>> for bssid, at least it works in STA mode)
>>>>>> I never bothered is this bug in manual page, ifconfig or in something
>>>>>> else
>>>>>> ...
>>>>>>
>>>>> Ah, thanks yes, "ifconfig wlan0 ap 02:07:ca:fe:ba:be" works just fine.
>>>>> Just do not try to unset it with "ifconfig wlan0 ap -". That is an
>>>>> alias for "panic now" :-)
>>>>>
>>>> Well, on my system it doesnt panic here.
>>>> So more info to debug "your" panic is required ...
>>>>
>>> I'll have to see if I can reproduce it.
>>>
>>
>> I managed to reproduce panic on recent CURRENT, with two cards in adhoc
>> mode.
>> rum0 (usb2) & ndis0 (personal hacked version without usb code)
>>
>> I typed "ifconfig wlan0 ap -"  several times.
>>
>>
>> bt:
>>
>> db:0:kdb.enter.unknown>  run lockinfo
>> db:1:lockinfo> show locks
>> db:1:locks>  show alllocks
>> Process 1471 (ifconfig) thread 0xc4028690 (100048)
>> Process 477 (syslogd) thread 0xc402b8c0 (100058)
>> db:1:alllocks>  show lockedvnods
>> Locked vnodes
>> db:0:kdb.enter.unknown>  show pcpu
>> cpuid        = 1
>> curthread    = 0xc4028690: pid 1471 "ifconfig"
>> curpcb       = 0xe64e1d90
>> fpcurthread  = none
>> idlethread   = 0xc3cb1d20: pid 10 "idle: cpu1"
>> APIC ID      = 1
>> currentldt   = 0x50
>> spin locks held:
>> db:0:kdb.enter.unknown>  bt
>> Tracing pid 1471 tid 100048 td 0xc4028690
>> ieee80211_ht_adjust_channel(c46a8000,0,2,2,80000002,...) at
>> ieee80211_ht_adjust_channel+0x30
>> adhoc_pick_bss(c4053000,c4113800,c0a1ebc3,23a,c3dd0108,...) at
>> adhoc_pick_bss+0x100
>> ieee80211_check_scan(c4113800,2,7fffffff,0,0,...) at
>> ieee80211_check_scan+0x20d
>> ieee80211_check_scan_current(c4113800,4,c0a1fb47,6c,c4113800,...) at
>> ieee80211_check_scan_current+0x45
>> adhoc_newstate(c4113800,1,0,648,e64e1aa0,...) at adhoc_newstate+0x219
>> ieee80211_new_state_locked(c4113800,0,c0a1e64c,49c,0,...) at
>> ieee80211_new_state_locked+0xc4
>> ieee80211_init(c4113800,c0a24a64,6,c41adc00,1b9,...) at
>> ieee80211_init+0x45
>> ieee80211_ioctl_set80211(c3e1ec00,801c69ea,c48c4240,c0709084,c4028690,...)
>> at ieee80211_ioctl_set80211+0xe5
>> in_control(c4158188,801c69ea,c48c4240,c3e1ec00,c4028690,...) at
>> in_control+0xdc4
>> ifioctl(c4158188,801c69ea,c48c4240,c4028690,801c69ea,...) at ifioctl+0x34a
>> soo_ioctl(c43c9d90,801c69ea,c48c4240,c41adc00,c4028690,...) at
>> soo_ioctl+0x397
>> kern_ioctl(c4028690,3,801c69ea,c48c4240,504110,...) at kern_ioctl+0x1dd
>> ioctl(c4028690,e64e1cf8,c,c06d3f58,c0702bf0,...) at ioctl+0x134
>> syscall(e64e1d38) at syscall+0x283
>> Xint0x80_syscall() at Xint0x80_syscall+0x20
>> --- syscall (54, FreeBSD ELF32, ioctl), eip = 0x281a9a43, esp =
>> 0xbfbfe48c, ebp = 0xbfbfe4d8 ---
>>
>> here is panic message:
>>
>> Fatal trap 12: page fault while in kernel mode
>> cpuid = 1; apic id = 01
>> fault virtual address   = 0x0
>> fault code              = supervisor read, page not present
>> instruction pointer     = 0x20:0xc0a0c5b0
>> stack pointer           = 0x28:0xe64e1980
>> frame pointer           = 0x28:0xe64e1990
>> code segment            = base 0x0, limit 0xfffff, type 0x1b
>>                         = DPL 0, pres 1, def32 1, gran 1
>> processor eflags        = interrupt enabled, resume, IOPL = 0
>> current process         = 1471 (ifconfig)
>> exclusive sleep mutex ndis0_com_lock (ndis0_com_lock) r = 1
>> (0xc46a8014) locked @
>> /usr/src/sys/modules/wlan/../../net80211/ieee80211_scan.c:570
>> exclusive sleep mutex ndis0_com_lock (ndis0_com_lock) r = 1
>> (0xc46a8014) locked @
>> /usr/src/sys/modules/wlan/../../net80211/ieee80211_scan.c:570
>> exclusive lockmgr bufwait (bufwait) r = 0 (0xd7d083c0) locked @
>> /usr/src/sys/kern/vfs_bio.c:2443
>> exclusive lockmgr ufs (ufs) r = 0 (0xc41a2058) locked @
>> /usr/src/sys/kern/vfs_vnops.c:593
>>
>> 0xc41a2000: tag ufs, type VREG
>>     usecount 1, writecount 1, refcount 4 mountedhere 0
>>     flags ()
>>     v_object 0xc413aaa8 ref 0 pages 7
>>      lock type ufs: EXCL by thread 0xc402b8c0 (pid 477)
>>
>>         ino 164881, on dev ad4s1d
>>
> Looks like adhoc_pick_channel returned NULL which was unexpected.  Don't
> have a quick fix but it's possible no channel may be selected so the
> code is wrong.  I rarely touch adhoc mode so this stuff is lightly tested.

On further investigation it appears to be locking problem - I was not
able to reproduce panic with kern.smp.disabled=1


More information about the freebsd-mobile mailing list