1 |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm |
2 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2023-12-19 09:44:56.678590486 +0000 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2023-12-19 09:44:56.678590486 +0000 |
3 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2023-12-30 15:31:00.000000000 +0000 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2023-12-31 13:44:00.000000000 +0000 |
4 |
@@ -117,22 +117,41 @@ |
@@ -117,22 +117,41 @@ |
5 |
$c->render( template => 'dhcpd' ); |
$c->render( template => 'dhcpd' ); |
6 |
} |
} |
45 |
+ |
+ |
46 |
+ my $cidr = $network . "/" . $bitcount; |
+ my $cidr = $network . "/" . $bitcount; |
47 |
+ return $cidr; |
+ return $cidr; |
48 |
+} |
} |
49 |
+ |
|
50 |
+sub dec2bin { |
+sub dec2bin { |
51 |
+ my $str = unpack("B32", pack("N", shift)); |
+ my $str = unpack("B32", pack("N", shift)); |
52 |
+ return $str; |
+ return $str; |
53 |
} |
+} |
54 |
|
+ |
55 |
+ |
+ |
56 |
sub do_scan { |
sub do_scan { |
57 |
# |
# |
73 |
$c->render( template => 'dhcpd' ); |
$c->render( template => 'dhcpd' ); |
74 |
} |
} |
75 |
|
|
76 |
@@ -361,8 +381,30 @@ |
@@ -314,7 +334,6 @@ |
77 |
|
} |
78 |
|
} |
79 |
|
|
80 |
|
- |
81 |
|
# - 4 expand templates |
82 |
|
# changed to new sme standard signal-event |
83 |
|
system ("/sbin/e-smith/signal-event","workgroup-update") == 0 |
84 |
|
@@ -332,10 +351,10 @@ |
85 |
|
my $c = shift; |
86 |
|
my $ret = delete_all_leases($c); |
87 |
|
if ($ret == 'ok') { |
88 |
|
- dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
89 |
|
+ $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_REMOVED_ALL_LEASES"; |
90 |
|
do_leases($c); |
91 |
|
} |
92 |
|
- else {dhcp_data{"error"}=$ret;} |
93 |
|
+ else {$dhcp_data{"error"}=$ret;} |
94 |
|
return ; |
95 |
|
} |
96 |
|
|
97 |
|
@@ -352,17 +371,39 @@ |
98 |
|
# else return "ok" |
99 |
|
my $ret = delete_lease($c); |
100 |
|
if ($ret == 'ok') { |
101 |
|
- dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
102 |
|
+ $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_DELETED_THE_CLIENT"; |
103 |
|
do_leases($c); |
104 |
|
} |
105 |
|
- else {dhcp_data{"error"}=$ret;} |
106 |
|
+ else {$dhcp_data{"error"}=$ret;} |
107 |
|
return ; |
108 |
|
} |
109 |
|
|
110 |
sub get_scan_results { |
sub get_scan_results { |
111 |
my $c = shift; |
my $c = shift; |
138 |
} |
} |
139 |
|
|
140 |
|
|
141 |
@@ -498,13 +540,6 @@ |
@@ -374,13 +415,45 @@ |
142 |
|
|
143 |
|
sub delete_one_lease { |
144 |
|
my $c = shift; |
145 |
|
- # ...do it |
146 |
|
+ |
147 |
|
+ ###Pull entry to delete |
148 |
|
+ my $ip = $c->param('host'); |
149 |
|
+ my $name = $c->param('name'); |
150 |
|
+ my $name_in_file = '/var/lib/dhcpd/dhcpd.leases' ; |
151 |
|
+ my $name_tmp_file = '/var/lib/dhcpd/dhcpd.leases.tmp' ; |
152 |
|
+ my $name_out_file = '/var/lib/dhcpd/dhcpd.leases~' ; |
153 |
|
+ my $del_current = "0" ; |
154 |
|
+ |
155 |
|
+ open(INFILE,"<$name_in_file") || die "Read Error $name_in_file, Read: $!"; |
156 |
|
+ open(OUTFILE,">$name_tmp_file") || die "Write error $name_in_file, Write: $!"; |
157 |
|
+ while (<INFILE>) { |
158 |
|
+ if ( "$_" =~ /lease $ip/ ) { |
159 |
|
+ $del_current = "1" ; |
160 |
|
+ } |
161 |
|
+ if ( $del_current == "0" ) { print OUTFILE "$_" ; } |
162 |
|
+ if ( "$_" =~ /}/ ) { |
163 |
|
+ $del_current = "0" ; |
164 |
|
+ } |
165 |
|
+ } |
166 |
|
+ rename ($name_tmp_file,$name_in_file) ; |
167 |
|
+ system ("/bin/cp","-f","$name_in_file","$name_out_file") ; |
168 |
|
+ close(INFILE); |
169 |
|
+ close(OUTFILE); |
170 |
|
+ |
171 |
|
+ # changed to new sme standard signal-event |
172 |
|
+ system ("/sbin/e-smith/signal-event","workgroup-update") == 0 |
173 |
|
+ or die "Error while saving settings: $!"; |
174 |
|
return "ok"; |
175 |
|
} |
176 |
|
|
177 |
|
sub delete_all_leases { |
178 |
|
my $c = shift; |
179 |
|
- # ...do it |
180 |
|
+ system ('/bin/echo "" > /var/lib/dhcpd/dhcpd.leases') ==0 |
181 |
|
+ or die "Error while removing all leases: $!"; |
182 |
|
+ |
183 |
|
+ system ("/sbin/e-smith/signal-event","workgroup-update") == 0 |
184 |
|
+ or die "Error while saving settings: $!"; |
185 |
|
+ |
186 |
|
return "ok"; |
187 |
|
} |
188 |
|
|
189 |
|
@@ -498,13 +571,6 @@ |
190 |
return @results; |
return @results; |
191 |
} |
} |
192 |
|
|
200 |
sub do_wol{ |
sub do_wol{ |
201 |
my $c = shift; |
my $c = shift; |
202 |
my $retVal = Perform_Wake_Up($c); |
my $retVal = Perform_Wake_Up($c); |
203 |
@@ -536,4 +571,4 @@ |
@@ -536,4 +602,4 @@ |
204 |
|
|
205 |
1; |
1; |
206 |
|
|
322 |
+1; |
+1; |
323 |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep |
324 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 2023-12-19 09:44:56.680590493 +0000 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 2023-12-19 09:44:56.680590493 +0000 |
325 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 2023-12-30 10:10:00.000000000 +0000 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 2023-12-31 13:55:00.000000000 +0000 |
326 |
@@ -49,10 +49,8 @@ |
@@ -49,23 +49,30 @@ |
327 |
|
|
328 |
% if ($dhcp_data->{trt} eq 'LEASES') { |
% if ($dhcp_data->{trt} eq 'LEASES') { |
329 |
%= include 'partials/_dhcpd_leases' |
%= include 'partials/_dhcpd_leases' |
335 |
%} else { #PARAMS |
%} else { #PARAMS |
336 |
% my $ip_regex = '^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$'; |
% my $ip_regex = '^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$'; |
337 |
<table><tr><td> |
<table><tr><td> |
338 |
@@ -63,9 +61,12 @@ |
- %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases" |
339 |
|
- <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true"> |
340 |
|
- Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')--> |
341 |
|
+ %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showLeasesSpinner()", id=>"scanLeases" |
342 |
|
+ <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadLeases" style="display:true"> |
343 |
|
+ Scanning |
344 |
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
345 |
</button> |
</button> |
346 |
|
+ |
347 |
</td><td> |
</td><td> |
348 |
%= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3' |
- %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3' |
349 |
- </td><td> |
- </td><td> |
350 |
- %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2' |
- %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2' |
351 |
|
+ %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3', onclick=>"showNetworkSpinner()", id=>"scanNetwork" |
352 |
|
+ <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadNetwork" style="display:true"> |
353 |
|
+ Scanning |
354 |
|
+ <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
355 |
|
+ </button> |
356 |
|
+ |
357 |
+ </td> |
+ </td> |
358 |
+ <!-- |
+ <!-- |
359 |
<td> |
<td> |
363 |
</tr> |
</tr> |
364 |
</table> |
</table> |
365 |
<hr /> |
<hr /> |
366 |
|
@@ -179,10 +186,15 @@ |
367 |
|
</div> |
368 |
|
|
369 |
|
%= javascript begin |
370 |
|
- document.getElementById("load").style.display="none"; |
371 |
|
- function showSpinner(){ |
372 |
|
+ document.getElementById("loadLeases").style.display="none"; |
373 |
|
+ document.getElementById("loadNetwork").style.display="none"; |
374 |
|
+ function showLeasesSpinner(){ |
375 |
|
document.getElementById("scanLeases").style.display="none"; |
376 |
|
- document.getElementById("load").style.display="inline"; |
377 |
|
+ document.getElementById("loadLeases").style.display="inline"; |
378 |
|
+ } |
379 |
|
+ function showNetworkSpinner(){ |
380 |
|
+ document.getElementById("scanNetwork").style.display="none"; |
381 |
|
+ document.getElementById("loadNetwork").style.display="inline"; |
382 |
|
} |
383 |
|
%end |
384 |
|
|
385 |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep |
386 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep 2023-12-19 09:44:56.681590497 +0000 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep 2023-12-19 09:44:56.681590497 +0000 |
387 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep 2023-12-29 15:16:00.000000000 +0000 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep 2023-12-31 14:11:00.000000000 +0000 |
388 |
|
@@ -1,8 +1,8 @@ |
389 |
|
<div id='dhcpd-leases'> |
390 |
|
<table><tr><td> |
391 |
|
- %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases" |
392 |
|
- <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true"> |
393 |
|
- Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')--> |
394 |
|
+ %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showLeaseSpinner()", id=>"scanLeases" |
395 |
|
+ <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadLease" style="display:true"> |
396 |
|
+ Scanning |
397 |
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
398 |
|
</button> |
399 |
|
|
400 |
@@ -26,7 +26,7 @@ |
@@ -26,7 +26,7 @@ |
401 |
%= submit_button "$btn", class => 'action' |
%= submit_button "$btn", class => 'action' |
402 |
% end |
% end |
421 |
<a href="/smanager/dhcpd6?trt=DEL&ip=<%= $ip->{ip}%>" onclick="Remove_lease_confirm(event,'<%=$c->l('dhcpd_REMOVE_A_DHCP_LEASE_ACTION')%>',this);"><center><%=l 'dhcpd_REMOVE'%></center></a> |
<a href="/smanager/dhcpd6?trt=DEL&ip=<%= $ip->{ip}%>" onclick="Remove_lease_confirm(event,'<%=$c->l('dhcpd_REMOVE_A_DHCP_LEASE_ACTION')%>',this);"><center><%=l 'dhcpd_REMOVE'%></center></a> |
422 |
- </td><td class = 'sme-border'> |
- </td><td class = 'sme-border'> |
423 |
+ </td> |
+ </td> |
424 |
+ <!--> |
+ <!-- |
425 |
+ <td class = 'sme-border'> |
+ <td class = 'sme-border'> |
426 |
<a href="/smanager/dhcpd8?trt=WIN&ip=<%= $ip->{ip}%>" onclick="Winpop_confirm(event,'<%=$c->l('dhcpd_SENDING_A_WINPOPUP')%>',this);"><center><%=l 'dhcpd_WINPOPUP_ACTION'%></center></a> |
<a href="/smanager/dhcpd8?trt=WIN&ip=<%= $ip->{ip}%>" onclick="Winpop_confirm(event,'<%=$c->l('dhcpd_SENDING_A_WINPOPUP')%>',this);"><center><%=l 'dhcpd_WINPOPUP_ACTION'%></center></a> |
427 |
</td> |
</td> |
429 |
</tr> |
</tr> |
430 |
%} |
%} |
431 |
</tbody> |
</tbody> |
432 |
@@ -110,4 +115,4 @@ |
@@ -78,6 +83,7 @@ |
433 |
|
%= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd' |
434 |
|
|
435 |
|
%= javascript begin |
436 |
|
+ document.getElementById("loadLease").style.display="none"; |
437 |
|
function Wol_confirm(event,msg,current){ |
438 |
|
const getMAC = /.*MAC\=(.*)\&name.*/; |
439 |
|
var MAC = current.href.match(getMAC)[1]; |
440 |
|
@@ -110,4 +116,4 @@ |
441 |
%end |
%end |
442 |
|
|
443 |
|
|
446 |
+</div> |
+</div> |
447 |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep |
448 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep 1970-01-01 01:00:00.000000000 +0100 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep 1970-01-01 01:00:00.000000000 +0100 |
449 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep 2023-12-30 15:30:00.000000000 +0000 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep 2023-12-31 13:59:00.000000000 +0000 |
450 |
@@ -0,0 +1,41 @@ |
@@ -0,0 +1,55 @@ |
451 |
|
+<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.4/css/jquery.dataTables.css"> |
452 |
|
+<script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.6.0.min.js"></script> |
453 |
|
+<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.js"></script> |
454 |
|
+ |
455 |
+<div id='dhcpd-scanresults'> |
+<div id='dhcpd-scanresults'> |
456 |
|
+ |
457 |
+%#= 1/0 |
+%#= 1/0 |
458 |
+ %= $c->l('dhcpd_NETWORK_VALUES_FOUND').$dhcp_data->{"cidr"}; |
+ %= $c->l('dhcpd_NETWORK_VALUES_FOUND').$dhcp_data->{"cidr"}; |
459 |
+ %= form_for '/dhcpd10' => (method => 'POST') => begin |
+ %= form_for '/dhcpd10' => (method => 'POST') => begin |
460 |
+ <br /> |
+ <br /> |
461 |
+ <table class="sme-border table-sort"><thead> |
+ <table id="scanresults" class="sme-border table-sort"><thead> |
462 |
+ <tr> |
+ <tr> |
463 |
+ <th class='sme-border'> |
+ <th class='sme-border'> |
464 |
+ %=l 'dhcpd_NETWORK_NAME' |
+ %=l 'dhcpd_NETWORK_NAME' |
494 |
+ % end |
+ % end |
495 |
+ %= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd' |
+ %= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd' |
496 |
+</div> |
+</div> |
497 |
|
+<script> |
498 |
|
+$(document).ready(function() { |
499 |
|
+ $("table.table-sort").each(function() { |
500 |
|
+ // Enable DataTable on this table |
501 |
|
+ $(this).DataTable(); |
502 |
|
+ }); |
503 |
|
+}); |
504 |
|
+</script> |
505 |
|
+ |