Capture port VLANs on Cisco interfaces which are configured for trunking but are not in operational trunking mode

This commit is contained in:
Eric A. Miller
2014-11-05 21:07:11 -05:00
parent 5bb9011fb4
commit 842ac96d48
2 changed files with 24 additions and 2 deletions

View File

@@ -23,6 +23,8 @@ version 3.21 ()
* [#64] Misdetection: Wireless APs, add products MIB to L2::3Com * [#64] Misdetection: Wireless APs, add products MIB to L2::3Com
* Use FDB ID to VID mapping if available to determine end station VLAN * Use FDB ID to VID mapping if available to determine end station VLAN
rather than assuming they are the same. rather than assuming they are the same.
* Capture port VLANs on Cisco interfaces which are configured for
trunking but are not in operational trunking mode
version 3.20 (2014-09-08) version 3.20 (2014-09-08)

View File

@@ -149,6 +149,7 @@ sub i_vlan {
my $port_vlan = $vtp->vtp_trunk_native($partial) || {}; my $port_vlan = $vtp->vtp_trunk_native($partial) || {};
my $i_vlan = $vtp->i_vlan2($partial) || {}; my $i_vlan = $vtp->i_vlan2($partial) || {};
my $trunk_dyn = $vtp->vtp_trunk_dyn($partial) || {};
my $trunk_dyn_stat = $vtp->vtp_trunk_dyn_stat($partial) || {}; my $trunk_dyn_stat = $vtp->vtp_trunk_dyn_stat($partial) || {};
my %i_vlans; my %i_vlans;
@@ -165,8 +166,17 @@ sub i_vlan {
foreach my $port ( keys %$port_vlan ) { foreach my $port ( keys %$port_vlan ) {
my $vlan = $port_vlan->{$port}; my $vlan = $port_vlan->{$port};
next unless defined $vlan; next unless defined $vlan;
# ports up and trunking should have a trunking status
my $stat = $trunk_dyn_stat->{$port}; my $stat = $trunk_dyn_stat->{$port};
if ( defined $stat and $stat =~ /^trunking/ ) {
# vtp_trunk_dyn_stat is not useful for down ports
# so we use vtp_trunk_dyn to see if trunking is set
my $dyn = $trunk_dyn->{$port};
if (($stat and $stat =~ /^trunking/ )
or ($dyn and (($dyn eq 'on') or ($dyn eq 'onNoNegotiate'))))
{
$i_vlans{$port} = $vlan; $i_vlans{$port} = $vlan;
} }
} }
@@ -217,6 +227,7 @@ sub i_vlan_membership {
my $vtp_vlans = $vtp->v_state(); my $vtp_vlans = $vtp->v_state();
my $i_vlan = $vtp->i_vlan2($partial) || {}; my $i_vlan = $vtp->i_vlan2($partial) || {};
my $trunk_dyn_stat = $vtp->vtp_trunk_dyn_stat($partial) || {}; my $trunk_dyn_stat = $vtp->vtp_trunk_dyn_stat($partial) || {};
my $trunk_dyn = $vtp->vtp_trunk_dyn($partial) || {};
my $i_vlan_membership = {}; my $i_vlan_membership = {};
@@ -248,7 +259,9 @@ sub i_vlan_membership {
foreach my $port ( keys %$ports_vlans ) { foreach my $port ( keys %$ports_vlans ) {
my $stat = $trunk_dyn_stat->{$port}; my $stat = $trunk_dyn_stat->{$port};
if ( defined $stat and $stat =~ /^trunking/ ) { my $dyn = $trunk_dyn->{$port};
if (($stat and $stat =~ /^trunking/ )
or ($dyn and (($dyn eq 'on') or ($dyn eq 'onNoNegotiate')))) {
my $k = 0; my $k = 0;
my $list1 = $ports_vlans->{$port} || '0'; my $list1 = $ports_vlans->{$port} || '0';
my $list2 = $ports_vlans_2k->{$port} || '0'; my $list2 = $ports_vlans_2k->{$port} || '0';
@@ -270,6 +283,13 @@ sub i_vlan_membership {
return $i_vlan_membership; return $i_vlan_membership;
} }
sub i_vlan_membership_untagged {
my $vtp = shift;
my $partial = shift;
return $vtp->i_vlan($partial);
}
sub set_i_pvid { sub set_i_pvid {
my $vtp = shift; my $vtp = shift;
my ( $vlan_id, $ifindex ) = @_; my ( $vlan_id, $ifindex ) = @_;