OpenWrt Forum Archive

Topic: Custom hostapd configuration

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

I'm trying to add additional option in hostapd config file, but if i add them in /etc/config/wireless as
option key 'value'
some of my custom config are not present in /var/run/hostapd-phy0.conf (i think uci is missing some hostapd flag and so they are not added in genersted hostapd config file)

Is there a way to add custom flags in /etc/config/wireless (like option 'extra' 'value')?
Or at least pass a custom config file to hostapd instead of the uci generated one?

The script /lib/netifd/hostapd.sh generates hostapd.conf.  You would need to extend that script to parse your new parameter.  hostapd.sh is distributed in the hostapd-common package.

I think you can modify hostapd.conf then send a signal 1 to hostapd to make it load the new configuration, but that would be more suitable for testing than production.

(Last edited by mk24 on 9 Sep 2017, 13:33)

Hi,

I'm also trying to include a new option to /etc/config/wireless so it is finally present in /var/run/hostapd-phy0.conf. I have been travelling through the code and this is what I have seen:

- Netifd is is charge of listening network events and manage network interfaces upon these events.
- When netifd starts, it registers some scripts as handlers. The handler that is called when an event related to a wifi network interface rises is /lib/netifd/mac80211.sh.
- /lib/netifd/mac80211.sh uses functions from /lib/netifd/hostapd.sh and /lib/netifd/netifd-wireless.sh to generate the hostapd config file.
- When netifd  calls to /lib/netifd/mac80211.sh, it passes a json config as an argument. I think that hostapd config is derived from this json config, however I can't see the new options I add to /etc/config/wireless in this json config.

Please, could anyone explain how all these scripts interact among them and with netfid? Who is in charge of parsing the /etc/config/wireless file? How the json config that is passed to /lib/netifd/mac80211.sh as an argument is derived?

Thanks in advance for your help.

The discussion might have continued from here.