From 7f31038462a2b6eafcd94bcf9c24cc8b72edd8a8 Mon Sep 17 00:00:00 2001 From: "Eric A. Miller" Date: Wed, 25 Apr 2018 22:33:08 -0400 Subject: [PATCH] IEEE802dot3ad portlist is indexed with a dot1dBasePort, cross reference with dot1dBasePortIfIndex --- Changes | 7 +++++++ lib/SNMP/Info/IEEE802dot3ad.pm | 16 +++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index 218a29f9..7fb67327 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,10 @@ +Version 3.57 + + [BUG FIXES] + + * IEEE802dot3ad portlist is indexed with a dot1dBasePort, cross reference + with dot1dBasePortIfIndex + Version 3.56 (2018-04-22) [BUG FIXES] diff --git a/lib/SNMP/Info/IEEE802dot3ad.pm b/lib/SNMP/Info/IEEE802dot3ad.pm index b4148f28..891597f9 100644 --- a/lib/SNMP/Info/IEEE802dot3ad.pm +++ b/lib/SNMP/Info/IEEE802dot3ad.pm @@ -64,7 +64,8 @@ sub agg_ports_lag { my $dev = shift; # TODO: implement partial - my $ports = $dev->ad_lag_ports; + my $ports = $dev->ad_lag_ports(); + my $index = $dev->bp_index() || {}; return {} unless ref {} eq ref $ports and scalar keys %$ports; @@ -73,9 +74,18 @@ sub agg_ports_lag { my $idx = $m; my $portlist = $ports->{$m}; next unless $portlist; + + # While dot3adAggTable is indexed by ifIndex, the portlist is indexed + # with a dot1dBasePort, so we need to use dot1dBasePortIfIndex to map to + # the ifIndex. If we don't have dot1dBasePortIfIndex assume + # dot1dBasePort = ifIndex for ( my $i = 0; $i <= scalar(@$portlist); $i++ ) { - $ret->{$i+1} = $idx if ( @$portlist[$i] ); - } + my $ifindex = $i+1; + if ( exists($index->{$i+1}) and defined($index->{$i+1}) ) { + $ifindex = $index->{$i+1}; + } + $ret->{$ifindex} = $idx if ( @$portlist[$i] ); + } } return $ret;