public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH installer v2 5/9] sys: net: drop the now-unused `ipconf` runtime environment configuration
Date: Mon, 11 May 2026 17:57:47 +0200	[thread overview]
Message-ID: <20260511155753.1623099-6-c.heiss@proxmox.com> (raw)
In-Reply-To: <20260511155753.1623099-1-c.heiss@proxmox.com>

$run_env->{ipconf} is now completely unused, thus drop the dead code.

No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v1 -> v2:
  * drop `ipconf` entries from test run-env files

 Proxmox/Install/RunEnv.pm                     |  6 --
 Proxmox/Sys/Net.pm                            | 71 +----------------
 ...n_from_dhcp_no_default_domain.run-env.json | 76 -------------------
 .../no_fqdn_from_dhcp.run-env.json            | 76 -------------------
 .../tests/resources/run-env-info.json         | 76 -------------------
 5 files changed, 2 insertions(+), 303 deletions(-)

diff --git a/Proxmox/Install/RunEnv.pm b/Proxmox/Install/RunEnv.pm
index b83b9ff..d226ce1 100644
--- a/Proxmox/Install/RunEnv.pm
+++ b/Proxmox/Install/RunEnv.pm
@@ -136,7 +136,6 @@ my sub detect_country_tracing_to : prototype($$) {
 # {
 #     arch => <dpkg architecture, e.g. 'amd64' or 'arm64'>,
 #     country => <short country>,
-#     ipconf = <see Proxmox::Sys::Net::get_ip_config()>,
 #     kernel_cmdline = <contents of /proc/cmdline>,
 #     total_memory = <memory size in MiB>,
 #     hvm_supported = <1 if the CPU supports hardware-accelerated virtualization>,
@@ -187,11 +186,6 @@ sub query_installation_environment : prototype() {
         $output->{network}->{hostname} = $fqdn;
     }
 
-    # FIXME: move whatever makes sense over to Proxmox::Sys::Net:: and keep that as single source,
-    # it can then use some different structure just fine (after adapting the GTK GUI to that) but
-    # **never** to (slightly different!) things for the same stuff...
-    $output->{ipconf} = Proxmox::Sys::Net::get_ip_config();
-
     $output->{kernel_cmdline} = file_read_firstline("/proc/cmdline");
     $output->{total_memory} = query_total_memory();
 
diff --git a/Proxmox/Sys/Net.pm b/Proxmox/Sys/Net.pm
index 10144e0..52615ac 100644
--- a/Proxmox/Sys/Net.pm
+++ b/Proxmox/Sys/Net.pm
@@ -186,78 +186,11 @@ sub get_pin_link_file_content {
     return sprintf($LINK_FILE_TEMPLATE, $mac, $pin_name);
 }
 
-sub get_ip_config {
-    my $ifaces = {};
-    my $default;
-    my $pinned_counter = 0;
-
-    my $links = `ip -o l`;
-    foreach my $l (split /\n/, $links) {
-        my ($index, $name, $flags, $state, $mac) =
-            $l =~ m/^(\d+):\s+(\S+):\s+<(\S+)>.*\s+state\s+(\S+)\s+.*\s+link\/ether\s+(\S+)\s+/;
-        next if !$name || $name eq 'lo';
-
-        my $driver = readlink "/sys/class/net/$name/device/driver" || 'unknown';
-        $driver =~ s!^.*/!!;
-
-        $ifaces->{"$index"} = {
-            name => $name,
-            pinned_id => "${pinned_counter}",
-            driver => $driver,
-            flags => $flags,
-            state => $state,
-            mac => $mac,
-        };
-        $pinned_counter++;
-
-        my $addresses = `ip -o a s $name`;
-        for my $addr_line (split /\n/, $addresses) {
-            my ($family, $ip, $prefix) =
-                $addr_line =~ m/^\Q$index\E:\s+\Q$name\E\s+(inet|inet6)\s+($IPRE)\/(\d+)\s+/;
-            next if !$ip;
-            next if $addr_line =~ /scope\s+link/; # ignore link local
-
-            my $mask = $prefix;
-
-            if ($family eq 'inet') {
-                next if !$ip =~ /$IPV4RE/;
-                next if $prefix < 8 || $prefix > 32;
-                $mask = @$ipv4_reverse_mask[$prefix];
-            } else {
-                next if !$ip =~ /$IPV6RE/;
-            }
-
-            $default = $index if !$default;
-
-            $ifaces->{"$index"}->{"$family"} = {
-                prefix => $prefix,
-                mask => $mask,
-                addr => $ip,
-            };
-        }
-    }
-
-    my $route = `ip route`;
-    my ($gateway) = $route =~ m/^default\s+via\s+(\S+)\s+/m;
-
-    my $resolvconf = `cat /etc/resolv.conf`;
-    my ($dnsserver) = $resolvconf =~ m/^nameserver\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/m;
-    my ($domain) = $resolvconf =~ m/^domain\s+(\S+)$/m;
-
-    return {
-        default => $default,
-        ifaces => $ifaces,
-        gateway => $gateway,
-        dnsserver => $dnsserver,
-        domain => $domain,
-    };
-}
-
 sub udevadm_netdev_details {
-    my $ip_config = get_ip_config();
+    my $ifaces = query_netdevs();
 
     my $result = {};
-    for my $dev (values $ip_config->{ifaces}->%*) {
+    for my $dev (values $ifaces->%*) {
         my $name = $dev->{name};
         $result->{$name} = Proxmox::Sys::Udev::get_udev_properties("/sys/class/net/$name");
     }
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/fqdn_from_dhcp_no_default_domain.run-env.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/fqdn_from_dhcp_no_default_domain.run-env.json
index 4c41c13..566e261 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer_fail/fqdn_from_dhcp_no_default_domain.run-env.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/fqdn_from_dhcp_no_default_domain.run-env.json
@@ -84,82 +84,6 @@
     ]
   ],
   "hvm_supported": 1,
-  "ipconf": {
-    "default": "4",
-    "dnsserver": "192.168.1.254",
-    "domain": null,
-    "gateway": "192.168.1.1",
-    "ifaces": {
-      "10": {
-        "driver": "mlx5_core",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "24:8a:07:1e:05:bd",
-        "name": "enp193s0f1np1",
-        "state": "DOWN"
-      },
-      "2": {
-        "driver": "igb",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "a0:36:9f:0a:b3:82",
-        "name": "enp65s0f0",
-        "state": "DOWN"
-      },
-      "3": {
-        "driver": "igb",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "a0:36:9f:0a:b3:83",
-        "name": "enp65s0f1",
-        "state": "DOWN"
-      },
-      "4": {
-        "driver": "igb",
-        "flags": "BROADCAST,MULTICAST,UP,LOWER_UP",
-        "inet": {
-          "addr": "192.168.1.114",
-          "mask": "255.255.240.0",
-          "prefix": 20
-        },
-        "mac": "b4:2e:99:ac:ad:b4",
-        "name": "eno1",
-        "state": "UP"
-      },
-      "5": {
-        "driver": "cdc_ether",
-        "flags": "BROADCAST,MULTICAST,UP,LOWER_UP",
-        "mac": "5a:47:32:dd:c7:47",
-        "name": "enx5a4732ddc747",
-        "state": "UNKNOWN"
-      },
-      "6": {
-        "driver": "igb",
-        "flags": "BROADCAST,MULTICAST,UP,LOWER_UP",
-        "mac": "b4:2e:99:ac:ad:b5",
-        "name": "eno2",
-        "state": "UP"
-      },
-      "7": {
-        "driver": "mlx5_core",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "1c:34:da:5c:5e:24",
-        "name": "enp129s0f0np0",
-        "state": "DOWN"
-      },
-      "8": {
-        "driver": "mlx5_core",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "1c:34:da:5c:5e:25",
-        "name": "enp129s0f1np1",
-        "state": "DOWN"
-      },
-      "9": {
-        "driver": "mlx5_core",
-        "flags": "BROADCAST,MULTICAST,UP,LOWER_UP",
-        "mac": "24:8a:07:1e:05:bc",
-        "name": "enp193s0f0np0",
-        "state": "UP"
-      }
-    }
-  },
   "kernel_cmdline": "BOOT_IMAGE=/boot/linux26 ro ramdisk_size=16777216 rw splash=verbose proxdebug vga=788",
   "network": {
     "hostname": "pveauto",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/no_fqdn_from_dhcp.run-env.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/no_fqdn_from_dhcp.run-env.json
index fa4e834..909cd7c 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer_fail/no_fqdn_from_dhcp.run-env.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/no_fqdn_from_dhcp.run-env.json
@@ -84,82 +84,6 @@
     ]
   ],
   "hvm_supported": 1,
