Changeset 104
- Timestamp:
- Dec 12, 2011, 2:11:24 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r103 r104 844 844 my $timestamp_barrier = 3600 * 24 * $days_to_clean; 845 845 846 my %mactimedb = (); 846 847 ALL_VLAN: 847 848 for my $vlan (@vlan_name) { 848 849 849 850 my @ip_list = get_list_ip($vlan); 850 my %mactimedb = ();851 851 852 852 LOOP_ON_IP_ADDRESS: … … 857 857 858 858 #&& $computerdb->{$ip}{timestamp} > $timestamp_barrier; 859 my $ip_timestamp = $computerdb->{$ip}{timestamp}; 860 my $ip_mac = $computerdb->{$ip}{mac_address}; 859 my $ip_timestamp = $computerdb->{$ip}{timestamp}; 860 my $ip_mac = $computerdb->{$ip}{mac_address}; 861 my $ip_hostname_fq = $computerdb->{$ip}{hostname_fq}; 862 863 $mactimedb{$ip_mac} ||= { 864 ip => $ip, 865 timestamp => $ip_timestamp, 866 vlan => $vlan, 867 hostname_fq => $ip_hostname_fq, 868 }; 861 869 862 $mactimedb{$ip_mac} ||= [ $ip, $ip_timestamp ]; 863 864 if ( $mactimedb{$ip_mac}->[1] - $ip_timestamp > $timestamp_barrier ) { 870 if ( $mactimedb{$ip_mac}->{timestamp} - $ip_timestamp > $timestamp_barrier 871 and not $mactimedb{$ip_mac}->{hostname_fq} =~ m/^float/ ) { 865 872 print "remove ip $ip\n" if $verbose; 866 873 delete $computerdb->{$ip}; … … 868 875 } 869 876 870 if ( $ip_timestamp - $mactimedb{$ip_mac}->[1] > $timestamp_barrier ) { 871 print "remove ip ".$mactimedb{$ip_mac}->[0]."\n" if $verbose; 872 delete $computerdb->{$mactimedb{$ip_mac}->[0]}; 877 if ( $ip_timestamp - $mactimedb{$ip_mac}->{timestamp} > $timestamp_barrier 878 and not $ip_hostname_fq =~ m/^float/ ) { 879 print "remove ip ".$mactimedb{$ip_mac}->{ip}."\n" if $verbose; 880 delete $computerdb->{$mactimedb{$ip_mac}->{ip}}; 873 881 $database_has_changed++; 874 882 } 875 883 876 if ( $ip_timestamp > $mactimedb{$ip_mac}->[1]) { 877 $mactimedb{$ip_mac} = [ $ip, $ip_timestamp ]; 884 if ( $ip_timestamp > $mactimedb{$ip_mac}->{timestamp}) { 885 $mactimedb{$ip_mac} = { 886 ip => $ip, 887 timestamp => $ip_timestamp, 888 vlan => $vlan, 889 hostname_fq => $ip_hostname_fq, 890 }; 878 891 } 879 892 }
Note: See TracChangeset
for help on using the changeset viewer.