A new configurable parameter called CustomArguments (WiFi.DaemonMgt.Daemon.{}.ExecutionSettings.CustomArguments) is being introduced to allow defining a higher logging level and redirecting logs to syslog for the daemons (hostapd, wpa_supplicant) that are started by PWHM. The new log files will store the logs from these daemons as follows: hostapd logs will be available at: /var/log/hostapd wpa_supplicant logs will be available at: /var/log/wpa_supplicant

Updating PWHM cram test scripts and checking logfile for wpa_supplicant and hostapd

Closes: PPM-3522
Signed-off-by: Sajith Joseph <sajithjoseph@tataelxsi.co.in>
This commit is contained in:
Sajith Joseph 2026-01-30 11:55:31 +05:30 committed by Hela Saadani
parent b31b45a81a
commit afa518aa4c
5 changed files with 202 additions and 9 deletions

View File

@ -50,7 +50,7 @@ Check default SSID configuration of access points:
Check that no hostapd instance is running:
$ R "pgrep -f 'hostapd -ddt'"
$ R "pgrep -f 'hostapd'"
[1]
Test activation of access point 1:
@ -177,11 +177,11 @@ Check that hostapd is operating as expected:
$ R logger -t cram "Check that hostapd is operating"
$ R "ps axw" | sed -nE 's/.*(hostapd.*)/\1/p' | head -1 | tr -s ' ' '\n' | LC_ALL=C sort
-ddt
/tmp/wlan0_hapd.conf
/tmp/wlan1_hapd.conf
$ R "ps axw" | sed -nE 's/.*(hostapd .*)/\1/p' | head -1 | tr -s ' ' '\n' | LC_ALL=C sort
-g
-s
/tmp/wlan2_hapd.conf
/var/run/hostapd/global\.0x.* (re)
hostapd
$ R "ubus list | grep -e 'hostapd\.' | sort"
@ -211,6 +211,88 @@ Check iw interfaces and beaconing:
ssid prplOS-guest
ssid prplOS-guest
Test custom arguments
$ R "ba-cli 'Device.WiFi.EndPoint.*.Enable=1' | sed '1d' | awk 'NF'"
Device.WiFi.EndPoint.1.
Device.WiFi.EndPoint.1.Enable=1
Device.WiFi.EndPoint.2.
Device.WiFi.EndPoint.2.Enable=1
Device.WiFi.EndPoint.3.
Device.WiFi.EndPoint.3.Enable=1
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.hostapd.ExecutionSettings.CustomArguments=-dds' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.1.ExecutionSettings.":{"CustomArguments":"-dds"}}]
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.hostapd.ExecutionSettings.CustomArguments?' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.1.ExecutionSettings.":{"CustomArguments":"-dds"}}]
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.wpa_supplicant.ExecutionSettings.CustomArguments=-ds' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.2.ExecutionSettings.":{"CustomArguments":"-ds"}}]
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.wpa_supplicant.ExecutionSettings.CustomArguments?' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.2.ExecutionSettings.":{"CustomArguments":"-ds"}}]
$ sleep 10
$ R logger -t cram "Check that hostapd is operating"
$ R "ps axw" | sed -nE 's/.*(hostapd .*)/\1/p' | head -1 | tr -s ' ' '\n' | LC_ALL=C sort
-dds
-g
/tmp/wlan0_hapd.conf
/tmp/wlan1_hapd.conf
/tmp/wlan2_hapd.conf
/var/run/hostapd/global\.0x.* (re)
hostapd
$ R logger -t cram "Check that wpa_supplicant is operating"
$ R "ps axw" | sed -n '/[w]pa_supplicant/ { s/^.*\bwpa_supplicant[[:space:]]/wpa_supplicant /; p }' | sort | head -3
wpa_supplicant -ds -i wlan0 -Dnl80211 -c /tmp/wlan0_wpa_supplicant.conf
wpa_supplicant -ds -i wlan1 -Dnl80211 -c /tmp/wlan1_wpa_supplicant.conf
wpa_supplicant -ds -i wlan2 -Dnl80211 -c /tmp/wlan2_wpa_supplicant.conf
Setting the custom arguments back to default value:
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.hostapd.ExecutionSettings.CustomArguments="-s"' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.1.ExecutionSettings.":{"CustomArguments":"-s"}}]
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.hostapd.ExecutionSettings.CustomArguments?' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.1.ExecutionSettings.":{"CustomArguments":"-s"}}]
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.wpa_supplicant.ExecutionSettings.CustomArguments="-s"' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.2.ExecutionSettings.":{"CustomArguments":"-s"}}]
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.wpa_supplicant.ExecutionSettings.CustomArguments?' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.2.ExecutionSettings.":{"CustomArguments":"-s"}}]
$ sleep 10
$ R logger -t cram "Check that hostapd is operating"
$ R "ps axw" | sed -nE 's/.*(hostapd .*)/\1/p' | head -1 | tr -s ' ' '\n' | LC_ALL=C sort
-g
-s
/tmp/wlan0_hapd.conf
/tmp/wlan1_hapd.conf
/tmp/wlan2_hapd.conf
/var/run/hostapd/global\.0x.* (re)
hostapd
$ R "ps axw" | sed -n '/[w]pa_supplicant/ { s/^.*\bwpa_supplicant[[:space:]]/wpa_supplicant /; p }' | sort | head -3
wpa_supplicant -s -i wlan0 -Dnl80211 -c /tmp/wlan0_wpa_supplicant.conf
wpa_supplicant -s -i wlan1 -Dnl80211 -c /tmp/wlan1_wpa_supplicant.conf
wpa_supplicant -s -i wlan2 -Dnl80211 -c /tmp/wlan2_wpa_supplicant.conf
$ R "ba-cli 'Device.WiFi.EndPoint.*.Enable=0' | sed '1d' | awk 'NF'"
Device.WiFi.EndPoint.1.
Device.WiFi.EndPoint.1.Enable=0
Device.WiFi.EndPoint.2.
Device.WiFi.EndPoint.2.Enable=0
Device.WiFi.EndPoint.3.
Device.WiFi.EndPoint.3.Enable=0
Test deactivation of access point 6:
$ R logger -t cram "Test AccessPoint 6 deactivation "$(get_ssid_ref 6)""