-  "ipconf": {
-    "default": "4",
-    "dnsserver": "192.168.1.254",
-    "domain": null,
-    "gateway": "192.168.1.1",
-    "ifaces": {
-      "10": {
-        "driver": "mlx5_core",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "24:8a:07:1e:05:bd",
-        "name": "enp193s0f1np1",
-        "state": "DOWN"
-      },
-      "2": {
-        "driver": "igb",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "a0:36:9f:0a:b3:82",
-        "name": "enp65s0f0",
-        "state": "DOWN"
-      },
-      "3": {
-        "driver": "igb",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "a0:36:9f:0a:b3:83",
-        "name": "enp65s0f1",
-        "state": "DOWN"
-      },
-      "4": {
-        "driver": "igb",
-        "flags": "BROADCAST,MULTICAST,UP,LOWER_UP",
-        "inet": {
-          "addr": "192.168.1.114",
-          "mask": "255.255.240.0",
-          "prefix": 20
-        },
-        "mac": "b4:2e:99:ac:ad:b4",
-        "name": "eno1",
-        "state": "UP"
-      },
-      "5": {
-        "driver": "cdc_ether",
-        "flags": "BROADCAST,MULTICAST,UP,LOWER_UP",
-        "mac": "5a:47:32:dd:c7:47",
-        "name": "enx5a4732ddc747",
-        "state": "UNKNOWN"
-      },
-      "6": {
-        "driver": "igb",
-        "flags": "BROADCAST,MULTICAST,UP,LOWER_UP",
-        "mac": "b4:2e:99:ac:ad:b5",
-        "name": "eno2",
-        "state": "UP"
-      },
-      "7": {
-        "driver": "mlx5_core",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "1c:34:da:5c:5e:24",
-        "name": "enp129s0f0np0",
-        "state": "DOWN"
-      },
-      "8": {
-        "driver": "mlx5_core",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "1c:34:da:5c:5e:25",
-        "name": "enp129s0f1np1",
-        "state": "DOWN"
-      },
-      "9": {
-        "driver": "mlx5_core",
-        "flags": "BROADCAST,MULTICAST,UP,LOWER_UP",
-        "mac": "24:8a:07:1e:05:bc",
-        "name": "enp193s0f0np0",
-        "state": "UP"
-      }
-    }
-  },
   "kernel_cmdline": "BOOT_IMAGE=/boot/linux26 ro ramdisk_size=16777216 rw splash=verbose proxdebug vga=788",
   "network": {
     "dns": {
diff --git a/proxmox-auto-installer/tests/resources/run-env-info.json b/proxmox-auto-installer/tests/resources/run-env-info.json
index add5f2a..55c4fe0 100644
--- a/proxmox-auto-installer/tests/resources/run-env-info.json
+++ b/proxmox-auto-installer/tests/resources/run-env-info.json
@@ -84,82 +84,6 @@
     ]
   ],
   "hvm_supported": 1,
