#468 Cisco dotted subinterfaces had incorrect vlan assigned

This commit is contained in:
Oliver Gorwits
2022-08-10 09:17:31 +01:00
parent feaeba8be4
commit dcf2c0ee54
2 changed files with 19 additions and 11 deletions

View File

@@ -1,3 +1,9 @@
Version 3.86 (2022-08-10)
[BUG FIXES]
* #468 Cisco dotted subinterfaces had incorrect vlan assigned
Version 3.85 (2022-08-02)
[NEW FEATURES]

View File

@@ -116,6 +116,9 @@ $VERSION = '3.85';
%SNMP::Info::CiscoVTP::MUNGE,
);
# the i_vlan in SUPER is just fine; this exists to catch any dotted vlan
# subinterfaces not caught by CiscoVTP
sub i_vlan {
my $cisco = shift;
my $partial = shift;
@@ -126,18 +129,17 @@ sub i_vlan {
foreach my $idx ( keys %$i_descr ) {
next unless $i_type->{$idx};
if ( $i_type->{$idx} eq 'l2vlan'
|| $i_type->{$idx} eq '135' && !defined $i_vlan->{$idx} )
{
# Not sure where this regex came from, anchored at end?
if ( $i_descr->{$idx} =~ /\.(\d+)$/ ) {
$i_vlan->{$idx} = $1;
}
next unless (($i_type->{$idx} eq 'l2vlan' or $i_type->{$idx} eq '135')
and !defined $i_vlan->{$idx});
# This matches 101 in 'Ethernet0.101-802.1Q vLAN subif'
elsif ( $i_descr->{$idx} =~ /\.(\d+)-/ ) {
$i_vlan->{$idx} = $1;
}
# Not sure where this regex came from, anchored at end?
if ( $i_descr->{$idx} =~ /\.(\d+)$/ ) {
$i_vlan->{$idx} = $1;
}
# This matches 101 in 'Ethernet0.101-802.1Q vLAN subif'
elsif ( $i_descr->{$idx} =~ /\.(\d+)-/ ) {
$i_vlan->{$idx} = $1;
}
}
return $i_vlan;