From: Lorenz Stechauner <l.stechauner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH common] fix #3153: INotify: adding interface comment to inet6 section when this is the only section
Date: Fri, 25 Jun 2021 12:48:37 +0200 [thread overview]
Message-ID: <20210625104837.913605-1-l.stechauner@proxmox.com> (raw)
Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
---
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
next reply other threads:[~2021-06-25 10:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-25 10:48 Lorenz Stechauner [this message]
2021-06-25 11:18 ` Thomas Lamprecht
2021-06-25 11:45 ` Lorenz Stechauner
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=20210625104837.913605-1-l.stechauner@proxmox.com \
--to=l.stechauner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal