hostapd problem.

Hello.
I'm trying to setup wireless AP using ral under FreeBSD7.2.
Here is my configuration:
Code:
[root@razumit ~]#cat /etc/hostapd.conf
interface=ral0
driver=bsd
logger_syslog=3
logger_syslog_level=3
logger_stdout=3
logger_stdout_level=3
debug=3
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ssid=freebsdAP
macaddr_acl=0
auth_algs=3
eapol_key_index_workaround=0
own_ip_addr=192.168.0.1
wpa=1
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK WPA-EAP
wpa_pairwise=TKIP CCMP
[root@razumit ~]#ifconfig ral0 list caps
ral0=2181e500<IBSS,HOSTAP,TXPMGT,SHSLOT,SHPREAMBLE,MONITOR,WPA1,WPA2,BGSCAN>
[root@razumit ~]#ifconfig ral0
ral0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
        ether 00:21:91:82:30:57
        inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255
        media: IEEE 802.11 Wireless Ethernet autoselect <hostap> (autoselect <hostap>)
        status: associated
        ssid freebsdAP channel 11 (2462 Mhz 11g) bssid 00:21:91:82:30:57
        authmode WPA privacy MIXED deftxkey 2 TKIP 2:128-bit txpower 50
        scanvalid 60 bgscan bgscanintvl 300 bgscanidle 250 roam:rssi11g 7
        roam:rate11g 5 protmode CTS dtimperiod 1

When I'm trying to connect from station, its ask for pass, and report no answer from AP.
tcpdump -iral0 with various options show nothing, hmm.
Perhaps I'm missing something obvious, but I can't get it.
 
Do you also have in /etc/rc.conf:
Code:
hostapd_enable="YES"

And have hostapd running?

# /etc/rc.d/hostapd start
 
Sure.
I've tried to debug it with hostapd -ddd /etc/hostapd.conf.
But got nothing.
 
Are all the needed wlan modules loaded?

Post the output of kldstat. Also what's in /etc/rc.conf regarding the network interface?
 
SirDice said:
Are all the needed wlan modules loaded?

Post the output of kldstat. Also what's in /etc/rc.conf regarding the network interface?
I guess so. It complained about wlan_xuath, until I've compiled it to kernel.
Code:
[root@razumit ~]#kldstat -v | grep wlan
                332 wlan_scan_sta
                331 wlan_scan_ap
                330 wlan
                329 wlan_wep
                328 wlan_tkip
                327 wlan_ccmp
                326 wlan_amrr
                333 wlan_xauth
[root@razumit ~]#grep ifc /etc/rc.conf
ifconfig_ral0="inet 192.168.0.1/24 ssid freebsdAP channel 11 mediaopt hostap"
[root@razumit ~]#ifconfig
vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=2808<VLAN_MTU,WOL_UCAST,WOL_MAGIC>
        ether 00:21:91:1f:c4:10
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
ral0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 2290
        ether 00:21:91:82:30:57
        inet 192.168.0.1 netmask 0xfffffff0 broadcast 192.168.0.15
        media: IEEE 802.11 Wireless Ethernet autoselect <hostap> (autoselect <hostap>)
        status: no carrier
        ssid freebsdAP channel 11 (2462 Mhz 11g)
        authmode AUTO privacy OFF deftxkey 2 txpower 50 scanvalid 60 bgscan
        bgscanintvl 300 bgscanidle 250 roam:rssi11g 7 roam:rate11g 5
        protmode CTS dtimperiod 1
plip0: flags=108810<POINTOPOINT,SIMPLEX,MULTICAST,NEEDSGIANT> metric 0 mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        inet 127.0.0.1 netmask 0xff000000
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1492
        inet 89.112.0.167 --> 81.9.101.110 netmask 0xffffffff
        Opened by PID 385
 
It was down by the moment I wrote the reply, but this is not the reason.
When I'm testing it is up, like in first ifconfig output.
 
Try running # hostapd -ddK /etc/hostapd.conf to see if the key it receives is correct.
 
