public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Friedrich Weber <f.weber@proxmox.com>
To: Erik Fastermann <e.fastermann@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH pve-manager] fix #7187: report: add ethtool output for physical interfaces
Date: Tue, 12 May 2026 10:34:25 +0200	[thread overview]
Message-ID: <2f1c3f22-6fa9-4032-870e-65eab1d2152e@proxmox.com> (raw)
In-Reply-To: <20260508124030.164094-1-e.fastermann@proxmox.com>

Hi, thanks for tackling this! A few comments inline (note that I only
looked at the PVE patch)

On 08/05/2026 14:39, Erik Fastermann wrote:
> Signed-off-by: Erik Fastermann <e.fastermann@proxmox.com>
> ---

Please add some rationale to the commit message [1], you can derive it
from the bug #7187 for instance.

> 
>  NOTE: A similar patch was applied to all products:
>  pmg, pve, pbs, pdm.
> 
>  PVE/Report.pm | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/PVE/Report.pm b/PVE/Report.pm
> index 29433d4a..b3a5c08c 100644
> --- a/PVE/Report.pm
> +++ b/PVE/Report.pm
> @@ -3,6 +3,7 @@ package PVE::Report;
>  use strict;
>  use warnings;
>  
> +use PVE::IPRoute2;
>  use PVE::Tools;
>  
>  # output the content of all the files of a directory
> @@ -142,6 +143,14 @@ my $init_report_cmds = sub {
>          },
>      };
>  
> +    my $interfaces = PVE::IPRoute2::ip_link_details();
> +
> +    for my $iface (sort keys %{$interfaces}) {
> +        if (PVE::IPRoute2::ip_link_is_physical($interfaces->{$iface})) {
> +            push @{ $report_def->{network}->{cmds} }, "ethtool $iface";

Everything in $report_def->{network}->{cmds} is essentially passed to
run_command, and passing strings from the outside (like $iface) to
something like run_command can be dangerous (e.g. allow command
injection). Granted, here this is the name of a physical interface, so
the risk of someone injecting something there is low, but as a
precaution I'd still apply a PVE::Tools::shellquote on $iface before
constructing the ethtool command here.

> +        }
> +    }
> +

I'd probably wrap the whole thing in an `eval` with a `if(@)`
afterwards, just to prevent something die'ing in `ip_link_details` or
`ip_link_is_physical` from crashing the report.

>      if (cmd_exists('zfs')) {
>          push @{ $report_def->{volumes}->{cmds} },
>              'zpool status',

[1]
https://pve.proxmox.com/wiki/Developer_Documentation#Commits_and_Commit_Messages




      reply	other threads:[~2026-05-12  8:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 12:40 [PATCH pve-manager] fix #7187: report: add ethtool output for physical interfaces Erik Fastermann
2026-05-12  8:34 ` Friedrich Weber [this message]

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=2f1c3f22-6fa9-4032-870e-65eab1d2152e@proxmox.com \
    --to=f.weber@proxmox.com \
    --cc=e.fastermann@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