Page MenuHomeVyOS Platform

wireless: hostapd occationly gets deactivated via systemd and causes loss in connectivity
Closed, ResolvedPublicBUG

Description

This was found during smoketesting as thoase started to repeadingly fail in the last weeks

out: DEBUG - ======================================================================
out: DEBUG - FAIL: test_wireless_security_station_address (__main__.WirelessInterfaceTest.test_wireless_security_station_address)
out: DEBUG - ----------------------------------------------------------------------
out: DEBUG - Traceback (most recent call last):
out: DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/test_interfaces_wireless.py", line 534, in test_wireless_security_station_address
out: DEBUG -     self.assertTrue(process_named_running('hostapd'))
out: DEBUG - AssertionError: None is not true
out: DEBUG - 
out: DEBUG - ----------------------------------------------------------------------
out: DEBUG - Ran 31 tests in 219.465s

Digging into this revealed that this is NOT related to the smoketest coding but to hostapd/systemd instead.

With a configured WIFI interface and calling sudo systemctl reload-or-restart hostapd@wlan1 multiple times in a short period caused systemd to report: Jul 18 16:15:32 systemd[1]: [email protected]: Deactivated successfully.

According to the internal systemd logic used in our version this is explained by:

/* If there's a stop job queued before we enter the DEAD state, we shouldn't act on Restart=, in order to not
 * undo what has already been enqueued. */
if (unit_stop_pending(UNIT(s)))
        allow_restart = false;

if (s->result == SERVICE_SUCCESS)
        s->result = f;

if (s->result == SERVICE_SUCCESS) {
        unit_log_success(UNIT(s));
        end_state = SERVICE_DEAD;`

Where unit_log_success() generates the log message in question.

Solution

Improve the restart login in the wireless interface script and an upgrade to hostapd solved the issue.

The Wireless smoketests ran continously for 10 hours without an issue.

Test script:

#!/bin/sh
for ii in `seq 1 1000`
do
  /usr/libexec/vyos/tests/smoke/cli/test_interfaces_wireless.py
  if [[ $? == 0 ]]; then
    echo "pass"
  else
    echo "fail"
    exit 1
  fi
done

Details

Difficulty level
Hard (possibly days)
Version
1.4.0
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Package upgrade