diff -Nur smeserver-dhcpmanager-2.0.4.old/root/etc/e-smith/web/functions/dhcpd smeserver-dhcpmanager-2.0.4.new/root/etc/e-smith/web/functions/dhcpd --- smeserver-dhcpmanager-2.0.4.old/root/etc/e-smith/web/functions/dhcpd 2015-08-18 00:10:14.000000000 +0200 +++ smeserver-dhcpmanager-2.0.4.new/root/etc/e-smith/web/functions/dhcpd 2016-06-28 21:37:03.137204947 +0200 @@ -583,9 +583,8 @@ $work_line =~ s/^;//; $work_line =~ s/"//g; $work_line =~ s/;$//; - push(@liste_computer,$work_line) ; -#we sort IP from @list_computer -@liste_computer= sort @liste_computer; + #we want the last entry is the first element of the array + unshift(@liste_computer,$work_line) ; } } close(FILE); @@ -740,10 +739,24 @@ ##9(sme8)12(sme9)->netbios (ancien10)::8(sme8)11(sme9)->mac address (ancien8)::0->ip:: ##it is possible you may adapt array number if more options/lines are added to the dhcpd.leases ##symptoms are a blank or wrong line in Table_IP + my @mac = (); + my @count = (); + foreach (@liste_computer){ - @computer = split(/;/, $_) ; - if ( $computer[0] ) { + @computer = split(/;/, $_) ; + + #we want to sort elements the array by mac address + $computer[11] = uc($computer[11]) ; + push @mac, ($computer[11]); + my @count; + push @count , (grep /$computer[11]/ , @mac); + next if (scalar @count > 1); + + + #we start the table if it is a valid IP + if ( $computer[0] ) { + $computer[12] = uc($computer[12]) ; my $datedeb = $computer[2] . "-" . $computer[3] ; my $datefin = $computer[5] . "-" . $computer[6] ; $status = $q->a ({href => $q->url (-absolute => 1) . @@ -752,8 +765,6 @@ if ( $sme_conf{'check'} =~ /enabled/ ) { use Net::Ping; my($ping_obj) = Net::Ping->new("icmp"); - $computer[12] = uc($computer[12]) ; - $computer[11] = uc($computer[11]) ; # formatage des dates $computer[3] = substr($computer[3],0,5); $computer[6] = substr($computer[6],0,5);