Code:
[root@razumit ~]#hostapd -ddK /etc/hostapd.conf
Configuration file: /etc/hostapd.conf
ctrl_interface_group=0
bsd_set_iface_flags: dev_up=0
BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)
ral0: IEEE 802.11 Fetching hardware channel/rate support not supported.
Flushing old station entries
bsd_sta_deauth: addr=ff:ff:ff:ff:ff:ff reason_code=3
Deauthenticate all stations
bsd_set_privacy: enabled=0
bsd_del_key: addr=00:00:00:00:00:00 key_idx=0
bsd_del_key: addr=00:00:00:00:00:00 key_idx=1
bsd_del_key: addr=00:00:00:00:00:00 key_idx=2
bsd_del_key: addr=00:00:00:00:00:00 key_idx=3
bsd_get_ssid: ssid="freebsdAP"
Using interface ral0 with hwaddr 00:21:91:82:30:57 and ssid 'freebsdAP'
SSID - hexdump_ascii(len=9):
     66 72 65 65 62 73 64 41 50                        freebsdAP
PSK (ASCII passphrase) - hexdump_ascii(len=8):
     46 77 70 61 50 61 73 73                           password
PSK (from passphrase) - hexdump(len=32): 66 c8 8b 29 3d 26 fa d5 fe ed 97 6b 83 b1 f8 77 38 49 c0 13 cd b1 19 c2 77 d2 ef 1f 6d 64 e2 d1
bsd_set_ieee8021x: enabled=1
bsd_configure_wpa: group key cipher=TKIP (1)
bsd_configure_wpa: pairwise key ciphers=0xa
bsd_configure_wpa: key management algorithms=0x2
bsd_configure_wpa: rsn capabilities=0x0
bsd_configure_wpa: enable WPA= 0x1
bsd_set_iface_flags: dev_up=1
WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
GMK - hexdump(len=32): 81 86 05 8e 23 3e 70 c0 dd 89 e7 79 d1 4b 2a f5 9e 5d 38 3d 0d 68 d0 cc ad d9 53 89 af 9f 4a 41
GTK - hexdump(len=32): e3 5c fe d8 0d 3b 4b a4 6d f0 a7 9e f3 40 ea 47 38 e5 05 92 f4 6c 71 08 75 16 23 e7 94 4c 16 94
WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
bsd_set_key: alg=TKIP addr=00:00:00:00:00:00 key_idx=1
bsd_set_privacy: enabled=1
ral0: Setup of interface done.
This is all I get. Without option -K output the is same.
 
Leave the hostapd running with the -ddK switches then try to authenticate with a client. See what happens and where things might go wrong.
 
Following set give me absolutely nothing useful, while I try to connect, apart of posted above.
Code:
wlandebug -i ral0 debug
tcpdump -iral0 &
tcpdump -iral0 -y ieee802_11 &
tcpdump -iral0 -y ieee802_11_radio &
hostapd -dddK /etc/hostapd.conf &
I in perplexity how it can be?

This is log/messages for this time.
Code:
Nov  7 16:40:01 razumit ral0: [00:21:91:82:30:57] station with aid 0 leaves
Nov  7 16:40:01 razumit ral0: synchronized with 00:21:91:82:30:57 ssid "freebsdAP" channel 11 start 1Mb

richardpl said:
Try input/output flags with wlandebug(8), if it doesnt work you need to build custom kernel ...
What is it "custom kernel", could you clarify pls.
 
I got mine working with :
Code:
# This field is a bit field that can be used to enable WPA (IEEE 02.11i/D3.0)
# and/or WPA2 (full IEEE 802.11i/RSN):
# bit0 = WPA
# bit1 = IEEE 802.11i/RSN (WPA2) (dot11RSNAEnabled)
wpa=2
# Clients do not have to share the same PSK
wpa_psk_file=/etc/hostapd.wpa_psk
# Since TKIP now falls in matter of seconds, rely exclusively on CCMP.
wpa_pairwise=CCMP
ifconfig output should look like:
Code:
...
authmode WPA2/802.11i privacy MIXED deftxkey 3 AES-CCM 2:128-bit AES-CCM 3:128-bit
...
Cheers mates
 
