mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-07-14 13:27:40 +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'])) {
|
||||
$status->addMessage('Attempting to start hotspot', 'info');
|
||||
if ($arrHostapdConf['BridgedEnable'] == 1) {
|
||||
exec('sudo '.RASPI_CONFIG.'/hostapd/servicestart.sh --interface br0 --seconds 2', $return);
|
||||
exec('sudo systemctl stop "raspap-network-activity@*.service"');
|
||||
exec("sudo systemctl start raspap-network-activity@br0.service");
|
||||
exec('sudo '.RASPI_CONFIG.'/hostapd/servicestart.sh --interface br0 --seconds 1', $return);
|
||||
} elseif ($arrHostapdConf['WifiAPEnable'] == 1) {
|
||||
exec('sudo '.RASPI_CONFIG.'/hostapd/servicestart.sh --interface uap0 --seconds 2', $return);
|
||||
exec('sudo systemctl stop "raspap-network-activity@*.service"');
|
||||
exec("sudo systemctl start raspap-network-activity@uap0.service");
|
||||
exec('sudo '.RASPI_CONFIG.'/hostapd/servicestart.sh --interface uap0 --seconds 1', $return);
|
||||
} else {
|
||||
exec('sudo '.RASPI_CONFIG.'/hostapd/servicestart.sh --seconds 2', $return);
|
||||
exec('sudo systemctl stop "raspap-network-activity@*.service"');
|
||||
if (!empty($_SESSION['ap_interface'])) {
|
||||
$iface = escapeshellarg($_SESSION['ap_interface']);
|
||||
exec("sudo systemctl start raspap-network-activity@{$iface}.service");
|
||||
// systemctl expects a unit name like raspap-network-activity@wlan0.service, no extra quotes
|
||||
$iface_nonescaped = $_POST['interface'];
|
||||
if (preg_match('/^[a-zA-Z0-9_-]+$/', $iface_nonescaped)) { // validate interface name
|
||||
exec('sudo '.RASPI_CONFIG.'/hostapd/servicestart.sh --interface ' .$iface_nonescaped. ' --seconds 1', $return);
|
||||
} else {
|
||||
throw new \Exception('Invalid network interface');
|
||||
}
|
||||
}
|
||||
foreach ($return as $line) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user