[pve-devel] [PATCH installer 3/6] tui: network: select matching NIC for IP configuration

Christoph Heiss c.heiss at proxmox.com
Wed Aug 9 15:44:22 CEST 2023


Instead of always just selecting an essentially random NIC (depending on
the enumeration), use the correct one for the rest of the
(DHCP-obtained) IP configuration.

Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
 proxmox-tui-installer/src/main.rs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
index 4782fa2..580cb34 100644
--- a/proxmox-tui-installer/src/main.rs
+++ b/proxmox-tui-installer/src/main.rs
@@ -548,13 +548,20 @@ fn password_dialog(siv: &mut Cursive) -> InstallerView {
 fn network_dialog(siv: &mut Cursive) -> InstallerView {
     let state = siv.user_data::<InstallerState>().unwrap();
     let options = &state.options.network;
+    let ifnames = state.runtime_info.network.interfaces.keys();
 
     let inner = FormView::new()
         .child(
             "Management interface",
             SelectView::new()
                 .popup()
-                .with_all_str(state.runtime_info.network.interfaces.keys()),
+                .with_all_str(ifnames.clone())
+                .selected(
+                    ifnames
+                        .clone()
+                        .position(|ifname| ifname == &options.ifname)
+                        .unwrap_or_default(),
+                ),
         )
         .child(
             "Hostname (FQDN)",
-- 
2.41.0






More information about the pve-devel mailing list