Page 1 of 1

hostapd

Posted: Sat Jun 04, 2016 9:44 am
by snorez123
Hi Guys,

i have a problem with hostapd, i installed using this guide

http://en.tacticalcode.de/2013/03/use-y ... or-ap.html
I choose bridge mode

after i reboot the pi and i execute the command " hostapd -dd /etc/hostapd/hostapd.conf "
I get the following output, in particular

Code: Select all

nl80211: Failed to set interface 3 to mode 3: -16 (Device or resource busy)

Code: Select all

Configuration file: /etc/hostapd/hostapd.conf
Line 40: DEPRECATED: 'dump_file' configuration variable is not used anymore
ctrl_interface_group=0
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:10
nl80211: Supported cipher 00-0f-ac:8
nl80211: Supported cipher 00-0f-ac:9
nl80211: Supported cipher 00-0f-ac:6
nl80211: Supported cipher 00-0f-ac:13
nl80211: Supported cipher 00-0f-ac:11
nl80211: Supported cipher 00-0f-ac:12
nl80211: Using driver-based off-channel TX
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 3 iftype 3 (AP)
nl80211: Failed to set interface 3 to mode 3: -16 (Device or resource busy)
nl80211: Try mode change after setting interface down
nl80211: Set mode ifindex 3 iftype 3 (AP)
nl80211: Mode change succeeded while interface is down
nl80211: Setup AP(wlan0) - device_ap_sme=0 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x7ffc1810
nl80211: Register frame type=0xb0 (WLAN_FC_STYPE_AUTH) nl_handle=0x7ffc1810 match=
nl80211: Register frame type=0x0 (WLAN_FC_STYPE_ASSOC_REQ) nl_handle=0x7ffc1810 match=
nl80211: Register frame type=0x20 (WLAN_FC_STYPE_REASSOC_REQ) nl_handle=0x7ffc1810 match=
nl80211: Register frame type=0xa0 (WLAN_FC_STYPE_DISASSOC) nl_handle=0x7ffc1810 match=
nl80211: Register frame type=0xc0 (WLAN_FC_STYPE_DEAUTH) nl_handle=0x7ffc1810 match=
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x7ffc1810 match=
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x7ffc1810 match=
nl80211: Add own interface ifindex 3
nl80211: if_indices[16]: 3
Could not add bridge br0 : Invalid argument
nl80211: Failed to add the bridge interface br0 : Invalid argument
nl80211: Remove monitor interface: refcount=0
nl80211: Remove beacon (ifindex=3)
netlink: Operstate: ifindex=3 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 3 iftype 2 (STATION)
nl80211: Failed to set interface 3 to mode 2: -16 (Device or resource busy)
nl80211: Try mode change after setting interface down
nl80211: Set mode ifindex 3 iftype 2 (STATION)
nl80211: Mode change succeeded while interface is down
nl80211: Teardown AP(wlan0) - device_ap_sme=0 use_monitor=0
nl80211: Unsubscribe mgmt frames handle 0xf7749099 (AP teardown)
nl80211 driver initialization failed.
hostapd_interface_deinit_free(0x7ffbe9f0)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0x7ffbe9f0)
hostapd_bss_deinit: deinit bss wlan0
hostapd_cleanup(hapd=0x7ffc0d60 (wlan0))
hostapd_free_hapd_data: Interface wlan0 wasn't started
hostapd_interface_deinit_free: driver=(nil) drv_priv=(nil) -> hapd_deinit
hostapd_interface_free(0x7ffbe9f0)
hostapd_interface_free: free hapd 0x7ffc0d60
hostapd_cleanup_iface(0x7ffbe9f0)
hostapd_cleanup_iface_partial(0x7ffbe9f0)
hostapd_cleanup_iface: free iface=0x7ffbe9f0
root@raspberrypi:/etc/network# nano /etc/hostapd/hostapd.conf
root@raspberrypi:/etc/network# sudo service hostapd restart
root@raspberrypi:/etc/network# hostapd -dd /etc/hostapd/hostapd.conf
random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
ctrl_interface_group=0
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:10
nl80211: Supported cipher 00-0f-ac:8
nl80211: Supported cipher 00-0f-ac:9
nl80211: Supported cipher 00-0f-ac:6
nl80211: Supported cipher 00-0f-ac:13
nl80211: Supported cipher 00-0f-ac:11
nl80211: Supported cipher 00-0f-ac:12
nl80211: Using driver-based off-channel TX
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 3 iftype 3 (AP)
nl80211: Failed to set interface 3 to mode 3: -16 (Device or resource busy)
nl80211: Try mode change after setting interface down
nl80211: Set mode ifindex 3 iftype 3 (AP)
nl80211: Mode change succeeded while interface is down
nl80211: Setup AP(wlan0) - device_ap_sme=0 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x8022e810
nl80211: Register frame type=0xb0 (WLAN_FC_STYPE_AUTH) nl_handle=0x8022e810 match=
nl80211: Register frame type=0x0 (WLAN_FC_STYPE_ASSOC_REQ) nl_handle=0x8022e810 match=
nl80211: Register frame type=0x20 (WLAN_FC_STYPE_REASSOC_REQ) nl_handle=0x8022e810 match=
nl80211: Register frame type=0xa0 (WLAN_FC_STYPE_DISASSOC) nl_handle=0x8022e810 match=
nl80211: Register frame type=0xc0 (WLAN_FC_STYPE_DEAUTH) nl_handle=0x8022e810 match=
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x8022e810 match=
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x8022e810 match=
nl80211: Add own interface ifindex 3
nl80211: if_indices[16]: 3
Could not add bridge br0 : Invalid argument
nl80211: Failed to add the bridge interface br0 : Invalid argument
nl80211: Remove monitor interface: refcount=0
nl80211: Remove beacon (ifindex=3)
netlink: Operstate: ifindex=3 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 3 iftype 2 (STATION)
nl80211: Failed to set interface 3 to mode 2: -16 (Device or resource busy)
nl80211: Try mode change after setting interface down
nl80211: Set mode ifindex 3 iftype 2 (STATION)
nl80211: Mode change succeeded while interface is down
nl80211: Teardown AP(wlan0) - device_ap_sme=0 use_monitor=0
nl80211: Unsubscribe mgmt frames handle 0x8aa6099 (AP teardown)
nl80211 driver initialization failed.
hostapd_interface_deinit_free(0x8022b9f0)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0x8022b9f0)
hostapd_bss_deinit: deinit bss wlan0
hostapd_cleanup(hapd=0x8022dd60 (wlan0))
hostapd_free_hapd_data: Interface wlan0 wasn't started
hostapd_interface_deinit_free: driver=(nil) drv_priv=(nil) -> hapd_deinit
hostapd_interface_free(0x8022b9f0)
hostapd_interface_free: free hapd 0x8022dd60
hostapd_cleanup_iface(0x8022b9f0)
hostapd_cleanup_iface_partial(0x8022b9f0)
hostapd_cleanup_iface: free iface=0x8022b9f0
This is my config

