From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id EB21B70C40 for ; Fri, 25 Jun 2021 12:48:49 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DD93216E72 for ; Fri, 25 Jun 2021 12:48:49 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 7894F16E66 for ; Fri, 25 Jun 2021 12:48:46 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 4B09246233 for ; Fri, 25 Jun 2021 12:48:46 +0200 (CEST) From: Lorenz Stechauner To: pve-devel@lists.proxmox.com Date: Fri, 25 Jun 2021 12:48:37 +0200 Message-Id: <20210625104837.913605-1-l.stechauner@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.683 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [inotify.pm] Subject: [pve-devel] [PATCH common] fix #3153: INotify: adding interface comment to inet6 section when this is the only section X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jun 2021 10:48:50 -0000 Signed-off-by: Lorenz Stechauner --- src/PVE/INotify.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index 562a243..ce1efd1 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -1156,6 +1156,12 @@ sub __read_etc_network_interfaces { $d->{method} = 'manual' if !$d->{method}; $d->{method6} = 'manual' if !$d->{method6}; + if ($d->{comments6}) { + $d->{comments} = '' if !defined($d->{comments}); + $d->{comments} .= $d->{comments6}; + $d->{comments6} = undef; + } + $d->{families} ||= ['inet']; } @@ -1242,7 +1248,7 @@ sub __interface_to_string { my $done = { type => 1, priority => 1, method => 1, active => 1, exists => 1, comments => 1, autostart => 1, options => 1, address => 1, netmask => 1, gateway => 1, broadcast => 1, - method6 => 1, families => 1, options6 => 1, + method6 => 1, families => 1, options6 => 1, comments6 => 1, address6 => 1, netmask6 => 1, gateway6 => 1, broadcast6 => 1, 'uplink-id' => 1 }; if (!$first_block) { @@ -1733,6 +1739,12 @@ NETWORKDOC } } + # if 'inet6' is the only family or is at least a family in use + if ($d->{families}[0] eq 'inet6') { + $d->{comments6} = $d->{comments}; + $d->{comments} = undef; + } + my $i = 0; # some options should be printed only once $raw .= __interface_to_string($iface, $d, $_, !$i++, $ifupdown2) foreach @{$d->{families}}; } -- 2.30.2