'-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 <[email protected]> --- 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', + ], + outfunc => sub { + $bridge_output .= shift; + }, + ); + + my $data = decode_json($bridge_output); + my %vlan_information = map { $_->{ifname} => $_ } $data->@*; + + return \%vlan_information; +} + 1; -- 2.47.3 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
