diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 4e09845533..b2e5b09ad0 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -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';