all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH proxmox 0/4] network-types: add types for network interface names
@ 2026-11-12 17:10 Stefan Hanreich
  2026-11-12 17:10 ` [PATCH proxmox 1/4] network-types: add a type " Stefan Hanreich
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Stefan Hanreich @ 2026-11-12 17:10 UTC (permalink / raw)
  To: pve-devel

Network interface names are validated differently all over the stack:

* pve-iface of the Perl JSON schema, e.g. for the network
  configuration and the interfaces of firewall rules in PVE: letters,
  digits and '_' with an optional VLAN or alias suffix, up to 21
  characters
* pve-bridge-id and the names of container interfaces: [-_.\w\d]+
* the network API of PBS and PDM: the SAFE_ID format with up to 15
  characters
* the installers: pve-iface, up to 15 bytes, and no names reserved for
  bonds, VLANs and bridges
* SDN: VNet IDs of up to 8 letters and digits
* iproute2 and the kernel, whose rules also differ between iproute2
  versions

The pve-iface format accepts names that the kernel rejects, e.g.
longer than 15 bytes, but rejects names with a '-', which users have
asked for (bug #6366 [1]).

This series adds one type per kind of name to proxmox-network-types,
with explicit conversions between them:

* NetworkInterfaceName: names as accepted by the API, i.e. every name
  that the APIs of PVE, PBS and PDM accept and the kernel can use,
  plus a few that pve-iface rejects, e.g. with a '-'. It uses the
  format of the network API of PBS and PDM.
* NetworkInterfaceAltname: names or altnames, e.g. the interface of a
  firewall rule
* KernelNetworkInterfaceName and KernelNetworkInterfaceAltname: names
  as accepted by the kernel, stored as bytes
* LegacyNetworkInterfaceName: names validated by pve-iface, for
  reading existing configurations

The module documentation describes which type to use for what. The
firewall hardening series uses the API types for the interfaces of
firewall rules and guests.

The goal is to unify the validation of interface names with types that
respect all the quirks that exist, and to convert the places dealing
with interface names to them in follow-up series, starting with
proxmox-network-api and the new format in pve-iface.


Notes
=====

The kernel types store bytes, since the kernel stores names as bytes
that do not have to be valid UTF-8, so String is unsuited for them.
Also, not every valid UTF-8 string is a valid kernel name. 'ip -json'
prints names that are not valid UTF-8 unchanged, which serde_json only
accepts when deserializing into bytes.

The types follow the rules of the kernel instead of iproute2, whose
checks differ between versions: before 7.0, 'ip' rejected altnames
with whitespace or '/', and it still rejects the empty altname.

The kernel treats 0xa0 as whitespace, which is also a UTF-8
continuation byte, so it rejects some valid UTF-8 names as well, e.g.
ones containing U+00E0. A test checks the resulting rule against all
code points.

[1] https://bugzilla.proxmox.com/show_bug.cgi?id=6366


proxmox:

Stefan Hanreich (4):
  network-types: add a type for network interface names
  network-types: add a type for network interface altnames
  network-types: add types for names reported by the kernel
  network-types: add a type for names of existing configurations

 proxmox-network-types/Cargo.toml              |   4 +-
 proxmox-network-types/src/lib.rs              |   2 +
 .../src/network_interface.rs                  | 957 ++++++++++++++++++
 3 files changed, 962 insertions(+), 1 deletion(-)
 create mode 100644 proxmox-network-types/src/network_interface.rs


Summary over all repositories:
  3 files changed, 962 insertions(+), 1 deletions(-)

-- 
Generated by murpp 0.12.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-12 17:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 17:10 [PATCH proxmox 0/4] network-types: add types for network interface names Stefan Hanreich
2026-11-12 17:10 ` [PATCH proxmox 1/4] network-types: add a type " Stefan Hanreich
2026-11-12 17:10 ` [PATCH proxmox 2/4] network-types: add a type for network interface altnames Stefan Hanreich
2026-11-12 17:10 ` [PATCH proxmox 3/4] network-types: add types for names reported by the kernel Stefan Hanreich
2026-11-12 17:11 ` [PATCH proxmox 4/4] network-types: add a type for names of existing configurations Stefan Hanreich
2026-11-12 17:36   ` Stefan Hanreich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal