Parsing new variables from wireless config

Struggling to understand how to pass a new arbitrary variable from /etc/config/wireless to the downstream setup processes.
If i add a new variable foo=bar under a wifi-device stanza such as:

config wifi-device 'radio0'
	option type 'mac80211'
	option channel '36'
	option hwmode '11a'
	...
	option foo 'bar'

I cannot figure out how to access this variable at somewhere downstream like mac80211_hostapd_setup_base.
It appears that this variable never gets loaded into config. Config is part of the json data coming into init_wireless_driver "$@" as far as i can work out, but it never contains my new variable.

I've read the interaction between ldir and jow here: https://openwrt.org/docs/techref/netifd
but my efforts to register additional variables have failed. I'm missing some understanding here. I can see that some variables get registered here, but what about the channel variable? It seems to just be innately declared.

Someone please steer me in the right direction lol.

Did you restart netifd after your changes and did you add config_add_{int,string,boolean} statements for the variables you want to add?

If wifi is not enough, then no.
What’s the fastest way to restart netifd safely in such a case?

/etc/init.d/network restart

Thanks, that was the trick.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.