1 |
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 |
2 |
--- smeserver-dhcpmanager-2.0.4.old/root/etc/e-smith/web/functions/dhcpd 2015-08-18 00:10:14.000000000 +0200 |
3 |
+++ smeserver-dhcpmanager-2.0.4.new/root/etc/e-smith/web/functions/dhcpd 2016-06-28 21:37:03.137204947 +0200 |
4 |
@@ -583,9 +583,8 @@ |
5 |
$work_line =~ s/^;//; |
6 |
$work_line =~ s/"//g; |
7 |
$work_line =~ s/;$//; |
8 |
- push(@liste_computer,$work_line) ; |
9 |
-#we sort IP from @list_computer |
10 |
-@liste_computer= sort @liste_computer; |
11 |
+ #we want the last entry is the first element of the array |
12 |
+ unshift(@liste_computer,$work_line) ; |
13 |
} |
14 |
} |
15 |
close(FILE); |
16 |
@@ -740,10 +739,24 @@ |
17 |
##9(sme8)12(sme9)->netbios (ancien10)::8(sme8)11(sme9)->mac address (ancien8)::0->ip:: |
18 |
##it is possible you may adapt array number if more options/lines are added to the dhcpd.leases |
19 |
##symptoms are a blank or wrong line in Table_IP |
20 |
+ my @mac = (); |
21 |
+ my @count = (); |
22 |
+ |
23 |
foreach (@liste_computer){ |
24 |
- @computer = split(/;/, $_) ; |
25 |
- if ( $computer[0] ) { |
26 |
+ @computer = split(/;/, $_) ; |
27 |
+ |
28 |
+ #we want to sort elements the array by mac address |
29 |
|
30 |
+ $computer[11] = uc($computer[11]) ; |
31 |
+ push @mac, ($computer[11]); |
32 |
+ my @count; |
33 |
+ push @count , (grep /$computer[11]/ , @mac); |
34 |
+ next if (scalar @count > 1); |
35 |
+ |
36 |
+ |
37 |
+ #we start the table if it is a valid IP |
38 |
+ if ( $computer[0] ) { |
39 |
+ $computer[12] = uc($computer[12]) ; |
40 |
my $datedeb = $computer[2] . "-" . $computer[3] ; |
41 |
my $datefin = $computer[5] . "-" . $computer[6] ; |
42 |
$status = $q->a ({href => $q->url (-absolute => 1) . |
43 |
@@ -752,8 +765,6 @@ |
44 |
if ( $sme_conf{'check'} =~ /enabled/ ) { |
45 |
use Net::Ping; |
46 |
my($ping_obj) = Net::Ping->new("icmp"); |
47 |
- $computer[12] = uc($computer[12]) ; |
48 |
- $computer[11] = uc($computer[11]) ; |
49 |
# formatage des dates |
50 |
$computer[3] = substr($computer[3],0,5); |
51 |
$computer[6] = substr($computer[6],0,5); |