View File

@ -14,5 +14,11 @@ Check that logrotate is properly setup:
/var/log/messages
/var/log/messages_firewall
$ R 'grep /var/log/hostapd /var/lib/logrotate.status | cut -d\" -f2'
/var/log/hostapd
$ R 'grep /var/log/wpa_supplicant /var/lib/logrotate.status | cut -d\" -f2'
/var/log/wpa_supplicant
$ R "grep /usr/sbin/logrotate /etc/crontabs/root"
*/10 * * * * /usr/sbin/logrotate /etc/logrotate.conf

View File

@ -0,0 +1,11 @@
Create R alias:
$ alias R="${CRAM_REMOTE_COMMAND:-}"
Check that pwhm log files are not empty:
$ test -s "/var/log/wpa_supplicant"
[1]
$ test -s "/var/log/hostapd"
[1]

View File

@ -53,7 +53,7 @@ Check default SSID configuration of access points:
Check that no hostapd instance is running:
$ R "pgrep -f 'hostapd -ddt'"
$ R "pgrep -f 'hostapd'"
[1]
Test activation of access point 1:
@ -359,8 +359,8 @@ Check that hostapd is operating as expected:
$ R logger -t cram "Check that hostapd is operating"
$ R "ps axw" | sed -nE 's/.*(hostapd .*)/\1/p' | head -1 | tr -s ' ' '\n' | LC_ALL=C sort
-ddt
-g
-s
/tmp/wlan2_hapd.conf
/var/run/hostapd/global\.0x.* (re)
hostapd
@ -411,6 +411,98 @@ Check that the tree interfaces are present in the main link interface:
link 2:
channel.* (re)
Check if hostap pid has changed or not before custom arguments is set:
$ if [ "$(R pgrep -f 'hostapd')" = "$hostap_pid" ]; then echo "true"; else echo "hostapd restarted during the test !"; fi
true
Test custom arguments
$ R "ba-cli 'Device.WiFi.EndPoint.*.Enable=1' | sed '1d' | awk 'NF'"
Device.WiFi.EndPoint.1.
Device.WiFi.EndPoint.1.Enable=1
Device.WiFi.EndPoint.2.
Device.WiFi.EndPoint.2.Enable=1
Device.WiFi.EndPoint.3.
Device.WiFi.EndPoint.3.Enable=1
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.hostapd.ExecutionSettings.CustomArguments=-dds' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.1.ExecutionSettings.":{"CustomArguments":"-dds"}}]
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.hostapd.ExecutionSettings.CustomArguments?' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.1.ExecutionSettings.":{"CustomArguments":"-dds"}}]
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.wpa_supplicant.ExecutionSettings.CustomArguments=-ds' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.2.ExecutionSettings.":{"CustomArguments":"-ds"}}]
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.wpa_supplicant.ExecutionSettings.CustomArguments?' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.2.ExecutionSettings.":{"CustomArguments":"-ds"}}]
$ sleep 10
$ R logger -t cram "Check that hostapd is operating"
$ R "ps axw" | sed -nE 's/.*(hostapd .*)/\1/p' | head -1 | tr -s ' ' '\n' | LC_ALL=C sort
-dds
-g
/tmp/wlan0_hapd.conf
/tmp/wlan1_hapd.conf
/tmp/wlan2_hapd.conf
/var/run/hostapd/global\.0x.* (re)
hostapd
$ R logger -t cram "Check that wpa_supplicant is operating"
$ R "ps axw" | sed -n '/[w]pa_supplicant/ { s/^.*\bwpa_supplicant[[:space:]]/wpa_supplicant /; p }' | sort | head -3
wpa_supplicant -ds -i wlan0 -Dnl80211 -c /tmp/wlan0_wpa_supplicant.conf
wpa_supplicant -ds -i wlan1 -Dnl80211 -c /tmp/wlan1_wpa_supplicant.conf
wpa_supplicant -ds -i wlan2 -Dnl80211 -c /tmp/wlan2_wpa_supplicant.conf
Setting the custom arguments back to default value:
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.hostapd.ExecutionSettings.CustomArguments="-s"' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.1.ExecutionSettings.":{"CustomArguments":"-s"}}]
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.hostapd.ExecutionSettings.CustomArguments?' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.1.ExecutionSettings.":{"CustomArguments":"-s"}}]
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.wpa_supplicant.ExecutionSettings.CustomArguments="-s"' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.2.ExecutionSettings.":{"CustomArguments":"-s"}}]
$ R "ba-cli -j -l 'protected; WiFi.DaemonMgt.Daemon.wpa_supplicant.ExecutionSettings.CustomArguments?' | grep CustomArguments"
[{"WiFi.DaemonMgt.Daemon.2.ExecutionSettings.":{"CustomArguments":"-s"}}]
$ sleep 10
$ R logger -t cram "Check that hostapd is operating"
$ R "ps axw" | sed -nE 's/.*(hostapd .*)/\1/p' | head -1 | tr -s ' ' '\n' | LC_ALL=C sort
-g
-s
/tmp/wlan0_hapd.conf
/tmp/wlan1_hapd.conf
/tmp/wlan2_hapd.conf
/var/run/hostapd/global\.0x.* (re)
hostapd
$ R "ps axw" | sed -n '/[w]pa_supplicant/ { s/^.*\bwpa_supplicant[[:space:]]/wpa_supplicant /; p }' | sort | head -3
wpa_supplicant -s -i wlan0 -Dnl80211 -c /tmp/wlan0_wpa_supplicant.conf
wpa_supplicant -s -i wlan1 -Dnl80211 -c /tmp/wlan1_wpa_supplicant.conf
wpa_supplicant -s -i wlan2 -Dnl80211 -c /tmp/wlan2_wpa_supplicant.conf
$ R "ba-cli 'Device.WiFi.EndPoint.*.Enable=0' | sed '1d' | awk 'NF'"
Device.WiFi.EndPoint.1.
Device.WiFi.EndPoint.1.Enable=0
Device.WiFi.EndPoint.2.
Device.WiFi.EndPoint.2.Enable=0
Device.WiFi.EndPoint.3.
Device.WiFi.EndPoint.3.Enable=0
Saving hostap pid:
$ hostap_pid=$(R pgrep -f 'hostapd')
$ R logger -t cram "hostap PID after custom arguments test: $hostap_pid"
Test deactivation of access point 9:
$ enable_ap_sync 9 0
@ -691,7 +783,7 @@ Check wpacltrl socket file:
Check if hostapd process is stopped:
$ R "pgrep -f 'hostapd -ddt'"
$ R "pgrep -f 'hostapd'"
[1]
Resume prplMesh:

View File

@ -308,8 +308,10 @@ Check that hostapd is operating as expected:
$ R logger -t cram "Check that hostapd is operating"
$ R "ps axw" | sed -nE 's/.*(hostapd .*)/\1/p' | head -1 | tr -s ' ' '\n' | LC_ALL=C sort
-ddt
-g
-s
/tmp/wlan0_hapd.conf
/tmp/wlan1_hapd.conf
/tmp/wlan2_hapd.conf
/var/run/hostapd/global\.0x.* (re)
hostapd