From 5b059e6286c3963c7a1ee1996641917fbf968bbe Mon Sep 17 00:00:00 2001 From: Bill Fenner <> Date: Tue, 23 Mar 2010 17:58:30 +0000 Subject: [PATCH] "arpnip" on Airespace: use the controller's snooping on the IP addresses of its clients, plus the knowledge of the APs' IP and ethernet MAC addresses, to arpnip. This is useful when there is communication (between controller and AP, or between wireless and wired devices) that does not cross routers. --- Info/Airespace.pm | 76 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 60 insertions(+), 16 deletions(-) diff --git a/Info/Airespace.pm b/Info/Airespace.pm index 2defed62..ad02e793 100644 --- a/Info/Airespace.pm +++ b/Info/Airespace.pm @@ -85,16 +85,17 @@ $VERSION = '2.01'; 'airespace_ess_aclname' => 'bsnDot11EssAclName', # AIRESPACE-WIRELESS-MIB::bsnAPTable - 'airespace_ap_mac' => 'bsnAPDot3MacAddress', - 'airespace_ap_name' => 'bsnAPName', - 'airespace_ap_ip' => 'bsnApIpAddress', - 'airespace_ap_loc' => 'bsnAPLocation', - 'airespace_ap_sw' => 'bsnAPSoftwareVersion', - 'airespace_ap_fw' => 'bsnAPBootVersion', - 'airespace_ap_model' => 'bsnAPModel', - 'airespace_ap_serial' => 'bsnAPSerialNumber', - 'airespace_ap_type' => 'bsnAPType', - 'airespace_ap_status' => 'bsnAPAdminStatus', + 'airespace_ap_mac' => 'bsnAPDot3MacAddress', + 'airespace_ap_name' => 'bsnAPName', + 'airespace_ap_ip' => 'bsnApIpAddress', + 'airespace_ap_loc' => 'bsnAPLocation', + 'airespace_ap_sw' => 'bsnAPSoftwareVersion', + 'airespace_ap_fw' => 'bsnAPBootVersion', + 'airespace_ap_model' => 'bsnAPModel', + 'airespace_ap_serial' => 'bsnAPSerialNumber', + 'airespace_ap_type' => 'bsnAPType', + 'airespace_ap_status' => 'bsnAPAdminStatus', + 'airespace_ap_ethermac' => 'bsnAPEthernetMacAddress', # AIRESPACE-WIRELESS-MIB::bsnAPIfTable 'airespace_apif_slot' => 'bsnAPIfSlotId', @@ -112,6 +113,7 @@ $VERSION = '2.01'; 'airespace_sta_ess_idx' => 'bsnMobileStationEssIndex', 'airespace_sta_ssid' => 'bsnMobileStationSsid', 'airespace_sta_delete' => 'bsnMobileStationDeleteAction', + 'airespace_sta_ip' => 'bsnMobileStationIpAddress', # AIRESPACE-WIRELESS-MIB::bsnUsersTable 'airespace_user_name' => 'bsnUserName', @@ -148,15 +150,16 @@ $VERSION = '2.01'; %MUNGE = ( %SNMP::Info::MUNGE, - 'airespace_ap_mac' => \&SNMP::Info::munge_mac, - 'fw_port' => \&SNMP::Info::munge_mac, - 'airespace_bl_mac' => \&SNMP::Info::munge_mac, - 'airespace_if_mac' => \&SNMP::Info::munge_mac, - 'airespace_sta_mac' => \&SNMP::Info::munge_mac, + 'airespace_ap_mac' => \&SNMP::Info::munge_mac, + 'airespace_ap_ethermac' => \&SNMP::Info::munge_mac, + 'fw_port' => \&SNMP::Info::munge_mac, + 'airespace_bl_mac' => \&SNMP::Info::munge_mac, + 'airespace_if_mac' => \&SNMP::Info::munge_mac, + 'airespace_sta_mac' => \&SNMP::Info::munge_mac, ); sub layers { - return '00000011'; + return '00000111'; } sub serial { @@ -896,6 +899,47 @@ sub e_parent { return \%e_parent; } +# arpnip: +# +# This is the controller snooping on the MAC->IP mappings. +# Pretending this is arpnip data allows us to get MAC->IP +# mappings even for stations that only communicate locally. +# Also use the controller's knowledge of the APs' MAC and +# IP addresses to augment the data. + +sub at_paddr { + my $airespace = shift; + my $mac2ip = $airespace->airespace_sta_ip(); + my $apethermac = $airespace->airespace_ap_ethermac(); + + my $ret = {}; + foreach my $idx ( keys %$mac2ip ) { + next if ( $mac2ip->{ $idx } eq '0.0.0.0' ); + my $mac = join( ":", map { sprintf "%02x", $_ } split /\./, $idx ); + $ret->{$idx} = $mac; + } + foreach my $idx ( keys %$apethermac ) { + $ret->{$idx} = $apethermac->{$idx}; + } + return $ret; +} + +sub at_netaddr { + my $airespace = shift; + my $mac2ip = $airespace->airespace_sta_ip(); + my $ap2ip = $airespace->airespace_ap_ip(); + + my $ret = {}; + foreach my $idx ( keys %$mac2ip ) { + next if ( $mac2ip->{ $idx } eq '0.0.0.0' ); + $ret->{$idx} = $mac2ip->{ $idx }; + } + foreach my $idx ( keys %$ap2ip ) { + $ret->{$idx} = $ap2ip->{ $idx }; + } + return $ret; +} + 1; __END__