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 5E1281FF142 for ; Mon, 16 Feb 2026 11:50:08 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1AFB0E5D9; Mon, 16 Feb 2026 11:50:53 +0100 (CET) From: Dietmar Maurer To: pve-devel@lists.proxmox.com Subject: [RFC proxmox 22/22] firewall-api-types: add FirewallIpsetListEntry and FirewallIpsetEntry api types Date: Mon, 16 Feb 2026 11:44:00 +0100 Message-ID: <20260216104401.3959270-23-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 -2.014 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 ENA_SUBJ_ODD_CASE 2.6 Subject has odd case 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 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.001 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.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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: D7HLSJM2GSPLBDOBWI2F4M2WO7FPYU7U X-Message-ID-Hash: D7HLSJM2GSPLBDOBWI2F4M2WO7FPYU7U 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: FirewallIpsetListEntry represents an ipset in a listing (GET /cluster/firewall/ipset). FirewallIpsetEntry represents a single entry within an ipset (GET /cluster/firewall/ipset/{name}). Signed-off-by: Dietmar Maurer --- proxmox-firewall-api-types/src/ipset.rs | 63 +++++++++++++++++++++++++ proxmox-firewall-api-types/src/lib.rs | 4 +- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/proxmox-firewall-api-types/src/ipset.rs b/proxmox-firewall-api-types/src/ipset.rs index 02659394..5b870873 100644 --- a/proxmox-firewall-api-types/src/ipset.rs +++ b/proxmox-firewall-api-types/src/ipset.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; @@ -107,6 +112,64 @@ impl FromStr for FirewallIpsetReference { } } +#[api( + properties: { + name: { + type: String, + format: &proxmox_schema::ApiStringFormat::VerifyFn(verify_ipset_name), + }, + comment: { + optional: true, + schema: COMMENT_SCHEMA, + }, + }, +)] +/// Firewall ipset list entry. +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] +pub struct FirewallIpsetListEntry { + /// The name of the ipset entry. + pub name: String, + + /// Digest to detect concurrent modifications. + pub digest: ConfigDigest, + + /// Descriptive comment. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comment: Option, +} + +#[api( + properties: { + cidr: { + type: String, + }, + comment: { + optional: true, + schema: COMMENT_SCHEMA, + }, + nomatch: { + optional: true, + }, + }, +)] +/// Firewall ipset content entry. +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] +pub struct FirewallIpsetEntry { + /// 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, + + /// If set to true, the ipset will be used as a "nomatch" ipset. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub nomatch: 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 044fc761..9422def7 100644 --- a/proxmox-firewall-api-types/src/lib.rs +++ b/proxmox-firewall-api-types/src/lib.rs @@ -11,7 +11,9 @@ mod icmp_type; pub use icmp_type::{FirewallIcmpType, FirewallIcmpTypeName}; mod ipset; -pub use ipset::{FirewallIpsetReference, FirewallIpsetScope}; +pub use ipset::{ + FirewallIpsetEntry, FirewallIpsetListEntry, FirewallIpsetReference, FirewallIpsetScope, +}; mod log; pub use log::{ -- 2.47.3