From deaf393a2f630503e9e584c69d41ef4a722ae3af Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 1 Oct 2020 23:06:47 +0100 Subject: [PATCH 1/3] Expose metric for network interfaces --- ajax/networking/gen_int_config.php | 6 ++++++ ajax/networking/save_int_config.php | 1 + templates/networking.php | 8 ++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ajax/networking/gen_int_config.php b/ajax/networking/gen_int_config.php index 8de760e9..91d70201 100644 --- a/ajax/networking/gen_int_config.php +++ b/ajax/networking/gen_int_config.php @@ -15,6 +15,9 @@ if (isset($_POST['generate'])) { if ($cnfFile['static'] === 'true') { $strConfFile .= "#Static IP configured for ".$cnfFile['interface']."\n"; $strConfFile .= "interface ".$cnfFile['interface']."\n"; + if (isset($cnfFile['metric'])) { + $strConfFile .= "metric ".$cnfFile['metric']."\n"; + } $strConfFile .= "static ip_address=".$cnfFile['ip_address']."\n"; $strConfFile .= "static routers=".$cnfFile['routers']."\n"; $strConfFile .= "static domain_name_servers=".$cnfFile['domain_name_server']."\n\n"; @@ -25,6 +28,9 @@ if (isset($_POST['generate'])) { $strConfFile .= "static routers=".$cnfFile['routers']."\n"; $strConfFile .= "static domain_name_servers=".$cnfFile['domain_name_server']."\n\n"; $strConfFile .= "interface ".$cnfFile['interface']."\n"; + if (isset($cnfFile['metric'])) { + $strConfFile .= "metric ".$cnfFile['metric']."\n"; + } $strConfFile .= "fallback static_".$cnfFile['interface']."\n\n"; } else { $strConfFile .= "#DHCP configured for ".$cnfFile['interface']."\n\n"; diff --git a/ajax/networking/save_int_config.php b/ajax/networking/save_int_config.php index bd396245..f2a3f7b4 100644 --- a/ajax/networking/save_int_config.php +++ b/ajax/networking/save_int_config.php @@ -21,6 +21,7 @@ if (isset($_POST['interface'])) { $cfg['domain_name_server'] = $dns1." ".$dns2; $cfg['static'] = $_POST[$int.'-static']; $cfg['failover'] = $_POST[$int.'-failover']; + $cfg['metric'] = $_POST[$int.'-metric']; if (write_php_ini($cfg, RASPI_CONFIG_NETWORKING.'/'.$file)) { $jsonData = ['return'=>0,'output'=>['Successfully Updated Network Configuration']]; diff --git a/templates/networking.php b/templates/networking.php index 341e8e0e..3d229c9e 100755 --- a/templates/networking.php +++ b/templates/networking.php @@ -141,10 +141,14 @@
-
+ +
+ + +
- + From 602c2a2a7fc06217767af360d642b94cdf86e0c5 Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 2 Oct 2020 09:27:35 +0100 Subject: [PATCH 2/3] Return iface name in absence of cfgFile --- ajax/networking/gen_int_config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ajax/networking/gen_int_config.php b/ajax/networking/gen_int_config.php index 91d70201..4b3be680 100644 --- a/ajax/networking/gen_int_config.php +++ b/ajax/networking/gen_int_config.php @@ -33,7 +33,7 @@ if (isset($_POST['generate'])) { } $strConfFile .= "fallback static_".$cnfFile['interface']."\n\n"; } else { - $strConfFile .= "#DHCP configured for ".$cnfFile['interface']."\n\n"; + $strConfFile .= "#DHCP configured for ".pathinfo($file, PATHINFO_FILENAME)."\n\n"; } } } From 466616e4202204dfbdfc248af406313060e858ce Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 2 Oct 2020 14:24:16 +0100 Subject: [PATCH 3/3] Add label to en_US locale --- locale/en_US/LC_MESSAGES/messages.po | 3 +++ 1 file changed, 3 insertions(+) diff --git a/locale/en_US/LC_MESSAGES/messages.po b/locale/en_US/LC_MESSAGES/messages.po index e704e2f0..82189da3 100644 --- a/locale/en_US/LC_MESSAGES/messages.po +++ b/locale/en_US/LC_MESSAGES/messages.po @@ -490,6 +490,9 @@ msgstr "Disabled" msgid "Static IP Options" msgstr "Static IP Options" +msgid "Metric" +msgstr "Metric" + msgid "Apply settings" msgstr "Apply settings"