[pve-devel] [PATCH pve-common 2/2] iproute2: add helper for querying vlan information
Stefan Hanreich
s.hanreich at proxmox.com
Mon Nov 3 17:31:21 CET 2025
On 11/3/25 3:16 PM, Hannes Laimer wrote:
> 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
funnily enough both seem to work, but I'll fix it to use the documented
one nevertheless!
>> + ],
>> + 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