From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: development@lists.ipfire.org Subject: Re: [PATCH] BUG10941: fix single ip-addresses when no subnet given Date: Fri, 16 Oct 2015 16:54:34 +0100 Message-ID: <1445010874.18375.82.camel@ipfire.org> In-Reply-To: <1444982254-5340-1-git-send-email-alexander.marx@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7963553976037918121==" List-Id: --===============7963553976037918121== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On Fri, 2015-10-16 at 09:57 +0200, Alexander Marx wrote: > Signed-off-by: Alexander Marx > --- > html/cgi-bin/routing.cgi | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/html/cgi-bin/routing.cgi b/html/cgi-bin/routing.cgi > index c460a74..3b5a2f7 100644 > --- a/html/cgi-bin/routing.cgi > +++ b/html/cgi-bin/routing.cgi > @@ -118,6 +118,11 @@ if ($settings{'ACTION'} eq $Lang::tr{'toggle > enable disable'}) { > } > > if ($settings{'ACTION'} eq $Lang::tr{'add'}) { > + > + if (!&Network::check_prefix($settings{'IP'})){ > + $settings{'IP'} .= '/32'; > + } > + This won't work. The function &Network::check_prefix() takes the prefix (i.e. the number after the slash, e.g. 24). You are passing the IP address to the function which will never be a valid prefix and /32 will always be appended, even to valid inputs like 192.168.0.0/24 (result: 192.168.0.0/24/32). > # Convert subnet masks to CIDR notation. > $settings{'IP'} = &General::iporsubtocidr($settings{'IP'}); > The remaining code should be amended that only prefixes are allowed when /32 is appended to hosts. -Michael --===============7963553976037918121== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjEKCmlRSWNCQUFC Q2dBR0JRSldJUjI2QUFvSkVJQjU4UDl2a0FrSGVVVVAvaWZuV2FHd2F2NHhGbGk1QllLVlJmUE4K b0FKYm1Udm5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