Hi friends! I'm also have problem with hostapd (it doesn't start):
OS: 8.0-STABLE FreeBSD 8.0-STABLE #0: Sat Jan 30 03:45:34 YEKT 2010
Wi-fi card: D-Link DWA-510 (ral0 driver)
/etc/rc.conf
Code:
wlans_ral0="wlan0"
create_args_wlan0="wlanmode hostap"
ifconfig_wlan0="inet 172.16.253.1/24 ssid mywifi mode 11g country RU authmode wpa mediaopt hostap up"
hostapd_enable="YES"
hostapd_flags="-d -K"
/etc/hostapd.conf
Code:
interface=wlan0 
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel
ssid=mywifi
wpa=1
wpa_passphrase=xxxyyyzzz
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
ifconfig
Code:
ral0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
        ether 00:1b:11:c0:89:25
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <hostap>
        status: running
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:1b:11:c0:89:25
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <hostap>
        status: running
        ssid mywifi channel 1 (2412 Mhz 11g) bssid 00:1b:11:c0:89:25
        country US authmode OPEN privacy OFF txpower 0 scanvalid 60
        protmode CTS dtimperiod 1 -dfs
/etc/rc.d/hostapd restart
Code:
Starting hostapd.
Configuration file: /etc/hostapd.conf
ctrl_interface_group=0 (from group name 'wheel')
bsd_init: interface wlan0  does not existbsd driver initialization failed.
wlan0 : Unable to setup interface.
rmdir[ctrl_interface]: No such file or directory
/etc/rc.d/hostapd: WARNING: failed to start hostapd
KERNEL CONFIG
Code:
device          wlan            # 802.11 support
options         IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's
options         IEEE80211_SUPPORT_MESH  # enable 802.11s draft support
device          wlan_wep        # 802.11 WEP support
device          wlan_ccmp       # 802.11 CCMP support
device          wlan_tkip       # 802.11 TKIP support
device          wlan_amrr       # AMRR transmit rate control algorithm
device          ral             # Ralink Technology RT2500 wireless NICs.
device          ralfw
 
In /etc/rc.conf

Code:
...
create_args_wlan0="wlanmode hostap"
ifconfig_wlan0="inet 172.16.253.1/24 ssid mywifi mode 11g country RU authmode wpa mediaopt hostap up"
...

you may try this:

Code:
...
create_args_wlan0="wlanmode hostap ssid mywifi mode 11g country RU authmode wpa mediaopt hostap up"
ifconfig_wlan0="inet 172.16.253.1/24"
...

;) (See function childif_create() in /etc/network.subr!)

In my rc.conf I use bridging for wifi:

Code:
fconfig_fxp0_name="net0"
ipv4_addrs_net0="XX.XX.XX.XX/24"
...
autobridge_interfaces="bridge0"
autobridge_bridge0="wlan0 net0"

