From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 2C8901FF13F for ; Thu, 12 Mar 2026 15:58:29 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B4C191D3C5; Thu, 12 Mar 2026 15:58:24 +0100 (CET) Message-ID: <829e80ef-1274-4ac7-9ebf-1c8fa0b55108@proxmox.com> Date: Thu, 12 Mar 2026 15:57:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH proxmox] fix #7329: proxmox-network-api: add missing `Auto` network config method To: Shan Shaji , pbs-devel@lists.proxmox.com References: <20260311101109.116215-1-s.shaji@proxmox.com> Content-Language: en-US, de-DE From: Christian Ebner In-Reply-To: <20260311101109.116215-1-s.shaji@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1773327433374 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.057 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: I5HVYFAS6BHPX7U32R6SSGIURCFJYBUY X-Message-ID-Hash: I5HVYFAS6BHPX7U32R6SSGIURCFJYBUY X-MailFrom: c.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Thanks for the patch, gave this a quick spin but ran into an issue. If I do have a network config containing e.g.: ``` auto nic1 iface nic1 inet static address 172.16.0.18/24 iface nic1 inet6 auto ``` and I go about to edit this NIC via the WebUI, e.g. adding a comment, the suggested diff would drop this, suggesting the following diff: ``` auto nic1 iface nic1 inet static address 172.16.0.18/24 - -iface nic1 inet6 auto +#comment ``` Can this easily be avoided? On 3/11/26 11:10 AM, Shan Shaji wrote: > when adding an iface object with network type as inet6 and the config > type as auto, the web UI was showing an error inside the "Network > interfaces" section. This was because the `NetworkParser` failed to > parse the auto method. Inorder to fix the issue, add new `Auto` variant typo: s/Inorder/In order/ > inside the `NetworkConfigMethod` enum and update the match clause to > handle `Auto` variant. > Please include a `Fixes` trailer pointing to the bugtracker issue, thanks! > Signed-off-by: Shan Shaji > --- > > Reference: https://manpages.debian.org/trixie/ifupdown/interfaces.5.en.html#INET6_ADDRESS_FAMILY > > proxmox-network-api/src/api_types.rs | 2 ++ > proxmox-network-api/src/config/mod.rs | 1 + > proxmox-network-api/src/config/parser.rs | 43 ++++++++++++++++++++++++ > 3 files changed, 46 insertions(+) > > diff --git a/proxmox-network-api/src/api_types.rs b/proxmox-network-api/src/api_types.rs > index 4860a114..b86f8570 100644 > --- a/proxmox-network-api/src/api_types.rs > +++ b/proxmox-network-api/src/api_types.rs > @@ -37,6 +37,8 @@ pub enum NetworkConfigMethod { > DHCP, > /// Define the loopback interface. > Loopback, > + /// Define interfaces with automatically assigned IPv6 addresses. > + Auto, > } > > #[api()] > diff --git a/proxmox-network-api/src/config/mod.rs b/proxmox-network-api/src/config/mod.rs > index 9b9f0d50..84fdff86 100644 > --- a/proxmox-network-api/src/config/mod.rs > +++ b/proxmox-network-api/src/config/mod.rs > @@ -177,6 +177,7 @@ fn write_iface(iface: &Interface, w: &mut dyn Write) -> Result<(), Error> { > NetworkConfigMethod::Loopback => "loopback", > NetworkConfigMethod::Manual => "manual", > NetworkConfigMethod::DHCP => "dhcp", > + NetworkConfigMethod::Auto => "auto", > } > } > > diff --git a/proxmox-network-api/src/config/parser.rs b/proxmox-network-api/src/config/parser.rs > index 8cbc6ac8..dafe19f8 100644 > --- a/proxmox-network-api/src/config/parser.rs > +++ b/proxmox-network-api/src/config/parser.rs > @@ -461,6 +461,7 @@ impl NetworkParser { > Token::Static => config_method = Some(NetworkConfigMethod::Static), > Token::Manual => config_method = Some(NetworkConfigMethod::Manual), > Token::DHCP => config_method = Some(NetworkConfigMethod::DHCP), > + Token::Auto => config_method = Some(NetworkConfigMethod::Auto), > _ => bail!("unknown iface option {}", text), > } > } > @@ -742,6 +743,48 @@ mod test { > Ok(()) > } > > + #[test] > + fn test_network_config_parser_ipv6_variants() -> Result<(), Error> { > + let input = "auto lo\n\ > + iface lo inet6 loopback\n\ > + \n\ > + auto ens18\n\ > + iface ens18 inet6 auto\n\ > + \n\ > + auto ens20\n\ > + iface ens20 inet6 static\n\ > + \taddress 2001:db8:a::1/64\n\ > + \tgateway 2001:db8:a::fe\n\ > + \n\ > + auto ens21\n\ > + iface ens21 inet6 dhcp\n"; > + > + let mut parser = NetworkParser::new(input.as_bytes()); > + > + let config = parser.parse_interfaces(None)?; > + > + let output = String::try_from(config)?; > + > + let expected = "auto lo\n\ > + iface lo inet6 loopback\n\ > + \n\ > + auto ens18\n\ > + iface ens18 inet6 auto\n\ > + \n\ > + auto ens20\n\ > + iface ens20 inet6 static\n\ > + \taddress 2001:db8:a::1/64\n\ > + \tgateway 2001:db8:a::fe\n\ > + \n\ > + auto ens21\n\ > + iface ens21 inet6 dhcp\n\ > + \n"; > + > + assert_eq!(output, expected); > + > + Ok(()) > + } > + > #[test] > fn test_network_config_parser_no_blank_2() -> Result<(), Error> { > // Adapted from bug 2926