1 # Copyright (C) 2005 Stanislav Sinyagin
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17 # $Id: RFC2011_IP_MIB.pm,v 1.1 2010-12-27 00:03:56 ivan Exp $
18 # Stanislav Sinyagin <ssinyagin@yahoo.com>
20 # Discovery module for IP-MIB (RFC 2011)
21 # This module does not generate any XML, but provides information
22 # for other discovery modules. For the sake of discovery time and traffic,
23 # it is not implicitly executed during the normal discovery process.
25 package Torrus::DevDiscover::RFC2011_IP_MIB;
34 'ipNetToMediaTable' => '1.3.6.1.2.1.4.22',
35 'ipNetToMediaPhysAddress' => '1.3.6.1.2.1.4.22.1.2',
44 my $devdetails = shift;
46 my $data = $devdetails->data();
47 my $session = $dd->session();
49 my $table = $session->get_table( -baseoid =>
50 $dd->oiddef('ipNetToMediaPhysAddress'));
52 if( not defined( $table ) or scalar( %{$table} ) == 0 )
57 $devdetails->storeSnmpVars( $table );
61 getSnmpIndices( $dd->oiddef('ipNetToMediaPhysAddress') ) )
63 my( $ifIndex, @ipAddrOctets ) = split( '\.', $INDEX );
64 my $ipAddr = join('.', @ipAddrOctets);
66 my $interface = $data->{'interfaces'}{$ifIndex};
67 next if not defined( $interface );
70 $devdetails->snmpVar($dd->oiddef('ipNetToMediaPhysAddress') .
73 $interface->{'ipNetToMedia'}{$ipAddr} = $phyAddr;
74 $interface->{'mediaToIpNet'}{$phyAddr} = $ipAddr;
76 # Cisco routers assign ARP to subinterfaces, but MAC accounting
77 # to main interfaces. Let them search in a global table
78 $data->{'ipNetToMedia'}{$ipAddr} = $phyAddr;
79 $data->{'mediaToIpNet'}{$phyAddr} = $ipAddr;
92 # indent-tabs-mode: nil
93 # perl-indent-level: 4