Hostapd / wpa_supplicant settings for passive scanning ( passive_scan=1 )


I'm trying to configure my STA to only use passive scanning ( ie, not send probe requests on all channels )

I'm using:

  • hostapd_wpad_full ( hostapd-2018-05-21-62566bc2 )
  • AR71xx platform.
  • openWrt 18.06 ( OpenWrt SNAPSHOT, r7843-0578993 )

There is a setting "passive_scan=1" that can be added to wpa_suplicant.conf that sets this behaviour for a specific SSID, ( from this description of wpa_supplicant.conf : )

I've managed to get this parameter added to the wpa_supplicant-wlan0.conf file created by hostapd ( by adding it in /lib/netifd/ )

but the log states " unknown network field 'passive_scan' " and the wpa supplicant fails to start up ,
a snippet of logread:

  daemon.notice netifd: radio0 (2123): Successfully initialized wpa_supplicant
  daemon.notice netifd: radio0 (2123): Line 4: unknown network field 'passive_scan'.
  daemon.notice netifd: radio0 (2123): Line 9: failed to parse network block.
  daemon.notice netifd: radio0 (2123): Failed to read or parse configuration '/var/run/wpa_supplicant-wlan0.conf'.
  daemon.notice netifd: radio0 (2123): cat: can't open '/var/run/': No such file or directory
  daemon.notice netifd: radio0 (2123): WARNING (wireless_add_process): executable path /usr/sbin/wpad does not match process path (/proc/exe)
  daemon.notice netifd: radio0 (2123): Command failed: Invalid argument
  daemon.notice netifd: radio0 (2123): Interface 0 setup failed: WPA_SUPPLICANT_FAILED

is there another way of getting a STA to not send any probe requests, or some way I should be setting "passive_scan", it looks like the version of wpa_supplicant in 18.06 supports the feature (* its in the changelog in the source ) but it isn't working for some reason.

do I need to add this parameter using "config_add_... " somewhere for wpa_supplicant to recognize the parameter ?

I see alot of these throughout hostapd.conf

You'll need to edit the file that creates the config from the UCI to add "new" UCI fields, likely /lib/net/wireless/

Hi Jeff,
Thank you for the pointer,

I've added config_add_boolean passive_scan to/lib/netifd/wireless/ right below where the "noscan" parameter is added ( in drv_mac80211_init_device_config() ), but the same error persists,

is there a way for me to check whether the new parameter has been added so that wpa_supplicant can understands it / expects it ? ( similar to how kernel module parameters are shown in /sys/module/xxx/parameters ) ?

You can check the generated config in /var/run/ to see if your script changes generate the expected config for wpa_supplicant. I don't know that wpa_supplicant will log anything is a config parameter is "correct". I would hope it would log something at a high enough level if a config parameter is "wrong".

Adding set -x and set +x at the appropriate places in the netifd scripts has helped me debug them in the past. The output should appear in the logs when the scripts get run by netifd ("challenging" to run them by hand, as they don't have the context that netifd creates).

Logging from the hostapd family of applications is limited to higher severity at compile time. As I understand it, this is to significantly reduce the size of the application. The config parameter to adjust this is, from my git logs, CONFIG_WPA_MSG_MIN_PRIORITY

It seems I can only pass it as a parameter when using "iw scan", it isn't recognized by wpa_supplicant when put in a network block of the config file and seems to be ignored or overridden by " scan_ssid=1" in the network field of each SSID when placed above it in the general filed ( but no errors are logged ... )

the "man page" for wpa_supplicant

I managed to disable (active) probes for my specific devices by patching the hostapd driver ( this was the inspiration ) by setting it so that all scans are passive in my application, at least until i have a better grasp of netifd, hostapd and wpa_supplicant as they are used in OpenWRT.