mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 08:34:39 +00:00
interfaces: VLAN spoofmac taints siblings and parent interface. closes https://github.com/opnsense/core/issues/5297
o move media detection to generic legacy_interfaces_details() parser o hide options when not applicable (only auto-select means non physical it seems).
This commit is contained in:
parent
3a75948e25
commit
0d77358c1d
@ -232,6 +232,7 @@ function legacy_interfaces_details($intf = null)
|
||||
$result[$current_interface]["macaddr"] = "00:00:00:00:00:00";
|
||||
$result[$current_interface]["ipv4"] = [];
|
||||
$result[$current_interface]["ipv6"] = [];
|
||||
$result[$current_interface]["supported_media"] = [];
|
||||
if (preg_match("/ mtu ([0-9]*).*$/", $line, $matches)) {
|
||||
$result[$current_interface]["mtu"] = $matches[1];
|
||||
}
|
||||
@ -323,6 +324,8 @@ function legacy_interfaces_details($intf = null)
|
||||
$result[$current_interface]['media'] = $matches[1];
|
||||
}
|
||||
$result[$current_interface]['media_raw'] = substr(trim($line), 7);
|
||||
} elseif (preg_match("/media (.*)/", $line, $matches)) {
|
||||
$result[$current_interface]["supported_media"][] = str_replace(" mediaopt ", " ", trim($matches[1]));
|
||||
} elseif (preg_match("/status: (.*)$/", $line, $matches)) {
|
||||
$result[$current_interface]['status'] = $matches[1];
|
||||
} elseif (preg_match("/channel (\S*)/", $line, $matches)) {
|
||||
|
||||
@ -1390,21 +1390,7 @@ if (isset($a_interfaces[$if]['wireless'])) {
|
||||
}
|
||||
|
||||
// Find all possible media options for the interface
|
||||
$mediaopts_list = array();
|
||||
$optlist_intf = get_parent_interface($pconfig['if']);
|
||||
if (count($optlist_intf) > 0) {
|
||||
exec("/sbin/ifconfig -m {$optlist_intf[0]} | grep \"media \"", $mediaopts);
|
||||
foreach ($mediaopts as $mediaopt){
|
||||
preg_match("/media (.*)/", $mediaopt, $matches);
|
||||
if (preg_match("/(.*) mediaopt (.*)/", $matches[1], $matches1)){
|
||||
// there is media + mediaopt like "media 1000baseT mediaopt full-duplex"
|
||||
array_push($mediaopts_list, $matches1[1] . " " . $matches1[2]);
|
||||
} else {
|
||||
// there is only media like "media 1000baseT"
|
||||
array_push($mediaopts_list, $matches[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$mediaopts_list = legacy_interface_details($pconfig['if'])['supported_media'];
|
||||
|
||||
include("head.inc");
|
||||
?>
|
||||
@ -1907,7 +1893,7 @@ include("head.inc");
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if (count($mediaopts_list) > 0):?>
|
||||
if (count($mediaopts_list) > 1):?>
|
||||
<tr>
|
||||
<td><a id="help_for_mediaopt" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Speed and duplex");?> </td>
|
||||
<td>
|
||||
@ -1957,6 +1943,8 @@ include("head.inc");
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if (count($mediaopts_list) > 1):?>
|
||||
<!-- Hardware settings -->
|
||||
<div class="tab-content content-box col-xs-12 __mb">
|
||||
<div class="table-responsive">
|
||||
@ -2029,6 +2017,8 @@ include("head.inc");
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endif;?>
|
||||
<!-- static IPv4 -->
|
||||
<div class="tab-content content-box col-xs-12 __mb" id="staticv4" style="display:none">
|
||||
<div class="table-responsive">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user