Changeset 179
- Timestamp:
- Aug 25, 2016, 11:51:49 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r178 r179 530 530 } 531 531 532 sub get_current_scan_mode { 533 my $vlan_name = shift; 534 535 return $KLASK_CFG->{network}{$vlan_name}{'scan-mode'} || $DEFAULT{'scan-mode'} || 'active'; 536 } 537 532 538 sub get_current_vlan_name_for_interface { 533 539 my $interface = shift; … … 939 945 940 946 ALL_NETWORK: 941 for my $ net (@network) {942 943 my @computer = get_list_ip($ net);944 my $current_interface = get_current_interface($ net);945 946 fast_ping(@computer) ;947 for my $current_net (@network) { 948 949 my @computer = get_list_ip($current_net); 950 my $current_interface = get_current_interface($current_net); 951 952 fast_ping(@computer) if get_current_scan_mode($current_net) eq 'active'; 947 953 948 954 LOOP_ON_COMPUTER: … … 968 974 # do not search on router connection (why ?) 969 975 if ( exists $router_mac_ip{$resol_arp{mac_address}}) { 970 $computer_not_detected{$one_computer} = $current_ interface;976 $computer_not_detected{$one_computer} = $current_net; 971 977 next LOOP_ON_COMPUTER; 972 978 } … … 974 980 # do not search on switch inter-connection 975 981 if (exists $switch_level{$resol_arp{hostname_fq}}) { 976 $computer_not_detected{$one_computer} = $current_ interface;982 $computer_not_detected{$one_computer} = $current_net; 977 983 next LOOP_ON_COMPUTER; 978 984 } … … 985 991 # do not have a mac address 986 992 if ($resol_arp{mac_address} eq 'unknow' or (exists $resol_arp{timestamps} and $resol_arp{timestamps} < ($timestamp - 3 * 3600))) { 987 $computer_not_detected{$one_computer} = $current_ interface;993 $computer_not_detected{$one_computer} = $current_net; 988 994 next LOOP_ON_COMPUTER; 989 995 } … … 1017 1023 switch_port_hr => $where{switch_port_hr}, 1018 1024 timestamp => $timestamp, 1019 network => $ net,1025 network => $current_net, 1020 1026 }; 1021 1027 next LOOP_ON_COMPUTER; … … 1033 1039 switch_port_hr => $where{switch_port_hr}, 1034 1040 timestamp => $resol_arp{timestamp}, 1035 network => $ net,1041 network => $current_net, 1036 1042 }; 1037 1043 } … … 1045 1051 # relance un arping sur la machine si celle-ci n'a pas été détectée depuis plus d'une semaine 1046 1052 # push @computer_not_detected, $resol_arp{ipv4_address} if $computerdb->{$resol_arp{ipv4_address}}{timestamp} < $timestamp_last_week; 1047 $computer_not_detected{$resol_arp{ipv4_address}} = $current_ interfaceif $computerdb->{$resol_arp{ipv4_address}}{timestamp} < $timestamp_last_week;1053 $computer_not_detected{$resol_arp{ipv4_address}} = $current_net if $computerdb->{$resol_arp{ipv4_address}}{timestamp} < $timestamp_last_week; 1048 1054 1049 1055 } … … 1059 1065 1060 1066 for my $one_computer (keys %computer_not_detected) { 1061 my $interface = $computer_not_detected{$one_computer}; 1062 system "arping -c 1 -w 1 -rR -i $interface $one_computer &>/dev/null"; 1063 # print "arping -c 1 -w 1 -rR -i $interface $one_computer 2>/dev/null\n"; 1067 my $current_net = $computer_not_detected{$one_computer}; 1068 my $current_interface = get_current_interface($current_net); 1069 system "arping -c 1 -w 1 -rR -i $current_interface $one_computer &>/dev/null" if get_current_scan_mode($current_net) eq 'active'; 1070 # print "arping -c 1 -w 1 -rR -i $current_interface $one_computer 2>/dev/null\n"; 1064 1071 } 1065 1072 return;
Note: See TracChangeset
for help on using the changeset viewer.