mirror of
https://github.com/unraid/webgui.git
synced 2026-01-06 09:39:58 -06:00
Network enhancements
- Remove non-existing ports from configuration file - New option for additional ports: "Enable default gateway" - Check refinements, do not execute on non-existing ports
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
* Copyright 2012-2023, Bergware International.
|
||||
/* Copyright 2005-2025, Lime Technology
|
||||
* Copyright 2012-2025, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -17,8 +17,8 @@ $docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
|
||||
$_SERVER['REQUEST_URI'] = 'settings';
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
|
||||
$port = $_POST['port'] ?: 'eth0';
|
||||
if (exec("ip link show ".escapeshellarg($port)."|grep -om1 'NO-CARRIER'")) {
|
||||
echo "<b>"._('Interface')." ".str_replace('eth', _('Ethernet Port')." ", $port)." "._('is down').". "._('Check cable')."!</b>";
|
||||
$port = ($_POST['port'] ?? 'eth0') ?: 'eth0';
|
||||
if (exec("ip -br link show ".escapeshellarg($port)." | grep -om1 'NO-CARRIER'")) {
|
||||
echo "<b>",_('Interface')," - ",_('Ethernet Port')," ",preg_replace('/[^0-9]/','',$port)," ",_('is down'),". ",_('Check cable'),"!</b>";
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
* Copyright 2012-2023, Bergware International.
|
||||
/* Copyright 2005-2025, Lime Technology
|
||||
* Copyright 2012-2025, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -14,10 +14,9 @@
|
||||
$port = $_POST['port'];
|
||||
$cmd = strtolower($_POST['cmd']);
|
||||
exec("ip link set ".escapeshellarg($port)." ".escapeshellarg($cmd));
|
||||
$pass = $cmd=='up' ? 'UP>' : '';
|
||||
$wait = 5;
|
||||
while ($wait > 0) {
|
||||
if (exec("ip link show ".escapeshellarg($port)."|grep -om1 'UP>'")==$pass) break;
|
||||
if (exec("ip -br link show ".escapeshellarg($port)." | awk '{print \$2;exit}'")==strtoupper($cmd)) break;
|
||||
sleep(1);
|
||||
$wait--;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user