diff --git a/emhttp/plugins/dynamix/Eth0.page b/emhttp/plugins/dynamix/Eth0.page
index a88463eb5..315974bbc 100644
--- a/emhttp/plugins/dynamix/Eth0.page
+++ b/emhttp/plugins/dynamix/Eth0.page
@@ -52,15 +52,15 @@ function index($key) {
return filter_var($key,FILTER_SANITIZE_NUMBER_INT);
}
-function metric($eth, $prot) {
+function metric($eth, $prot, $index) {
$system = '/sys/class/net';
$bridge = str_replace('eth','br',$eth);
$bond = str_replace('eth','bond',$eth);
$port = file_exists("$system/$bridge") ? $bridge : (file_exists("$system/$bond") ? $bond : $eth);
- $metric = exec("ip -$prot route show default dev $port | grep -Pom1 ' metric \K\d+'");
- if ($metric) return $metric;
- exec("ip -$prot route show default | grep -Po ' metric \K\d+'",$metrics);
- return max($metrics) + 1;
+ $metric = exec("ip -$prot route show default dev $port 2>/dev/null | grep -Pom1 ' metric \K\d+'");
+ if ($metric) return $metric + $index;
+ exec("ip -$prot route show default 2>/dev/null | grep -Po ' metric \K\d+'",$metrics);
+ return max($metrics) + $index + 1;
}
// remove non-existing ethernet ports
@@ -717,7 +717,7 @@ _(IPv4 address)_:
_(IPv4 default gateway)_:
: " class="narrow" pattern="=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
- " class="slim"> *=$metric?>*
+ " class="slim"> *=$metric?>*
:eth_ipv4_default_gateway_help:
@@ -734,13 +734,13 @@ _(IPv6 address assignment)_:
_(IPv6 address)_:
-:
" pattern="=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/
" class="slim">
+:
" pattern="=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/
" class="slim">
:eth_ipv6_address_help:
_(IPv6 default gateway)_:
:
" pattern="=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
-
" class="slim">
*=$metric?>*
+
" class="slim">
*=$metric?>*
:eth_ipv6_default_gateway_help:
@@ -817,7 +817,7 @@ _(IPv4 address)_:
_(IPv4 default gateway)_:
:
" class="narrow" pattern="=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
-
" class="slim">
*=$metric?>*
+
',4,$i)?>" class="slim">
*=$metric?>*
:eth_ipv4_default_gateway_help:
@@ -839,14 +839,14 @@ _(IPv6 address assignment)_:
_(IPv6 address)_:
-:
" pattern="=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/
" class="slim">
+:
" pattern="=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/
" class="slim">
:eth_ipv6_address_help:
_(IPv6 default gateway)_:
:
" pattern="=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
-
" class="slim">
*=$metric?>*
+
',6,$i)?>" class="slim">
*=$metric?>*
:eth_ipv6_default_gateway_help:
@@ -897,18 +897,18 @@ _(IPv4 address assignment)_:
=mk_option(_var($eth0,"USE_DHCP:INDEX"), 'no', _('Static'))?>
=mk_option(_var($eth0,"USE_DHCP:INDEX"), '', _('None'))?>
-
>=$enable?>
+
=$enable?>
_(IPv4 address)_:
-:
" class="narrow" pattern="=$validIP4?>" title="=_(IPv4 address A.B.C.D)_">/
-
>=$enable?>
+
=$enable?>