- for my $m (keys %$vlan_fdb_table) {
- my $fdb = $vlan_fdb_table->{$m};
- $fdb->{status} == 3 or next; # Only learned MACs
- my $port = $if_table->{$fdb->{port}} or die "Forwarding DB refers to unknown iface";
- my @m = split /\./, $m;
- my $vlan = shift @m;
- my $mac = join(':', map { sprintf('%02x', $_) } @m);
- push @{$port->{macs}}, $mac;
+ if (%$vlan_fdb_table) {
+ for my $m (keys %$vlan_fdb_table) {
+ my $fdb = $vlan_fdb_table->{$m};
+ $fdb->{status} == 3 or next; # Only learned MACs
+ my $port = $if_table->{$fdb->{port}} or die "Forwarding DB refers to unknown iface";
+ my @m = split /\./, $m;
+ my $vlan = shift @m;
+ my $mac = join(':', map { sprintf('%02x', $_) } @m);
+ push @{$port->{macs}}, $mac;
+ }
+ } else {
+ print "# Trying fall-fack to .1d FDB\n" if $debug;
+ my $OID_1dTpFdbTable = '1.3.6.1.2.1.17.4.3';
+ my $fdb_table = my_get_table({
+ 'port' => "$OID_1dTpFdbTable.1.2",
+ 'status' => "$OID_1dTpFdbTable.1.3",
+ });
+ print Dumper($fdb_table) if $debug;
+ for my $m (keys %$fdb_table) {
+ my $fdb = $fdb_table->{$m};
+ $fdb->{status} == 3 or next; # Only learned MACs
+ my $port = $if_table->{$fdb->{port}} or die "Forwarding DB refers to unknown iface";
+ my @m = split /\./, $m;
+ my $mac = join(':', map { sprintf('%02x', $_) } @m);
+ push @{$port->{macs}}, $mac;
+ }