# hostapd problem



## xwwu (Feb 1, 2012)

Dear friends:

If hostapd is enabled in /etc/rc.conf, when booting, system will say 
	
	



```
panic: page fault
```
 Why? If no hostapd is enabled, wireless AP will be useless.

Thanks your help


----------



## SirDice (Feb 1, 2012)

Page faults are never a good sign. What exactly is the panic? They usually (but not always) indicate some sort of hardware failure.


----------



## xwwu (Feb 1, 2012)

Maybe hostapd touched off hardware problem somewhere.


----------



## gnoma (Feb 1, 2012)

Well, I use wireless without hostapd. You need hostapd just for wireless encryption.  Can you tell what happens when you just put in rc.conf:


```
ifconfig_wlan0=ifconfig xx.xx.xx.xx netmask xx.xx.xx.xx ssid myNWname mediaopt hostap
```
Do you get the same problem? The wi-fi will be opened and with no encryption. If you get the same problem, may be it's driver or HW problem, but if you don't get the error.. Well just test it 

Thank you.

And can you give the wi-fi card model.  Use *pciconf -lv* to get it.


----------



## xwwu (Feb 1, 2012)

Thanks for your reply.


```
pciconf -lv
    device     = 'RTL8111/8168B PCI Express Gigabit Ethernet controller'
    class      = network
    subclass   = ethernet
    class      = network
rt28600@pci0:2:0:0:     class=0x028000 card=0x27901814 chip=0x07811814 rev=0x00 hdr=0x00
    vendor     = 'Ralink corp.'
    device     = 'RT2860'
    class      = network
```

and part of rc.conf

```
wlans_rt28600="wlan0"
create_args_wlan0="wlanmode hostap"
Ifconfig_wlan0="inet 192.168.1.1  netmask 255.255.255.0 ssid xxxxxxxxxxx mode 11g channel 7"
```

according to handbook.


----------



## gnoma (Feb 1, 2012)

Okay, I am using wi-fi card with the same chip. Mine is Linksys wmp600N. I use it without hostapd. It is on FreeBSD 7, and I have no problems with it.



> ```
> #create_args_wlan0="wlanmode hostap"
> ```



I wanted to say to turn this ON, wlanmode/mediaopt=hostap should be ON, but just don't start the hostapd daemon. This way you will have AP, "wlanmode hostap" will be ON, but you will have no encryption and authentication on the wi-fi network. Please check if everything is working normal without hostapd daemon, just simple AP.


```
wlans_rt28600="wlan0"
create_args_wlan0="wlanmode hostap"
Ifconfig_wlan0="inet 192.168.1.1  netmask 255.255.255.0 ssid xxxxxxxxxxx mode 11g channel 7"
[b]#hostapd_enable="YES"[/b]
```


----------



## xwwu (Feb 1, 2012)

AP works properly. but I just worry about the security.


----------



## gnoma (Feb 1, 2012)

Okay, this is useful info. If without encryption the system boots normally, load the driver and setup the interface in AP mode. My first suggestion would be that the problem is in the hostapd or the interface driver, not hardware. Would you be so kind to post the configuration of hostapd? And also if you are able to retrieve the dmesg from an unsuccessful boot that will be useful.

Thank you.


----------



## xwwu (Feb 2, 2012)

gnoma said:
			
		

> Okay, this is useful info. If without encryption the system boots normally, load the driver and setup the interface in AP mode. My first suggestion would be that the problem is in the hostapd or the interface driver, not hardware. Would you be so kind to post the configuration of hostapd? And also if you are able to retrieve the dmesg from an unsuccessful boot that will be useful.
> 
> Thank you.



*M*any thanks!

I don't know how to copy and past the error message. *T*he hostapd.conf is:


```
interface=wlan0
debug=1
ctrl_interface=/var/run/hostapad
ctrl_interface_group=wheel
ssid=concordfamily
wpa=2
wpa_passphrase=xxxxxxxxxxxxxx
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP TKIP
```


----------



## gnoma (Feb 2, 2012)

