mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
interfaces: the renaming in one ifconfig may be unstable
This commit is contained in:
parent
2e98784e5c
commit
a7ca166130
@ -72,12 +72,19 @@ function legacy_interface_flags($ifs, $flag, $report_errors=true)
|
||||
}
|
||||
}
|
||||
|
||||
function legacy_interface_rename($ifs, $name)
|
||||
{
|
||||
$cmd = '/sbin/ifconfig ' . escapeshellarg($ifs) . ' name ' . escapeshellarg($name);
|
||||
|
||||
exec($cmd . ' 2>&1', $out, $ret);
|
||||
if ($ret) {
|
||||
log_error('The command `' . $cmd . '\' failed to execute');
|
||||
}
|
||||
}
|
||||
|
||||
function legacy_interface_create($ifs, $name = null)
|
||||
{
|
||||
$cmd = '/sbin/ifconfig ' . escapeshellarg($ifs) . ' create';
|
||||
if (!empty($name)) {
|
||||
$cmd .= ' name ' . escapeshellarg($name);
|
||||
}
|
||||
$new = null;
|
||||
|
||||
exec($cmd . ' 2>&1', $out, $ret);
|
||||
@ -90,6 +97,11 @@ function legacy_interface_create($ifs, $name = null)
|
||||
$new = $out[0];
|
||||
}
|
||||
|
||||
if (!empty($name)) {
|
||||
legacy_interface_rename($ifs, $name);
|
||||
$new = $name;
|
||||
}
|
||||
|
||||
return ($new);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user