Code: Select all

# Only for bridges, place a # before the next line for AP mode!
bridge=br0
# Interface and Driver
interface=wlan0
driver=nl80211
# WLAN-Settings
ssid=HomeNet
channel=6
# ESSID visible
ignore_broadcast_ssid=0
# Country-specific settings
country_code=IT
ieee80211d=1
# Transfer Mode
hw_mode=g
# Optional
# supported_rates=10 20 55 110 60 90 120 180 240 360 480 540
# uncomment the following to enable 802.11 Draft n
# ieee80211n=1
# Enable WMM for Draft-N
# wmm_enabled=1
# Use iw list to see which ht capabilities your wifi card has
# ht_capab=[HT40+][SHORT-GI-40][DSSS_CCK-40]
# Beacons
beacon_int=100
dtim_period=2
# Don't use MAC auth
macaddr_acl=0
# Max Clients
max_num_sta=20
# Limit size of Datapackets
rts_threshold=2347
fragm_threshold=2346
# hostapd Log settings
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
# temp files
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
# Authentification
auth_algs=3
# Encryption: WPA2 !!Don't use WEP!
wpa=2
rsn_preauth=1
rsn_preauth_interfaces=wlan0
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
# Key scheduling
wpa_group_rekey=600
wpa_ptk_rekey=600
wpa_gmk_rekey=86400
# Change this, it's the network's key
wpa_passphrase=MYPass

Code: Select all

