mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 16:14:40 +00:00
interfaces: style sweep
This commit is contained in:
parent
df01d880c6
commit
3900d7a5fc
@ -88,7 +88,7 @@ class VlanSettingsController extends ApiMutableModelControllerBase
|
||||
$result = $this->setBase("vlan", "vlan", $uuid, ["vlanif" => $new_vlanif]);
|
||||
// store interface name for apply action
|
||||
if ($result['result'] != 'failed' && $old_vlanif != $new_vlanif) {
|
||||
file_put_contents("/tmp/.vlans.removed", "{$old_vlanif}\n", FILE_APPEND|LOCK_EX);
|
||||
file_put_contents("/tmp/.vlans.removed", "{$old_vlanif}\n", FILE_APPEND | LOCK_EX);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
@ -116,7 +116,7 @@ class VlanSettingsController extends ApiMutableModelControllerBase
|
||||
$result = $this->delBase("vlan", $uuid);
|
||||
// store interface name for apply action
|
||||
if ($result['result'] != 'failed') {
|
||||
file_put_contents("/tmp/.vlans.removed", "{$old_vlanif}\n", FILE_APPEND|LOCK_EX);
|
||||
file_put_contents("/tmp/.vlans.removed", "{$old_vlanif}\n", FILE_APPEND | LOCK_EX);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -53,7 +53,8 @@ class VlanInterfaceField extends BaseListField
|
||||
if (!empty($ifconfig)) {
|
||||
foreach ($ifconfig as $ifname => $details) {
|
||||
// XXX: skip same interface types as legacy, may need to revise later
|
||||
if (strpos($ifname, "_vlan") > 1 || strpos($ifname, "lo") === 0 || strpos($ifname, "enc") === 0 ||
|
||||
if (
|
||||
strpos($ifname, "_vlan") > 1 || strpos($ifname, "lo") === 0 || strpos($ifname, "enc") === 0 ||
|
||||
strpos($ifname, "pflog") === 0 || strpos($ifname, "pfsync") === 0 ||
|
||||
strpos($ifname, "bridge") === 0 ||
|
||||
strpos($ifname, "gre") === 0 || strpos($ifname, "gif") === 0 || strpos($ifname, "ipsec") === 0
|
||||
|
||||
@ -61,7 +61,7 @@ foreach (legacy_interfaces_details() as $ifname => $ifdetails) {
|
||||
if (empty($ifdetails['vlan'])) {
|
||||
continue;
|
||||
}
|
||||
if (isset($all_vlans[$ifname])){
|
||||
if (isset($all_vlans[$ifname])) {
|
||||
$vlan = $all_vlans[$ifname];
|
||||
$cvlan = $ifdetails['vlan'];
|
||||
if (empty($vlan)) {
|
||||
@ -69,8 +69,8 @@ foreach (legacy_interfaces_details() as $ifname => $ifdetails) {
|
||||
legacy_interface_destroy($ifname);
|
||||
} elseif ($vlan['pcp'] != $cvlan['pcp']) {
|
||||
// option 2: pcp changed, which can be altered instantly
|
||||
exec('/sbin/ifconfig ' . escapeshellarg($vlan['vlanif']) . ' vlanpcp ' . escapeshellarg($vlan['pcp']). ' 2>&1', $out, $ret);
|
||||
} elseif ($vlan['tag'] != $cvlan['tag'] || $vlan['if'] != $cvlan['parent']){
|
||||
exec('/sbin/ifconfig ' . escapeshellarg($vlan['vlanif']) . ' vlanpcp ' . escapeshellarg($vlan['pcp']) . ' 2>&1', $out, $ret);
|
||||
} elseif ($vlan['tag'] != $cvlan['tag'] || $vlan['if'] != $cvlan['parent']) {
|
||||
// option 3: changed vlan, recreate with appropriate settings
|
||||
// XXX: legacy code used interface_configure() in these cases, but since you can't change a tag or a parent
|
||||
// for an assigned interface. At the moment that doesn't seem to make much sense
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user