From: Michael Tremer <michael.tremer@ipfire.org>
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 [thread overview]
Message-ID: <1445010874.18375.82.camel@ipfire.org> (raw)
In-Reply-To: <1444982254-5340-1-git-send-email-alexander.marx@ipfire.org>
[-- Attachment #1: Type: text/plain, Size: 1137 bytes --]
On Fri, 2015-10-16 at 09:57 +0200, Alexander Marx wrote:
> Signed-off-by: Alexander Marx <alexander.marx(a)ipfire.org>
> ---
> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-10-16 15:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-16 7:57 Alexander Marx
2015-10-16 15:54 ` Michael Tremer [this message]
[not found] <56213868.1020004@oab.de>
2015-10-16 20:56 ` Michael Tremer
2015-10-17 17:27 Alexander Marx
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=1445010874.18375.82.camel@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