[pve-devel] [PATCH pve-common 2/2] iproute2: add helper for querying vlan information
Hannes Laimer
h.laimer at proxmox.com
Mon Nov 3 15:16:33 CET 2025
small typo inline
On 10/30/25 16:51, Stefan Hanreich wrote:
> '-compressvlans' is used by default, because PVE configures VLAN
> 1-4094 by default on all ports on a VLAN-aware bridge and having one
> entry per VLAN in this case is quite excessive.
>
> Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
> ---
> src/PVE/IPRoute2.pm | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/src/PVE/IPRoute2.pm b/src/PVE/IPRoute2.pm
> index 4e31376..fcacabf 100644
> --- a/src/PVE/IPRoute2.pm
> +++ b/src/PVE/IPRoute2.pm
> @@ -55,4 +55,22 @@ sub altname_mapping($ip_links) {
> return $altnames;
> }
>
> +sub get_vlan_information() {
> + my $bridge_output = '';
> +
> + run_command(
> + [
> + 'bridge', '-compressvlan', '-json', 'vlan', 'show',
's' missing, so '-compressvlans', checked the man page, your commit msg
is correct
> + ],
> + outfunc => sub {
> + $bridge_output .= shift;
> + },
> + );
> +
> + my $data = decode_json($bridge_output);
> + my %vlan_information = map { $_->{ifname} => $_ } $data->@*;
> +
> + return \%vlan_information;
> +}
> +
> 1;
More information about the pve-devel
mailing list