OpenWrt Forum Archive

Topic: problems using recompiled hostapd on WRT1900ACS

The content of this topic has been archived on 8 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
I'm trying to use a recompiled version of hostapd (v2.5, downloaded from the website and cross compiled) with a very minor patch (commenting out a single line that causes all wireless devices to disconnect on configuration changes).

I installed my cross compiled version of hostapd on the router and it was missing some dependencies (such as librt) but I solved that and got hostapd to run. I copied my new hostapd binary to the /usr/sbin folder under a new name and changed the symlink between hostapd and wpad to point to my new hostapd. (I'm also not sure what this wpad is, that might be related to the issue I'm having)

How when I try to run hostapd with the same configuration file as before I get the following lines:

root@OpenWrt:~# /usr/sbin/hostapd -P /var/run/wifi-phy0.pid -B /var/run/hostapd-phy0.conf 
Configuration file: /var/run/hostapd-phy0.conf
Line 12: unknown configuration item 'ieee80211n'
Line 13: unknown configuration item 'ht_coex'
Line 14: unknown configuration item 'ht_capab'
Line 15: unknown configuration item 'vht_oper_chwidth'
Line 16: unknown configuration item 'vht_oper_centr_freq_seg0_idx'
Line 17: unknown configuration item 'ieee80211ac'
Line 18: unknown configuration item 'vht_capab'
7 errors found in configuration file '/var/run/hostapd-phy0.conf'
Failed to set up interface with /var/run/hostapd-phy0.conf
Failed to initialize interface

The lines that were in the code that correspond to those errors are:

ieee80211n=1
ht_coex=0
ht_capab=[HT40+][LDPC][SHORT-GI-20][SHORT-GI-40]
vht_oper_chwidth=1
vht_oper_centr_freq_seg0_idx=42
ieee80211ac=1
vht_capab=[RXLDPC][SHORT-GI-80][SU-BEAMFORMER][SU-BEAMFORMEE][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTER

I decided to try to comment out these lines because I couldn't figure out why they were giving me errors and I tried to run hostapd again and got these errors:

root@OpenWrt:~# /usr/sbin/hostapd -P /var/run/wifi-phy0.pid -B /var/run/hostapd-phy0.conf 
Configuration file: /var/run/hostapd-phy0.conf
rfkill: Cannot open RFKILL control device
Could not read interface wlan0 flags: No such device
nl80211: Driver does not support authentication/association or connect commands
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Could not read interface wlan0 flags: No such device
nl80211 driver initialization failed.
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED 
hostapd_free_hapd_data: Interface wlan0 wasn't started

Does anyone understand what I did wrong?
Also if anyone has a different way to get the same result I want that could also be an interesting work around...

Thanks
Niv

You either fix the scripts which setup hostapd to not add stuff hostapd knows nothing about or you add your patch on top to of the invasive openwrt ones.

Also you seem to not have enabled all you need in your hostapd build (n/ac support).

Hi Niv,
Have you found the solution to the problems? I hit into similar problems when trying to recompile hostapd since I need a certain feature called disable_dgaf there. Thanks!

Regards,
Rahmadi

I have found the answer to this problem:

1) Basically I rebuilt the hostapd package by downloading the source code from OpenWrt GitHub.
https://github.com/openwrt/openwrt/
I took the Chaos Calmer branch.

2) Then I just followed the instructions to build just one package from here:
https://wiki.openwrt.org/doc/howtobuild/single.package

3) Then I made sure that all the dependencies are followed for hostapd. Please refer to the Makefile:
https://github.com/openwrt/openwrt/blob … d/Makefile
PKG_CONFIG_DEPENDS:= \
    CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
    CONFIG_PACKAGE_kmod-ath9k \
    CONFIG_PACKAGE_kmod-cfg80211 \
    CONFIG_PACKAGE_hostapd \
    CONFIG_PACKAGE_hostapd-mini \
    CONFIG_PACKAGE_kmod-hostap \
    CONFIG_WPA_RFKILL_SUPPORT \
    CONFIG_DRIVER_WEXT_SUPPORT \
    CONFIG_DRIVER_11N_SUPPORT

Make sure that all of these are enabled in "make menuconfig" or just edit ".config" file directly.
Basically after all the setup we type: "make package/hostapd/compile". And we'll get the required .ipk.

The discussion might have continued from here.