It`s work! :)
 
No, it is not helps me.. Now:
/etc/rc.conf
Code:
wlans_ral0="wlan0"
create_args_wlan0="wlanmode hostap ssid mywifi mode 11g country RU authmode wpa mediaopt hostap up"
ifconfig_wlan0="inet 172.16.253.1/24"
hostapd_enable="YES"
hostapd_flags="-dd -K"
and nothing changes.

If i setup wlan0 as ifconfig wlan0 authmode open wepkey 1234567890123 Client connects success... But i want wpa with hostap...
Is it can helps if i load wlan as module and remove it from kernel?
 
Hello,
I have the same problem as goshanecr.

Code:
[color="Silver"]nirn@arwen /u/h/nirn> uname -a[/color]
FreeBSD arwen 9.0-CURRENT FreeBSD 9.0-CURRENT #9: Mon Dec 27 08:37:12 UTC 2010     root@:/usr/obj/usr/src/sys/ARWEN  amd64
[color="silver"]nirn@arwen /u/h/nirn> dmesg |grep ath[/color]
ath0: <Atheros 9280> mem 0x90100000-0x9010ffff irq 21 at device 0.0 on pci4
ath0: AR9280 mac 128.2 RF5133 phy 13.0
[color="silver"]nirn@arwen /u/h/nirn> dmesg |grep wlan0[/color]
wlan0: Ethernet address: d8:5d:4c:d7:33:3e
[color="silver"]nirn@arwen /u/h/nirn> ifconfig[/color]
(skiped)
ath0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
        ether d8:5d:4c:d7:33:3e
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <hostap>
        status: running
enc0: flags=0<> metric 0 mtu 1536
pflog0: flags=0<> metric 0 mtu 33152
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether d8:5d:4c:d7:33:3e
        inet6 fe80::da5d:4cff:fed7:333e%wlan0 prefixlen 64 tentative scopeid 0xb
        inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <hostap>
        status: running
        ssid arwen channel 1 (2412 MHz 11g) bssid d8:5d:4c:d7:33:3e
        regdomain 32924 country CN indoor ecm authmode OPEN privacy OFF
        txpower 20 scanvalid 60 protmode CTS wme burst dtimperiod 1 -dfs
(skiped)
[color="silver"]nirn@arwen /u/h/nirn> cat /usr/src/sys/amd64/conf/ARWEN |grep wlan[/color]
device          wlan            # 802.11 support
device          wlan_wep        # 802.11 WEP support
device          wlan_ccmp       # 802.11 CCMP support
device          wlan_tkip       # 802.11 TKIP support
device          wlan_amrr       # AMRR transmit rate control algorithm
device          wlan_acl
device          wlan_xauth
device          wlan_rssadapt
[color="silver"]nirn@arwen /u/h/nirn> cat /etc/rc.conf[/color]
(...)
# NETWORK
# Disabled in current
#ipv6_enable="NO"
ipv6_activate_all_interfaces="NO"
hostname="arwen"
#ifconfig_re0="DHCP"
gateway_enable="YES"

# DHCPD
dhcpd_enable="YES"
dhcpd_flags="-q"
dhcpd_ifaces="wlan0"
dhcpd_withhumask="022"
dhcpd_chuser_enable="YES"
dhcpd_withuser="dhcpd"
dhcpd_withgroup="dhcpd"
dhcpd_chroot_enable="YES"
dhcpd_devfs_enable="YES"
dhcpd_rootdir="/var/db/dhcpd"

# WIFI
hostapd_enable="YES"
hostapd_flags="-ddd"
wlans_ath0="wlan0"
create_args_wlan0="wlanmode hostap ssid arwen country RU mode 11g channel 1 mediaopt hostap up"
ifconfig_wlan0="inet 192.168.1.1/24"

[color="silver"]nirn@arwen /u/h/nirn> cat /etc/hostapd.conf[/color]
interface=wlan0
#driver=bsd
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel
ssid=freebsdap
wpa=1
wpa_passphrase=freebsdmall
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP TKIP
With this config (without hostapd and wpa), wlan works ok.

Code:
[color="silver"]nirn@arwen /u/h/nirn> sudo /etc/rc.d/hostapd start[/color]
Starting hostapd.
Configuration file: /etc/hostapd.conf
ctrl_interface_group=0 (from group name 'wheel')
bsd_init: interface wlan0  does not existbsd driver initialization failed.
rmdir[ctrl_interface]: No such file or directory
/etc/rc.d/hostapd: WARNING: failed to start hostapd
I try to crate interface manually (ifconfig wlan...), but with same result.
No wlan0, no ath0 dev in /dev :)
Some strange:
Code:
nirn@arwen /u/h/nirn> sudo kldload wlan.ko
kldload: can't load wlan.ko: Exec format error
nirn@arwen /u/h/nirn> sudo kldload ata.ko
kldload: can't load ata.ko: Exec format error
nirn@arwen /u/h/nirn> sudo kldload if_msk.ko
nirn@arwen /u/h/nirn> dmesg
(...)
interface wlan.1 already present in the KLD 'kernel'!
linker_load_file: Unsupported file type
interface ata.1 already present in the KLD 'kernel'!
linker_load_file: Unsupported file type
E.g. if module already present in kernel, when try to load we have "unsupported type". What this?
 
Solution: delete all spaces (and, probably, quotes) before and after the name of the interface in hostapd.conf:
Code:
nirn@arwen 11:18 /u/h/nirn> cat /etc/hostapd.conf
interface=wlan0
(...)

Lyrics:
Hostapd read config, but no trim spaces (probably for read strings such "wpa_pairwise=CCMP TKIP"). bsd_init in
/usr/src/usr.sbin/wpa/hostapd/driver_freebsd.c try to get if_nametoindex(), if_nametoindex.c try str_cmp() and fail.

PR:
Need fix to read config functions in hostapd or in usr.sbin/wpa/hostapd/driver_freebsd.c
Code:
drv->ifindex = if_nametoindex([B]trim(drv->ifname)[/B]);
        if (drv->ifindex == 0) {
                printf("%s: interface %s does not exist[B] /n[/B]", __func__,
                       drv->ifname);
                goto bad;
        }

Also thanks to juick.com/gelraen for that read me ktrace(1) :)
 
Back
Top