Commit e6e78723 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(interface groups) allow virtual interfaces

PR: https://github.com/opnsense/core/issues/1455

(cherry picked from commit f6d83a94)
(cherry picked from commit 1dabd53d)
(cherry picked from commit 73b1d444)
parent 1788f2b4
...@@ -40,6 +40,7 @@ function if_group_interfaces() ...@@ -40,6 +40,7 @@ function if_group_interfaces()
$oc['if'] = $ifgen['ifname']; $oc['if'] = $ifgen['ifname'];
$oc['descr'] = $ifgen['ifname']; $oc['descr'] = $ifgen['ifname'];
$oc['virtual'] = true; $oc['virtual'] = true;
$oc['type'] = 'group';
$interfaces[$ifgen['ifname']] = $oc; $interfaces[$ifgen['ifname']] = $oc;
} }
} }
......
...@@ -79,7 +79,7 @@ function if_openvpn_interfaces() ...@@ -79,7 +79,7 @@ function if_openvpn_interfaces()
$oic = array('enable' => true); $oic = array('enable' => true);
$oic['if'] = 'openvpn'; $oic['if'] = 'openvpn';
$oic['descr'] = 'OpenVPN'; $oic['descr'] = 'OpenVPN';
$oic['type'] = 'none'; $oic['type'] = 'group';
$oic['virtual'] = true; $oic['virtual'] = true;
$oic['networks'] = array(); $oic['networks'] = array();
$interfaces['openvpn'] = $oic; $interfaces['openvpn'] = $oic;
......
...@@ -64,7 +64,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -64,7 +64,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
} }
} }
if (preg_match("/([^a-zA-Z])+/", $pconfig['ifname'], $match)) { if (preg_match("/([^a-zA-Z])+/", $pconfig['ifname'], $match) || empty($pconfig['ifname'])) {
$input_errors[] = gettext("Only letters A-Z are allowed as the group name."); $input_errors[] = gettext("Only letters A-Z are allowed as the group name.");
} }
...@@ -183,9 +183,13 @@ legacy_html_escape_form_data($pconfig); ...@@ -183,9 +183,13 @@ legacy_html_escape_form_data($pconfig);
<td> <td>
<select name="members[]" multiple="multiple" class="selectpicker" data-size="5" data-live-search="true"> <select name="members[]" multiple="multiple" class="selectpicker" data-size="5" data-live-search="true">
<?php <?php
foreach (get_configured_interface_with_descr() as $ifn => $ifinfo):?> foreach (legacy_config_get_interfaces(array("enable" => true)) as $ifn => $ifdetail):
if (!empty($ifdetail['type']) && $ifdetail['type'] == 'group') {
continue;
}
?>
<option value="<?=$ifn;?>" <?=in_array($ifn, $pconfig['members']) ? "selected=\"selected\"" : "";?>> <option value="<?=$ifn;?>" <?=in_array($ifn, $pconfig['members']) ? "selected=\"selected\"" : "";?>>
<?=$ifinfo;?> <?=strtoupper($ifdetail['descr']);?>
</option> </option>
<?php <?php
endforeach;?> endforeach;?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment