1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2025-07-14 18:17:39 +02:00

Delegate raspap-network-activity@*.service control to raspapd.service

This commit is contained in:
billz 2025-04-28 00:14:04 -07:00
parent 12c28f3f60
commit 5d8b71b768

View File

@ -57,19 +57,16 @@ function DisplayHostAPDConfig()
if (isset($_POST['StartHotspot']) || isset($_POST['RestartHotspot'])) { if (isset($_POST['StartHotspot']) || isset($_POST['RestartHotspot'])) {
$status->addMessage('Attempting to start hotspot', 'info'); $status->addMessage('Attempting to start hotspot', 'info');
if ($arrHostapdConf['BridgedEnable'] == 1) { if ($arrHostapdConf['BridgedEnable'] == 1) {
exec('sudo '.RASPI_CONFIG.'/hostapd/servicestart.sh --interface br0 --seconds 2', $return); exec('sudo '.RASPI_CONFIG.'/hostapd/servicestart.sh --interface br0 --seconds 1', $return);
exec('sudo systemctl stop "raspap-network-activity@*.service"');
exec("sudo systemctl start raspap-network-activity@br0.service");
} elseif ($arrHostapdConf['WifiAPEnable'] == 1) { } elseif ($arrHostapdConf['WifiAPEnable'] == 1) {
exec('sudo '.RASPI_CONFIG.'/hostapd/servicestart.sh --interface uap0 --seconds 2', $return); exec('sudo '.RASPI_CONFIG.'/hostapd/servicestart.sh --interface uap0 --seconds 1', $return);
exec('sudo systemctl stop "raspap-network-activity@*.service"');
exec("sudo systemctl start raspap-network-activity@uap0.service");
} else { } else {
exec('sudo '.RASPI_CONFIG.'/hostapd/servicestart.sh --seconds 2', $return); // systemctl expects a unit name like raspap-network-activity@wlan0.service, no extra quotes
exec('sudo systemctl stop "raspap-network-activity@*.service"'); $iface_nonescaped = $_POST['interface'];
if (!empty($_SESSION['ap_interface'])) { if (preg_match('/^[a-zA-Z0-9_-]+$/', $iface_nonescaped)) { // validate interface name
$iface = escapeshellarg($_SESSION['ap_interface']); exec('sudo '.RASPI_CONFIG.'/hostapd/servicestart.sh --interface ' .$iface_nonescaped. ' --seconds 1', $return);
exec("sudo systemctl start raspap-network-activity@{$iface}.service"); } else {
throw new \Exception('Invalid network interface');
} }
} }
foreach ($return as $line) { foreach ($return as $line) {