-  "ipconf": {
-    "default": "4",
-    "dnsserver": "192.168.1.254",
-    "domain": "test.local",
-    "gateway": "192.168.1.1",
-    "ifaces": {
-      "10": {
-        "driver": "mlx5_core",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "24:8a:07:1e:05:bd",
-        "name": "enp193s0f1np1",
-        "state": "DOWN"
-      },
-      "2": {
-        "driver": "igb",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "a0:36:9f:0a:b3:82",
-        "name": "enp65s0f0",
-        "state": "DOWN"
-      },
-      "3": {
-        "driver": "igb",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "a0:36:9f:0a:b3:83",
-        "name": "enp65s0f1",
-        "state": "DOWN"
-      },
-      "4": {
-        "driver": "igb",
-        "flags": "BROADCAST,MULTICAST,UP,LOWER_UP",
-        "inet": {
-          "addr": "192.168.1.114",
-          "mask": "255.255.240.0",
-          "prefix": 20
-        },
-        "mac": "b4:2e:99:ac:ad:b4",
-        "name": "eno1",
-        "state": "UP"
-      },
-      "5": {
-        "driver": "cdc_ether",
-        "flags": "BROADCAST,MULTICAST,UP,LOWER_UP",
-        "mac": "5a:47:32:dd:c7:47",
-        "name": "enx5a4732ddc747",
-        "state": "UNKNOWN"
-      },
-      "6": {
-        "driver": "igb",
-        "flags": "BROADCAST,MULTICAST,UP,LOWER_UP",
-        "mac": "b4:2e:99:ac:ad:b5",
-        "name": "eno2",
-        "state": "UP"
-      },
-      "7": {
-        "driver": "mlx5_core",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "1c:34:da:5c:5e:24",
-        "name": "enp129s0f0np0",
-        "state": "DOWN"
-      },
-      "8": {
-        "driver": "mlx5_core",
-        "flags": "NO-CARRIER,BROADCAST,MULTICAST,UP",
-        "mac": "1c:34:da:5c:5e:25",
-        "name": "enp129s0f1n p1",
-        "state": "DOWN"
-      },
-      "9": {
-        "driver": "mlx5_core",
-        "flags": "BROADCAST,MULTICAST,UP,LOWER_UP",
-        "mac": "24:8a:07:1e:05:bc",
-        "name": "enp193s0f0np0",
-        "state": "UP"
-      }
-    }
-  },
   "kernel_cmdline": "BOOT_IMAGE=/boot/linux26 ro ramdisk_size=16777216 rw splash=verbose proxdebug vga=788",
   "network": {
     "hostname": "pveauto",
-- 
2.53.0





  parent reply	other threads:[~2026-05-11 15:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 15:57 [PATCH installer v2 0/9] add IPv6 SLAAC and v6-only support Christoph Heiss
2026-05-11 15:57 ` [PATCH installer v2 1/9] install: drop trivial fromjs() wrapper and use JSON::from_json() Christoph Heiss
2026-05-11 15:57 ` [PATCH installer v2 2/9] install: move network subroutines to Proxmox::Sys::Net Christoph Heiss
2026-05-11 15:57 ` [PATCH installer v2 3/9] install: use run_env->{network} instead of old run_env->{ipconf} Christoph Heiss
2026-05-11 15:57 ` [PATCH installer v2 4/9] gui: " Christoph Heiss
2026-05-11 15:57 ` Christoph Heiss [this message]
2026-05-11 15:57 ` [PATCH installer v2 6/9] sys: net: allow up to /128 netmask for IPv6 Christoph Heiss
2026-05-11 15:57 ` [PATCH RFC installer v2 7/9] sys: net: ignore ipv6 nameservers with zone identifiers Christoph Heiss
2026-05-11 15:57 ` [PATCH installer v2 8/9] common: options: rework network address setup to handle ipv6-only Christoph Heiss
2026-05-11 15:57 ` [PATCH installer v2 9/9] unconfigured: try to retrieve IPv6 SLAAC addresses on startup Christoph Heiss
2026-05-12  2:46 ` applied: [PATCH installer v2 0/9] add IPv6 SLAAC and v6-only support Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260511155753.1623099-6-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal