On Fri, 2015-10-16 at 09:57 +0200, Alexander Marx wrote:
Signed-off-by: Alexander Marx alexander.marx@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