[2/2] dhcp.cgi: Add column with resolved hostname by IP address

Message ID 20231111093329.17037-1-sebastien.gislain@free.fr
State Rejected
Headers
Series Add column with resolved hostname by IP address |

Commit Message

Sebastien GISLAIN Nov. 11, 2023, 9:33 a.m. UTC
  In web interface, on page DHCP Server, in table Current fixed leases, add column with resolved hostname by IP address
---
 html/cgi-bin/dhcp.cgi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Adolf Belka Nov. 17, 2023, 12:41 p.m. UTC | #1
Hi Sebastien,


Sorry for my late response, After my last response I have been busy with other non IPFire related stuff.

You have made your patch v2 as a diff to your previous patch. That will not work. The previous patch will never be merged into the git repo and so your new patch will not find the lines to change.


You need to go back and do your patch based on the existing dhcp.cgi as previously. Then when running git format-patch, if you use that, you add -v2 and it will create a V2 patch for you. (Yes it should be a lower case v).

If not using git format-patch but doing the patch creation manually then you need to end up with [PATCH V2] in the subject line. That way, the previous patch will be ignored in the system as it will have been superseded by the V2 one.

It looks like the changes should fix the concerns I have but when you redo the V2 patch version I will test it out and report back what I find.


Best regards,

Adolf.

