From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: Re: [PATCH] Fix for Bug #12050: Adding fixed leases with one 'add' click
Date: Wed, 17 Apr 2019 10:31:03 +0100 [thread overview]
Message-ID: <0ADEAEA1-EB9C-4A08-9FDE-23438ECFCEC6@ipfire.org> (raw)
In-Reply-To: <20190416164124.2290-1-matthias.fischer@ipfire.org>
[-- Attachment #1: Type: text/plain, Size: 3287 bytes --]
Hi,
Thanks Matthias for helping out here. However, I do not get the patch.
There is no explanation about what it is meant to do. The intention already is that the lease is added in the first place.
> On 16 Apr 2019, at 17:41, Matthias Fischer <matthias.fischer(a)ipfire.org> wrote:
>
> Signed-off-by: BeBiMa <bbitsch(a)ipfire.org>
> Reviewed-by: Matthias Fischer <matthias.fischer(a)ipfire.org>
> ---
> html/cgi-bin/dhcp.cgi | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi
> index 675d80012..ba5b54f84 100644
> --- a/html/cgi-bin/dhcp.cgi
> +++ b/html/cgi-bin/dhcp.cgi
> @@ -412,12 +412,16 @@ if ($dhcpsettings{'ACTION'} eq $Lang::tr{'add'}.'2') {
> }
>
> my $key = 0;
> + my $szc = scalar(@current2);
> CHECK:foreach my $line (@current2) {
> my @temp = split(/\,/,$line);
> if($dhcpsettings{'KEY2'} ne $key) {
> # same MAC is OK on different subnets. This test is not complete because
> # if ip are not inside a known subnet, I don't warn.
> # Also it may be needed to put duplicate fixed lease in their right subnet definition..
> + if ((lc($dhcpsettings{'FIX_MAC'}) eq lc($temp[0])) &&(lc($dhcpsettings{'FIX_ADDR'}) eq lc($temp[1]))) {
> + last CHECK;
> + }
Why is this needed?
> foreach my $itf (@ITFs) {
> my $scoped = &General::IpInSubnet($dhcpsettings{'FIX_ADDR'},
> $netsettings{"${itf}_NETADDRESS"},
> @@ -442,11 +446,19 @@ if ($dhcpsettings{'ACTION'} eq $Lang::tr{'add'}.'2') {
> $dhcpsettings{'FIX_FILENAME'} = &Header::cleanhtml($dhcpsettings{'FIX_FILENAME'});
> $dhcpsettings{'FIX_ROOTPATH'} = &Header::cleanhtml($dhcpsettings{'FIX_ROOTPATH'});
> if ($dhcpsettings{'KEY2'} eq '') { #add or edit ?
This block here is not indented correctly.
I understand that the code is already very messy, but we should not make it worse either.
> + if($key == $szc) { #add
> + @current2[$key] = "$dhcpsettings{'FIX_MAC'},$dhcpsettings{'FIX_ADDR'},$dhcpsettings{'FIX_ENABLED'},$dhcpsettings{'FIX_NEXTADDR'},$dhcpsettings{'FIX_FILENAME'},$dhcpsettings{'FIX_ROOTPATH'},$dhcpsettings{'FIX_REMARK'}\n";
> + # sort newly added/modified entry
> + &sortcurrent2;
Are you sure we can sort here?
See: https://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff;h=31672dc8bdb223ebf425ff96be64318f2d68e0d7
> + &General::log($Lang::tr{'fixed ip lease added'});
> + $dhcpsettings{'KEY2'} = '';
> + } else { #edit
> unshift (@current2, "$dhcpsettings{'FIX_MAC'},$dhcpsettings{'FIX_ADDR'},$dhcpsettings{'FIX_ENABLED'},$dhcpsettings{'FIX_NEXTADDR'},$dhcpsettings{'FIX_FILENAME'},$dhcpsettings{'FIX_ROOTPATH'},$dhcpsettings{'FIX_REMARK'}\n");
> &General::log($Lang::tr{'fixed ip lease added'});
>
> # Enter edit mode
> $dhcpsettings{'KEY2'} = 0;
> + }
> } else {
> @current2[$dhcpsettings{'KEY2'}] = "$dhcpsettings{'FIX_MAC'},$dhcpsettings{'FIX_ADDR'},$dhcpsettings{'FIX_ENABLED'},$dhcpsettings{'FIX_NEXTADDR'},$dhcpsettings{'FIX_FILENAME'},$dhcpsettings{'FIX_ROOTPATH'},$dhcpsettings{'FIX_REMARK'}\n";
> $dhcpsettings{'KEY2'} = ''; # End edit mode
> --
> 2.18.0
>
-Michael
next prev parent reply other threads:[~2019-04-17 9:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-16 16:41 Matthias Fischer
2019-04-17 9:31 ` Michael Tremer [this message]
2019-04-17 21:49 ` Aw: " Bernhard Bitsch
2019-04-18 9:50 ` Michael Tremer
2019-04-18 11:23 ` Aw: " Bernhard Bitsch
2019-04-18 11:42 ` Michael Tremer
2019-04-18 12:54 ` Aw: " Bernhard Bitsch
2019-04-18 12:59 ` Bernhard Bitsch
2019-04-18 14:47 ` [PATCH] " Michael Tremer
2019-04-18 20:37 ` Aw: " Bernhard Bitsch
2019-04-20 16:35 ` Michael Tremer
2019-05-17 10:58 ` Aw: " Bernhard Bitsch
2019-05-17 19:18 ` Michael Tremer
2019-05-17 22:21 ` Aw: " Bernhard Bitsch
2019-05-17 22:27 ` Michael Tremer
2019-05-18 18:28 ` Aw: " Bernhard Bitsch
2019-05-20 9:37 ` Michael Tremer
2019-05-20 14:21 ` Aw: " Bernhard Bitsch
2019-05-20 16:03 ` Tom Rymes
2019-05-20 16:42 ` Aw: Re: Re: [PATCH] Fix for Bug #12050: Adding fixed leases with one 'add' click / Bug #10629 Bernhard Bitsch
2019-05-20 16:49 ` Tom Rymes
2019-05-20 19:13 ` Aw: " Bernhard Bitsch
2019-05-20 20:27 ` Aw: Re: [PATCH] Fix for Bug #12050: Adding fixed leases with one 'add' click Bernhard Bitsch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0ADEAEA1-EB9C-4A08-9FDE-23438ECFCEC6@ipfire.org \
--to=michael.tremer@ipfire.org \
--cc=development@lists.ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox