mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-26 10:52:57 +02:00
dhcp.cgi: Fix bug#10629 - Highlight fixed IP's in dynamic range in red
- This v2 patch has moved the extraHead variable into header.pl - This patch marks all IP's that are in the Fixed list but are also in the dynamic range that has been defined, in red. - Additional function created to check if an ip address is in a defined range. - Added an additional key item under the Fixed Leases table for Fixed IP in dynamic range - Added line to English Language file for this key item. - ./make lang run before commit. - Tested in vm testbed and confirmed that any ip address in the Fixed Leases table that is in the defined dynamic range is highlighted in red - This uses the css background-color appoach from the first patch in this set. - This patch only highlights those IP's that overlap in red but does nothing more. So a user can still create new ones if they want but they will all show up in red. - This patch flags up if people are doing things that they shouldn't be doing but allows them to continue doing so without changing anything if they don't want to and so will not break existing setups. Fixes: Bug#10629 Tested-by: Adolf Belka <adolf.belka@ipfire.org> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org> Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org>
This commit is contained in:
committed by
Peter Müller
parent
de4dea96aa
commit
b52a84ddc7
@@ -1021,8 +1021,9 @@ my $ipdup = 0;
|
||||
my %ipinuse = ();
|
||||
my %macdupl = (); # Duplicate MACs have to be on different subnets
|
||||
my %ipoutside = ();
|
||||
my %ipinrange = ();
|
||||
|
||||
# mark duplicate ip or duplicate MAC
|
||||
# mark duplicate IP, duplicate MAC or IP in dynamic range
|
||||
foreach my $line (@current2) {
|
||||
my @temp = split(/\,/,$line);
|
||||
$macdupl{$temp[0]} += 1;
|
||||
@@ -1033,14 +1034,21 @@ foreach my $line (@current2) {
|
||||
if ($ipinuse{$temp[1]} > 1) {
|
||||
$ipdup = 1; # Flag up duplicates for use later
|
||||
}
|
||||
# Mark IP addresses outwith known subnets
|
||||
$ipoutside{$temp[1]} = 1;
|
||||
$ipinrange{$temp[1]} = 0;
|
||||
foreach my $itf (@ITFs) {
|
||||
if ( &General::IpInSubnet($temp[1],
|
||||
$netsettings{"${itf}_NETADDRESS"},
|
||||
$netsettings{"${itf}_NETMASK"})) {
|
||||
$ipoutside{$temp[1]} = 0;
|
||||
}
|
||||
# Mark IP addresses outwith known subnets
|
||||
if ( &General::IpInSubnet($temp[1],
|
||||
$netsettings{"${itf}_NETADDRESS"},
|
||||
$netsettings{"${itf}_NETMASK"})) {
|
||||
$ipoutside{$temp[1]} = 0;
|
||||
}
|
||||
# Mark IP addresses that overlap with dynamic range
|
||||
if (&Network::ip_address_in_range($temp[1],
|
||||
$dhcpsettings{"START_ADDR_${itf}"},
|
||||
$dhcpsettings{"END_ADDR_${itf}"})) {
|
||||
$ipinrange{$temp[1]} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1094,6 +1102,9 @@ foreach my $line (@current2) {
|
||||
if ($ipoutside{$temp[1]} > 0) {
|
||||
$TAG4 = "class='cell-orange'" if ($dhcpsettings{'KEY2'} ne $key);
|
||||
}
|
||||
if ($ipinrange{$temp[1]} > 0) {
|
||||
$TAG4 = "class='cell-red'" if ($dhcpsettings{'KEY2'} ne $key);
|
||||
}
|
||||
|
||||
print <<END
|
||||
<td align='center' $col>$TAG2$temp[0]$TAG3</td>
|
||||
@@ -1156,6 +1167,8 @@ print <<END
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td class='base cell-orange'>$Lang::tr{'ip address outside subnets'}</td>
|
||||
<td>  </td>
|
||||
<td class='base cell-red'>$Lang::tr{'dhcp fixed ip address in dynamic range'}</td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
$dup
|
||||
|
||||
Reference in New Issue
Block a user