public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: Christoph Heiss <c.heiss@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH installer 4/8] sys: net: drop the now-unused `ipconf` runtime environment configuration
Date: Mon, 11 May 2026 10:55:30 +0200	[thread overview]
Message-ID: <9afb6cab-e0eb-4b61-80b1-b38702f861b5@proxmox.com> (raw)
In-Reply-To: <20260508184546.113293-5-c.heiss@proxmox.com>

`$run_env->{ipconfig}` is still accessed in `extract_data` (Install.pm)
we should probably just use `$run_env->{network}->{interfaces}` like we
do for pinning

On 2026-05-08 20:45, Christoph Heiss wrote:
> $run_env->{ipconf} is now completely unused, thus drop the dead code.
> 
> No functional changes.
> 
> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
> ---
>  Proxmox/Install/RunEnv.pm |  6 ----
>  Proxmox/Sys/Net.pm        | 71 ++-------------------------------------
>  2 files changed, 2 insertions(+), 75 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");
>      }





  reply	other threads:[~2026-05-11  8:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 18:44 [PATCH installer 0/8] add IPv6 SLAAC and v6-only support Christoph Heiss
2026-05-08 18:44 ` [PATCH installer 1/8] install: drop trivial fromjs() wrapper and use JSON::from_json() Christoph Heiss
2026-05-08 18:44 ` [PATCH installer 2/8] install: move network subroutines to Proxmox::Sys::Net Christoph Heiss
2026-05-08 18:44 ` [PATCH installer 3/8] gui: use run_env->{network} instead of old run_env->{ipconf} Christoph Heiss
2026-05-11  9:09   ` Hannes Laimer
2026-05-11  9:59     ` Christoph Heiss
2026-05-08 18:44 ` [PATCH installer 4/8] sys: net: drop the now-unused `ipconf` runtime environment configuration Christoph Heiss
2026-05-11  8:55   ` Hannes Laimer [this message]
2026-05-11 10:00     ` Christoph Heiss
2026-05-08 18:44 ` [PATCH installer 5/8] sys: net: allow up to /128 netmask for IPv6 Christoph Heiss
2026-05-08 18:44 ` [PATCH RFC installer 6/8] sys: net: ignore ipv6 nameservers with zone identifiers Christoph Heiss
2026-05-08 18:44 ` [PATCH installer 7/8] common: options: rework network address setup to handle ipv6-only Christoph Heiss
2026-05-08 18:44 ` [PATCH installer 8/8] unconfigured: try to retrieve IPv6 SLAAC addresses on startup Christoph Heiss
2026-05-11  9:40 ` [PATCH installer 0/8] add IPv6 SLAAC and v6-only support Gabriel Goller
2026-05-11 15:59 ` Christoph Heiss

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=9afb6cab-e0eb-4b61-80b1-b38702f861b5@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=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