From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id A70521FF141 for ; Mon, 16 Mar 2026 16:22:07 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 055E51F30F; Mon, 16 Mar 2026 16:22:20 +0100 (CET) From: Shan Shaji To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox v2 1/1] fix #7329: proxmox-network-api: add missing `Auto` network config method Date: Mon, 16 Mar 2026 16:21:00 +0100 Message-ID: <20260316152101.207406-2-s.shaji@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260316152101.207406-1-s.shaji@proxmox.com> References: <20260316152101.207406-1-s.shaji@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1773674439737 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.123 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: KGLRG6GMDUIGGQISDPTTJYVH4SAQBSOB X-Message-ID-Hash: KGLRG6GMDUIGGQISDPTTJYVH4SAQBSOB X-MailFrom: s.shaji@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: 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. In order to fix the issue, add new `Auto` variant inside the `NetworkConfigMethod` enum and update the match clause to handle `Auto` variant. Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=7329 Signed-off-by: Shan Shaji --- changes since v1: - added `Fixes` trailer. - fixed typo s/Inorder/In order 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 -- 2.47.3