On 11/11/2023 10:33, Sebastien GISLAIN wrote:
> In web interface, on page DHCP Server, in table Current fixed leases, add column with resolved hostname by IP address
> ---
>   html/cgi-bin/dhcp.cgi | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi
> index aabf565d7..b87da6907 100755
> --- a/html/cgi-bin/dhcp.cgi
> +++ b/html/cgi-bin/dhcp.cgi
> @@ -1008,9 +1008,9 @@ END
>   print <<END
>   <table width='100%' class='tbl'>
>   <tr>
> -    <th width='20%' align='center'><a href='$ENV{'SCRIPT_NAME'}?FETHER'><b>$Lang::tr{'mac address'}</b></a></th>
> -    <th width='20%' align='center'><a href='$ENV{'SCRIPT_NAME'}?FIPADDR'><b>$Lang::tr{'ip address'}</b></a></th>
> -	<th width='20%' align='center'><b>$Lang::tr{'hostname'}</b></a></th>
> +    <th width='15%' align='center'><a href='$ENV{'SCRIPT_NAME'}?FETHER'><b>$Lang::tr{'mac address'}</b></a></th>
> +    <th width='10%' align='center'><a href='$ENV{'SCRIPT_NAME'}?FIPADDR'><b>$Lang::tr{'ip address'}</b></a></th>
> +    <th width='15%' align='center'><b>$Lang::tr{'hostname'}</b></th>
>       <th width='15%' align='center'><b>$Lang::tr{'remark'}</b></th>
>       <th width='15%' class='boldbase' align='center'><b>next-server</b></th>
>       <th width='15%' class='boldbase' align='center'><b>filename</b></th>
> @@ -1111,7 +1111,7 @@ foreach my $line (@current2) {
>   	# resolved name (if exists)
>   	my $iaddr = inet_aton($temp[1]);
>   	my $rname = gethostbyaddr($iaddr, AF_INET);
> -	if (!$rname || $rname eq "") { $rname = $Lang::tr{'lookup failed'}; }
> +	if (!$rname || $rname eq "") { $rname = $Lang::tr{'ptr lookup failed'}; }
>       print <<END
>   <td align='center' $col>$TAG2$temp[0]$TAG3</td>
>   <td align='center' $TAG4 $col>$TAG0$temp[1]$TAG1</td>
  
Sebastien GISLAIN Nov. 17, 2023, 2:53 p.m. UTC | #2
Hi Adolf,

Thank you for your reply.

I'm sorry: Git is not my "natural language"!

To go back, I re-cloned the IPFire Git repository, reapplied my changes, 
and resent the patch email.

I hope it'll be OK...

Regards,
Sébastien

Le 17/11/2023 à 13:41, Adolf Belka a écrit :
> Hi Sebastien,
>
>
> Sorry for my late response, After my last response I have been busy 
> with other non IPFire related stuff.
>
> You have made your patch v2 as a diff to your previous patch. That 
> will not work. The previous patch will never be merged into the git 
> repo and so your new patch will not find the lines to change.
>
>
> You need to go back and do your patch based on the existing dhcp.cgi 
> as previously. Then when running git format-patch, if you use that, 
> you add -v2 and it will create a V2 patch for you. (Yes it should be a 
> lower case v).
>
> If not using git format-patch but doing the patch creation manually 
> then you need to end up with [PATCH V2] in the subject line. That way, 
> the previous patch will be ignored in the system as it will have been 
> superseded by the V2 one.
>
> It looks like the changes should fix the concerns I have but when you 
> redo the V2 patch version I will test it out and report back what I find.
>
>
> Best regards,
>
> Adolf.
>
> On 11/11/2023 10:33, Sebastien GISLAIN wrote:
>> In web interface, on page DHCP Server, in table Current fixed leases, 
>> add column with resolved hostname by IP address
>> ---
>>   html/cgi-bin/dhcp.cgi | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi
>> index aabf565d7..b87da6907 100755
>> --- a/html/cgi-bin/dhcp.cgi
>> +++ b/html/cgi-bin/dhcp.cgi
>> @@ -1008,9 +1008,9 @@ END
>>   print <<END
>>   <table width='100%' class='tbl'>
>>   <tr>
>> -    <th width='20%' align='center'><a 
>> href='$ENV{'SCRIPT_NAME'}?FETHER'><b>$Lang::tr{'mac 
>> address'}</b></a></th>
>> -    <th width='20%' align='center'><a 
>> href='$ENV{'SCRIPT_NAME'}?FIPADDR'><b>$Lang::tr{'ip 
>> address'}</b></a></th>
>> -    <th width='20%' align='center'><b>$Lang::tr{'hostname'}</b></a></th>
>> +    <th width='15%' align='center'><a 
>> href='$ENV{'SCRIPT_NAME'}?FETHER'><b>$Lang::tr{'mac 
>> address'}</b></a></th>
>> +    <th width='10%' align='center'><a 
>> href='$ENV{'SCRIPT_NAME'}?FIPADDR'><b>$Lang::tr{'ip 
>> address'}</b></a></th>
>> +    <th width='15%' align='center'><b>$Lang::tr{'hostname'}</b></th>
>>       <th width='15%' align='center'><b>$Lang::tr{'remark'}</b></th>
>>       <th width='15%' class='boldbase' 
>> align='center'><b>next-server</b></th>
>>       <th width='15%' class='boldbase' 
>> align='center'><b>filename</b></th>
>> @@ -1111,7 +1111,7 @@ foreach my $line (@current2) {
>>       # resolved name (if exists)
>>       my $iaddr = inet_aton($temp[1]);
>>       my $rname = gethostbyaddr($iaddr, AF_INET);
>> -    if (!$rname || $rname eq "") { $rname = $Lang::tr{'lookup 
>> failed'}; }
>> +    if (!$rname || $rname eq "") { $rname = $Lang::tr{'ptr lookup 
>> failed'}; }
>>       print <<END
>>   <td align='center' $col>$TAG2$temp[0]$TAG3</td>
>>   <td align='center' $TAG4 $col>$TAG0$temp[1]$TAG1</td>
  

Patch

diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi
index aabf565d7..b87da6907 100755
--- a/html/cgi-bin/dhcp.cgi
+++ b/html/cgi-bin/dhcp.cgi
@@ -1008,9 +1008,9 @@  END
 print <<END
 <table width='100%' class='tbl'>
 <tr>
-    <th width='20%' align='center'><a href='$ENV{'SCRIPT_NAME'}?FETHER'><b>$Lang::tr{'mac address'}</b></a></th>
-    <th width='20%' align='center'><a href='$ENV{'SCRIPT_NAME'}?FIPADDR'><b>$Lang::tr{'ip address'}</b></a></th>
-	<th width='20%' align='center'><b>$Lang::tr{'hostname'}</b></a></th>
+    <th width='15%' align='center'><a href='$ENV{'SCRIPT_NAME'}?FETHER'><b>$Lang::tr{'mac address'}</b></a></th>
+    <th width='10%' align='center'><a href='$ENV{'SCRIPT_NAME'}?FIPADDR'><b>$Lang::tr{'ip address'}</b></a></th>
+    <th width='15%' align='center'><b>$Lang::tr{'hostname'}</b></th>
     <th width='15%' align='center'><b>$Lang::tr{'remark'}</b></th>
     <th width='15%' class='boldbase' align='center'><b>next-server</b></th>
     <th width='15%' class='boldbase' align='center'><b>filename</b></th>
@@ -1111,7 +1111,7 @@  foreach my $line (@current2) {
 	# resolved name (if exists)
 	my $iaddr = inet_aton($temp[1]);
 	my $rname = gethostbyaddr($iaddr, AF_INET);
-	if (!$rname || $rname eq "") { $rname = $Lang::tr{'lookup failed'}; }
+	if (!$rname || $rname eq "") { $rname = $Lang::tr{'ptr lookup failed'}; }
     print <<END
 <td align='center' $col>$TAG2$temp[0]$TAG3</td>
 <td align='center' $TAG4 $col>$TAG0$temp[1]$TAG1</td>