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 # Stanislav Sinyagin <ssinyagin@yahoo.com>
19 # Discovery module for IP-MIB (RFC 2011)
20 # This module does not generate any XML, but provides information
21 # for other discovery modules. For the sake of discovery time and traffic,
22 # it is not implicitly executed during the normal discovery process.
24 package Torrus
::DevDiscover
::RFC2011_IP_MIB
;
36 'ipNetToMediaTable' => '1.3.6.1.2.1.4.22',
37 'ipNetToMediaPhysAddress' => '1.3.6.1.2.1.4.22.1.2',
46 my $devdetails = shift;
48 my $data = $devdetails->data();
49 my $session = $dd->session();
51 my $table = $session->get_table( -baseoid
=>
52 $dd->oiddef('ipNetToMediaPhysAddress'));
54 if( not defined($table) or scalar(keys %{$table}) == 0 )
59 $devdetails->storeSnmpVars( $table );
63 getSnmpIndices
( $dd->oiddef('ipNetToMediaPhysAddress') ) )
65 my( $ifIndex, @ipAddrOctets ) = split( '\.', $INDEX );
66 my $ipAddr = join('.', @ipAddrOctets);
68 my $interface = $data->{'interfaces'}{$ifIndex};
69 next if not defined( $interface );
72 $devdetails->snmpVar($dd->oiddef('ipNetToMediaPhysAddress') .
75 $interface->{'ipNetToMedia'}{$ipAddr} = $phyAddr;
76 $interface->{'mediaToIpNet'}{$phyAddr} = $ipAddr;
78 # Cisco routers assign ARP to subinterfaces, but MAC accounting
79 # to main interfaces. Let them search in a global table
80 $data->{'ipNetToMedia'}{$ipAddr} = $phyAddr;
81 $data->{'mediaToIpNet'}{$phyAddr} = $ipAddr;
94 # indent-tabs-mode: nil
95 # perl-indent-level: 4