interfaces: fix wlanmode usage part 2 #9727

This commit is contained in:
Franco Fichtner 2026-02-05 07:00:59 +01:00
parent d4eb6235ae
commit 4912a671be

View file

@ -1655,18 +1655,6 @@ function _interfaces_wlan_clone($device, $wlcfg)
$wlcfg_mode = $wlcfg['mode'] ?? 'bss';
}
switch ($wlcfg_mode) {
case "hostap":
$mode = 'wlanmode hostap';
break;
case "adhoc":
$mode = 'wlanmode adhoc';
break;
default:
$mode = '';
break;
}
if (does_interface_exist($device)) {
$ifconfig_str = shell_safe('/sbin/ifconfig %s', $device);
if (($wlcfg_mode == 'hostap') && !preg_match('/hostap/si', $ifconfig_str)) {
@ -1693,9 +1681,9 @@ function _interfaces_wlan_clone($device, $wlcfg)
$wlan_frmt = ['/sbin/ifconfig wlan create wlandev %s'];
$wlan_args = [$baseif];
if (strlen($mode)) {
$wlan_args[] = $mode;
$wlan_frmt[] = '%s';
if (in_array($wlcfg_mode, ['adhoc', 'hostap'])) {
$wlan_frmt[] = 'wlanmode %s';
$wlan_args[] = $wlcfg_mode;
}
$wlan_frmt[] = 'bssid name %s';