root@raspberrypi:/etc/network# iw list
Wiphy phy0
        max # scan SSIDs: 4
        max scan IEs length: 2285 bytes
        Retry short limit: 7
        Retry long limit: 4
        Coverage class: 0 (up to 0m)
        Device supports RSN-IBSS.
        Supported Ciphers:
                * WEP40 (00-0f-ac:1)
                * WEP104 (00-0f-ac:5)
                * TKIP (00-0f-ac:2)
                * CCMP (00-0f-ac:4)
                * 00-0f-ac:10
                * GCMP (00-0f-ac:8)
                * 00-0f-ac:9
                * CMAC (00-0f-ac:6)
                * 00-0f-ac:13
                * 00-0f-ac:11
                * 00-0f-ac:12
        Available Antennas: TX 0 RX 0
        Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor
                 * mesh point
        Band 1:
                Bitrates (non-HT):
                        * 1.0 Mbps
                        * 2.0 Mbps (short preamble supported)
                        * 5.5 Mbps (short preamble supported)
                        * 11.0 Mbps (short preamble supported)
                        * 6.0 Mbps
                        * 9.0 Mbps
                        * 12.0 Mbps
                        * 18.0 Mbps
                        * 24.0 Mbps
                        * 36.0 Mbps
                        * 48.0 Mbps
                        * 54.0 Mbps
                Frequencies:
                        * 2412 MHz [1] (20.0 dBm)
                        * 2417 MHz [2] (20.0 dBm)
                        * 2422 MHz [3] (20.0 dBm)
                        * 2427 MHz [4] (20.0 dBm)
                        * 2432 MHz [5] (20.0 dBm)
                        * 2437 MHz [6] (20.0 dBm)
                        * 2442 MHz [7] (20.0 dBm)
                        * 2447 MHz [8] (20.0 dBm)
                        * 2452 MHz [9] (20.0 dBm)
                        * 2457 MHz [10] (20.0 dBm)
                        * 2462 MHz [11] (20.0 dBm)
                        * 2467 MHz [12] (20.0 dBm)
                        * 2472 MHz [13] (20.0 dBm)
                        * 2484 MHz [14] (disabled)
        Supported commands:
                 * new_interface
                 * set_interface
                 * new_key
                 * start_ap
                 * new_station
                 * new_mpath
                 * set_mesh_config
                 * set_bss
                 * authenticate
                 * associate
                 * deauthenticate
                 * disassociate
                 * join_ibss
                 * join_mesh
                 * set_tx_bitrate_mask
                 * frame
                 * frame_wait_cancel
                 * set_wiphy_netns
                 * set_channel
                 * set_wds_peer
                 * probe_client
                 * set_noack_map
                 * register_beacons
                 * start_p2p_device
                 * set_mcast_rate
                 * Unknown command (104)
                 * connect
                 * disconnect
        Supported TX frame types:
                 * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
        Supported RX frame types:
                 * IBSS: 0x40 0xb0 0xc0 0xd0
                 * managed: 0x40 0xd0
                 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * mesh point: 0xb0 0xc0 0xd0
                 * P2P-client: 0x40 0xd0
                 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * P2P-device: 0x40 0xd0
        software interface modes (can always be added):
                 * AP/VLAN
                 * monitor
        interface combinations are not supported
        HT Capability overrides:
                 * MCS: ff ff ff ff ff ff ff ff ff ff
                 * maximum A-MSDU length
                 * supported channel width
                 * short GI for 40 MHz
                 * max A-MPDU length exponent
                 * min MPDU start spacing
        Device supports TX status socket option.
        Device supports HT-IBSS.
        Device supports SAE with AUTHENTICATE command
        Device supports low priority scan.
        Device supports scan flush.
        Device supports AP scan.
        Device supports per-vif TX power setting
        Driver supports a userspace MPM

Code: Select all

root@raspberrypi:~# ifconfig
br0       Link encap:Ethernet  HWaddr b8:27:eb:9b:7a:37
          inet addr:192.168.1.64  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::ba27:ebff:fe9b:7a37/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10438 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7544 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1733751 (1.6 MiB)  TX bytes:2375448 (2.2 MiB)

eth0      Link encap:Ethernet  HWaddr b8:27:eb:9b:7a:37
          inet addr:169.254.130.126  Bcast:169.254.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10441 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7799 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1733889 (1.6 MiB)  TX bytes:2522199 (2.4 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:412 errors:0 dropped:0 overruns:0 frame:0
          TX packets:412 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:139880 (136.6 KiB)  TX bytes:139880 (136.6 KiB)

wlan0     Link encap:Ethernet  HWaddr 00:1d:0f:b3:7b:d7
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000

Code: Select all

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual


#WLAN Interface

allow-hotplug wlan0
iface wlan0 inet manual

# Bridge
        auto br0
        iface br0 inet manual
        bridge_ports eth0 wlan0
        bridge_fd 0
        bridge_stp no

Does someone can help me to fix the problem?
Thanks in advice

Re: hostapd

Posted: Tue Jun 07, 2016 8:30 pm
by epoch1970
I think your issue is rather here: "Could not add bridge br0 : Invalid argument"

AFAIK, "inet manual" in /etc/network/interfaces is now hijacked by dhcpcd.
Look at the interfaces conf in this post. The AP worked (finally) and we're using "static" with no further configuration for eth0 and wlan0. (which is silly I know, but hey...)