Default to using the ipNetToMediaTable to get arp entries.

The old atTable has been deprecated since 1991; many newer
 devices don't implement it at all.  Fall back to the old
 atTable if the device doesn't implement ipNetToMediaTable
 (but I find it hard to imagine that there are any such devices)
This commit is contained in:
Bill Fenner
2006-04-13 04:01:24 +00:00
parent 19018f364e
commit bd6cc8d7f4
2 changed files with 70 additions and 7 deletions

View File

@@ -62,6 +62,7 @@ version 1.0 (04/07/06) - CVS only. No official release
* Fix in HP class for models not returning full bp_index * Fix in HP class for models not returning full bp_index
* [ 1436103 ] L2::Aironet devices weren't getting their model * [ 1436103 ] L2::Aironet devices weren't getting their model
translated properly translated properly
* Use ipNetToMedia table instead of atTable for ARP
verison 0.9 (11/15/04) verison 0.9 (11/15/04)
+ ** Added full Nortel/Bay/BayStack support + ** Added full Nortel/Bay/BayStack support

View File

@@ -51,6 +51,7 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
%SNMP::Info::Bridge::MIBS, %SNMP::Info::Bridge::MIBS,
%SNMP::Info::EtherLike::MIBS, %SNMP::Info::EtherLike::MIBS,
%SNMP::Info::Entity::MIBS, %SNMP::Info::Entity::MIBS,
'IP-MIB' => 'ipNetToMediaIfIndex',
'OSPF-MIB' => 'ospfRouterId', 'OSPF-MIB' => 'ospfRouterId',
'BGP4-MIB' => 'bgpIdentifier', 'BGP4-MIB' => 'bgpIdentifier',
); );
@@ -75,10 +76,15 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
%SNMP::Info::Entity::FUNCS, %SNMP::Info::Entity::FUNCS,
# IFMIB # IFMIB
'i_name2' => 'ifName', 'i_name2' => 'ifName',
# Address Translation Table (ARP Cache) # Obsolete Address Translation Table (ARP Cache)
'at_index' => 'atIfIndex', 'old_at_index' => 'atIfIndex',
'at_paddr' => 'atPhysAddress', 'old_at_paddr' => 'atPhysAddress',
'at_netaddr' => 'atNetAddress', 'old_at_netaddr' => 'atNetAddress',
# IP-MIB IP Net to Media Table (ARP Cache)
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
'at_netaddr' => 'ipNetToMediaNetAddress',
# OSPF
'ospf_ip' => 'ospfHostIpAddress', 'ospf_ip' => 'ospfHostIpAddress',
# BGP Peer Table # BGP Peer Table
'bgp_peers' => 'bgpPeerLocalAddr', 'bgp_peers' => 'bgpPeerLocalAddr',
@@ -100,6 +106,7 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
%SNMP::Info::Bridge::MUNGE, %SNMP::Info::Bridge::MUNGE,
%SNMP::Info::EtherLike::MUNGE, %SNMP::Info::EtherLike::MUNGE,
%SNMP::Info::Entity::MUNGE, %SNMP::Info::Entity::MUNGE,
'old_at_paddr' => \&SNMP::Info::munge_mac,
'at_paddr' => \&SNMP::Info::munge_mac, 'at_paddr' => \&SNMP::Info::munge_mac,
); );
@@ -248,6 +255,25 @@ sub vendor {
} }
sub at_index {
my $l3 = shift;
return $l3->orig_at_index() || $l3->old_at_index();
}
sub at_paddr {
my $l3 = shift;
return $l3->orig_at_paddr() || $l3->old_at_paddr();
}
sub at_netaddr {
my $l3 = shift;
return $l3->orig_at_netaddr() || $l3->old_at_netaddr();
}
1; 1;
__END__ __END__
@@ -434,23 +460,59 @@ see SNMP::Info::Etherlike for the el_index() and el_duplex() methods.
=back =back
=head2 ARP Cache Entries =head2 IP-MIB Arp Cache Table (B<ipNetToMediaTable>)
=over =over
=item $l3->at_index() =item $l3->at_index()
Returns reference to hash. Maps ARP table entries to Interface IIDs
(B<ipNetToMediaIfIndex>)
If the device doesn't support B<ipNetToMediaIfIndex>, this will try
the deprecated B<atIfIndex>.
=item $l3->at_paddr()
Returns reference to hash. Maps ARP table entries to MAC addresses.
(B<ipNetToMediaPhysAddress>)
If the device doesn't support B<ipNetToMediaPhysAddress>, this will try
the deprecated B<atPhysAddress>.
=item $l3->at_netaddr()
Returns reference to hash. Maps ARP table entries to IPs
(B<ipNetToMediaNetAddress>)
If the device doesn't support B<ipNetToMediaNetAddress>, this will try
the deprecated B<atNetAddress>.
=back
=head2 ARP Cache Entries
The B<atTable> has been deprecated since 1991. You should never need
to use these methods. See B<ipNetToMediaTable> above.
=over
=item $l3->old_at_index()
Returns reference to map of IID to Arp Cache Entry Returns reference to map of IID to Arp Cache Entry
(B<atIfIndex>) (B<atIfIndex>)
=item $l3->at_paddr() =item $l3->old_at_paddr()
Returns reference to hash of Arp Cache Entries to MAC address Returns reference to hash of Arp Cache Entries to MAC address
(B<atPhysAddress>) (B<atPhysAddress>)
=item $l3->at_netaddr() =item $l3->old_at_netaddr()
Returns reference to hash of Arp Cache Entries to IP Address Returns reference to hash of Arp Cache Entries to IP Address