Hmm, I am sorry dude, but I don't see nothing wrong so far. It is really interesting for me if it is a bug or known problem, because I use a wi-fi card with the same chip and driver. I need to request some downtime to recreate the same situation, so I can see what's going wrong, but it will not happen the next 3 days.


----------



## xwwu (Feb 2, 2012)

gnoma said:
			
		

> Hmm, I am sorry dude, but I don't see nothing wrong so far. It is really interesting for me if it is a bug or known problem, because I use a wi-fi card with the same chip and driver. I need to request some downtime to recreate the same situation, so I can see what's going wrong, but it will not happen the next 3 days.



Thank, would you please enable hostapd in your router also?


----------



## valery-savchuk (Apr 14, 2012)

Hi!

I have got the same problem.

My USB wifi stick is:

```
kernel: uhub4: 8 ports with 8 removable, self powered
kernel: Root mount waiting for: usbus4
kernel: ugen4.2: <Ralink> at usbus4
kernel: run0: <1.0> on usbus4
kernel: run0: MAC/BBP RT3071 (rev 0x021C), RF RT3022 (MIMO 2T2R), address f4:6d:04:b1:f1:20
kernel: Root mount waiting for: usbus4
kernel: run0: firmware RT3071 loaded
kernel: ugen3.2: <APC> at usbus3
kernel: wlan0: Ethernet address: f4:6d:04:b1:f1:20
```

My rc.conf is:

```
# wifi
wlans_run0="wlan0"
create_args_wlan0="wlanmode hostap ssid my_wifi authmode WPA"
ifconfig_wlan0="inet 192.168.3.1 netmask 255.255.255.0"

hostapd_enable="YES"
```


My hostapd.conf is:

```
interface=wlan0
debug=1
ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel
ssid=my_wifi
wpa=3
wpa_passphrase=MyPass1234
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
```

and only piece of useful info about panic is:

```
kernel boot file is /boot/kernel/kernel
Fatal trap 12: page fault while in kernel mode
cpuid = 1; apic id = 01
fault virtual address       = 0xffffff8000ab1a68
fault code          = supervisor read data, page not present
instruction pointer = 0x20:0xffffffff80532793
stack pointer               = 0x28:0xffffff8122d1bad0
frame pointer               = 0x28:0xffffff8122d1bb10
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             = 0 (run0 taskq)
trap number         = 12
panic: page fault
cpuid = 1
KDB: stack backtrace:
#0 0xffffffff806225de at kdb_backtrace+0x5e
#1 0xffffffff805f04d7 at panic+0x187
#2 0xffffffff80921ef0 at trap_fatal+0x290
#3 0xffffffff809222cf at trap_pfault+0x28f
#4 0xffffffff809227af at trap+0x3df
#5 0xffffffff8090a8a4 at calltrap+0x8
#6 0xffffffff805378f3 at run_ratectl_cb+0x73
#7 0xffffffff8062d665 at taskqueue_run_locked+0x85
#8 0xffffffff8062d7fe at taskqueue_thread_loop+0x4e
#9 0xffffffff805c6cc8 at fork_exit+0x118
#10 0xffffffff8090ad6e at fork_trampoline+0xe
Uptime: 1d9h11m24s
Cannot dump. Device not defined or unavailable.
Automatic reboot in 15 seconds - press a key on the console to abort
panic: bufwrite: buffer is not busy???
cpuid = 1
Copyright (c) 1992-2011 The FreeBSD Project.
FreeBSD 8.2-RELEASE #11: Wed Feb 15 21:38:13 MSK 2012
```


----------



## valery-savchuk (Apr 14, 2012)

Well, it is not the same problem, but it looks similar. In my case AP works well one hour, two hours, or ten, or twenty. But that panic thing just always happens.


----------



## PseudoCylon (Apr 15, 2012)

@valery-savchuk (for run(4))

That bug has been patched (kern/153938), but some how it didn't make it to stabel/8. Try patching by hand or upgrade to 9.0-RELEASE.


----------



## valery-savchuk (Apr 15, 2012)

Thanks for tip. I will try.


----------

