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 D44811FF142 for ; Mon, 16 Feb 2026 11:46:02 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F2453DEAA; Mon, 16 Feb 2026 11:45:21 +0100 (CET) From: Dietmar Maurer To: pve-devel@lists.proxmox.com Subject: [RFC proxmox 21/22] firewall-api-types: add FirewallAliasEntry API type Date: Mon, 16 Feb 2026 11:43:59 +0100 Message-ID: <20260216104401.3959270-22-dietmar@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260216104401.3959270-1-dietmar@proxmox.com> References: <20260216104401.3959270-1-dietmar@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.715 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 KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Message-ID-Hash: FFBDS4PRHPKOIG4OGRA4WPR2ODYCXYQL X-Message-ID-Hash: FFBDS4PRHPKOIG4OGRA4WPR2ODYCXYQL X-MailFrom: dietmar@zilli.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 VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add a new FirewallAliasEntry struct that represents a firewall alias definition (items from GET /cluster/firewall/aliases). Signed-off-by: Dietmar Maurer --- proxmox-firewall-api-types/src/alias.rs | 39 +++++++++++++++++++++++++ proxmox-firewall-api-types/src/lib.rs | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/proxmox-firewall-api-types/src/alias.rs b/proxmox-firewall-api-types/src/alias.rs index 7722148c..9f87b43f 100644 --- a/proxmox-firewall-api-types/src/alias.rs +++ b/proxmox-firewall-api-types/src/alias.rs @@ -2,6 +2,11 @@ use std::fmt; use std::str::FromStr; use anyhow::{bail, Error}; +use serde::{Deserialize, Serialize}; + +use proxmox_config_digest::ConfigDigest; +use proxmox_network_types::ip_address::Cidr; +use proxmox_schema::{api, api_types::COMMENT_SCHEMA}; #[cfg(feature = "enum-fallback")] use proxmox_fixed_string::FixedString; @@ -97,6 +102,40 @@ impl FromStr for FirewallAliasReference { } } +#[api( + properties: { + name: { + type: String, + format: &proxmox_schema::ApiStringFormat::VerifyFn(verify_alias_name), + }, + cidr: { + type: String, + }, + comment: { + optional: true, + schema: COMMENT_SCHEMA, + }, + }, +)] +/// Firewall alias definition entry, assigns a CIDR to a name. +/// +/// The name can be used in firewall rules to refer to the CIDR. +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] +pub struct FirewallAliasEntry { + /// The name of the alias entry. + pub name: String, + + /// Network/IP specification in CIDR format. + pub cidr: Cidr, + + /// Digest to detect concurrent modifications. + pub digest: ConfigDigest, + + /// Descriptive comment. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comment: Option, +} + #[cfg(test)] mod tests { use super::*; diff --git a/proxmox-firewall-api-types/src/lib.rs b/proxmox-firewall-api-types/src/lib.rs index 0eebd727..044fc761 100644 --- a/proxmox-firewall-api-types/src/lib.rs +++ b/proxmox-firewall-api-types/src/lib.rs @@ -2,7 +2,7 @@ mod address; pub use address::{FirewallAddressEntry, FirewallAddressList, FirewallAddressMatch}; mod alias; -pub use alias::{FirewallAliasReference, FirewallAliasScope}; +pub use alias::{FirewallAliasEntry, FirewallAliasReference, FirewallAliasScope}; mod conntrack; pub use conntrack::FirewallConntrackHelper; -- 2.47.3