mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-07-14 13:17:41 +02:00
Delegate raspap-network-activity@*.service control to raspapd.service
This commit is contained in:
parent
12c28f3f60
commit
5d8b71b768
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user