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 9DD721FF13B for ; Wed, 11 Mar 2026 11:11:32 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AAE5C14B0F; Wed, 11 Mar 2026 11:11:27 +0100 (CET) From: Shan Shaji To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox] fix #7329: proxmox-network-api: add missing `Auto` network config method Date: Wed, 11 Mar 2026 11:11:09 +0100 Message-ID: <20260311101109.116215-1-s.shaji@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1773223848715 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.948 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_VALIDITY_CERTIFIED_BLOCKED 0.408 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.819 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.903 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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: QKIMILAW2M3TV5RRKTX5SCLYBBL5RJZH X-Message-ID-Hash: QKIMILAW2M3TV5RRKTX5SCLYBBL5RJZH 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. Inorder to fix the issue, add new `Auto` variant inside the `NetworkConfigMethod` enum and update the match clause to handle `Auto` variant. 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 -- 2.47.3