BUG11466: Fix broken function check_net_internal_exact. Fixes #11466

Message ID 1508924548-9876-1-git-send-email-alexander.marx@ipfire.org
State Dropped
Headers
Series BUG11466: Fix broken function check_net_internal_exact. Fixes #11466 |

Commit Message

Alexander Marx Oct. 25, 2017, 8:42 p.m. UTC
  The check_net_internal_exact function needs subnetmask in cidr notation to work.
Routing.cgi was also updated to use this function.
---
 config/cfgroot/general-functions.pl | 8 ++++----
 html/cgi-bin/routing.cgi            | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
  

Comments

Tom Rymes Oct. 25, 2017, 9:50 p.m. UTC | #1
Alexander,

Will this also fix the behavior seen in bug 11235?

https://bugzilla.ipfire.org/show_bug.cgi?id=11235

Tom

> On Oct 25, 2017, at 5:42 AM, Alexander Marx <alexander.marx@ipfire.org> wrote:
> 
> The check_net_internal_exact function needs subnetmask in cidr notation to work.
> Routing.cgi was also updated to use this function.
> ---
> config/cfgroot/general-functions.pl | 8 ++++----
> html/cgi-bin/routing.cgi            | 2 +-
> 2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl
> index 0577afe..024285e 100644
> --- a/config/cfgroot/general-functions.pl
> +++ b/config/cfgroot/general-functions.pl
> @@ -579,10 +579,10 @@ sub check_net_internal_exact{
>    $cidr=&iporsubtocidr($cidr);
>    #check if we use one of ipfire's networks (green,orange,blue)
>    &readhash("${General::swroot}/ethernet/settings", \%ownnet);
> -    if (($ownnet{'GREEN_NETADDRESS'}      ne '' && $ownnet{'GREEN_NETADDRESS'}    ne '0.0.0.0') && &Network::network_equal("$ownnet{'GREEN_NETADDRESS'}/$ownnet{'GREEN_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err green'};return $errormessage;}
> -    if (($ownnet{'ORANGE_NETADDRESS'}    ne '' && $ownnet{'ORANGE_NETADDRESS'}     ne '0.0.0.0') && &Network::network_equal("$ownnet{'ORANGE_NETADDRESS'}/$ownnet{'ORANGE_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err orange'};return $errormessage;}
> -    if (($ownnet{'BLUE_NETADDRESS'}    ne '' && $ownnet{'BLUE_NETADDRESS'}    ne '0.0.0.0') && &Network::network_equal("$ownnet{'BLUE_NETADDRESS'}/$ownnet{'BLUE_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err blue'};return $errormessage;}
> -    if (($ownnet{'RED_NETADDRESS'}        ne '' && $ownnet{'RED_NETADDRESS'}        ne '0.0.0.0') && &Network::network_equal("$ownnet{'RED_NETADDRESS'}/$ownnet{'RED_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err red'};return $errormessage;}
> +    if (($ownnet{'GREEN_NETADDRESS'}      ne '' && $ownnet{'GREEN_NETADDRESS'}    ne '0.0.0.0') && &Network::network_equal("$ownnet{'GREEN_NETADDRESS'}/".&iporsubtocidr($ownnet{'GREEN_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err green'};return $errormessage;}
> +    if (($ownnet{'ORANGE_NETADDRESS'}    ne '' && $ownnet{'ORANGE_NETADDRESS'}     ne '0.0.0.0') && &Network::network_equal("$ownnet{'ORANGE_NETADDRESS'}/".&iporsubtocidr($ownnet{'ORANGE_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err orange'};return $errormessage;}
> +    if (($ownnet{'BLUE_NETADDRESS'}    ne '' && $ownnet{'BLUE_NETADDRESS'}    ne '0.0.0.0') && &Network::network_equal("$ownnet{'BLUE_NETADDRESS'}/".&iporsubtocidr($ownnet{'BLUE_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err blue'};return $errormessage;}
> +    if (($ownnet{'RED_NETADDRESS'}        ne '' && $ownnet{'RED_NETADDRESS'}        ne '0.0.0.0') && &Network::network_equal("$ownnet{'RED_NETADDRESS'}/".&iporsubtocidr($ownnet{'RED_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err red'};return $errormessage;}
> }
> 
> sub validport
> diff --git a/html/cgi-bin/routing.cgi b/html/cgi-bin/routing.cgi
> index 15989bd..f2014e2 100644
> --- a/html/cgi-bin/routing.cgi
> +++ b/html/cgi-bin/routing.cgi
> @@ -154,7 +154,7 @@ if ($settings{'ACTION'} eq $Lang::tr{'add'}) {
>            last;
>        }
>        #Is the network part of an internal network?
> -        $errormessage .= &General::check_net_internal($settings{'IP'});
> +        $errormessage .= &General::check_net_internal_exact($settings{'IP'});
>        last;
>    }
> 
> -- 
> 2.7.4
>
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Alexander,</div><div><br></div><div>Will this also fix the behavior seen in bug 11235?</div><div><br></div><div><a href="https://bugzilla.ipfire.org/show_bug.cgi?id=11235">https://bugzilla.ipfire.org/show_bug.cgi?id=11235</a></div><div><br></div><div>Tom</div><div><br>On Oct 25, 2017, at 5:42 AM, Alexander Marx &lt;<a href="mailto:alexander.marx@ipfire.org">alexander.marx@ipfire.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><span>The check_net_internal_exact function needs subnetmask in cidr notation to work.</span><br><span>Routing.cgi was also updated to use this function.</span><br><span>---</span><br><span> config/cfgroot/general-functions.pl | 8 ++++----</span><br><span> html/cgi-bin/routing.cgi &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 2 +-</span><br><span> 2 files changed, 5 insertions(+), 5 deletions(-)</span><br><span></span><br><span>diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl</span><br><span>index 0577afe..024285e 100644</span><br><span>--- a/config/cfgroot/general-functions.pl</span><br><span>+++ b/config/cfgroot/general-functions.pl</span><br><span>@@ -579,10 +579,10 @@ sub check_net_internal_exact{</span><br><span>  &nbsp; &nbsp;$cidr=&amp;iporsubtocidr($cidr);</span><br><span>  &nbsp; &nbsp;#check if we use one of ipfire's networks (green,orange,blue)</span><br><span>  &nbsp; &nbsp;&amp;readhash("${General::swroot}/ethernet/settings", \%ownnet);</span><br><span>- &nbsp; &nbsp;if (($ownnet{'GREEN_NETADDRESS'} &nbsp; &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'GREEN_NETADDRESS'}  &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'GREEN_NETADDRESS'}/$ownnet{'GREEN_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err green'};return $errormessage;}</span><br><span>- &nbsp; &nbsp;if (($ownnet{'ORANGE_NETADDRESS'} &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'ORANGE_NETADDRESS'}  &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'ORANGE_NETADDRESS'}/$ownnet{'ORANGE_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err orange'};return $errormessage;}</span><br><span>- &nbsp; &nbsp;if (($ownnet{'BLUE_NETADDRESS'}  &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'BLUE_NETADDRESS'}  &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'BLUE_NETADDRESS'}/$ownnet{'BLUE_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err blue'};return $errormessage;}</span><br><span>- &nbsp; &nbsp;if (($ownnet{'RED_NETADDRESS'}  &nbsp; &nbsp; &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'RED_NETADDRESS'}  &nbsp; &nbsp; &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'RED_NETADDRESS'}/$ownnet{'RED_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err red'};return $errormessage;}</span><br><span>+ &nbsp; &nbsp;if (($ownnet{'GREEN_NETADDRESS'} &nbsp; &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'GREEN_NETADDRESS'}  &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'GREEN_NETADDRESS'}/".&amp;iporsubtocidr($ownnet{'GREEN_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err green'};return $errormessage;}</span><br><span>+ &nbsp; &nbsp;if (($ownnet{'ORANGE_NETADDRESS'} &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'ORANGE_NETADDRESS'}  &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'ORANGE_NETADDRESS'}/".&amp;iporsubtocidr($ownnet{'ORANGE_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err orange'};return $errormessage;}</span><br><span>+ &nbsp; &nbsp;if (($ownnet{'BLUE_NETADDRESS'}  &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'BLUE_NETADDRESS'}  &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'BLUE_NETADDRESS'}/".&amp;iporsubtocidr($ownnet{'BLUE_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err blue'};return $errormessage;}</span><br><span>+ &nbsp; &nbsp;if (($ownnet{'RED_NETADDRESS'}  &nbsp; &nbsp; &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'RED_NETADDRESS'}  &nbsp; &nbsp; &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'RED_NETADDRESS'}/".&amp;iporsubtocidr($ownnet{'RED_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err red'};return $errormessage;}</span><br><span> }</span><br><span></span><br><span> sub validport</span><br><span>diff --git a/html/cgi-bin/routing.cgi b/html/cgi-bin/routing.cgi</span><br><span>index 15989bd..f2014e2 100644</span><br><span>--- a/html/cgi-bin/routing.cgi</span><br><span>+++ b/html/cgi-bin/routing.cgi</span><br><span>@@ -154,7 +154,7 @@ if ($settings{'ACTION'} eq $Lang::tr{'add'}) {</span><br><span>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;last;</span><br><span>  &nbsp; &nbsp; &nbsp; &nbsp;}</span><br><span>  &nbsp; &nbsp; &nbsp; &nbsp;#Is the network part of an internal network?</span><br><span>- &nbsp; &nbsp; &nbsp; &nbsp;$errormessage .= &amp;General::check_net_internal($settings{'IP'});</span><br><span>+ &nbsp; &nbsp; &nbsp; &nbsp;$errormessage .= &amp;General::check_net_internal_exact($settings{'IP'});</span><br><span>  &nbsp; &nbsp; &nbsp; &nbsp;last;</span><br><span>  &nbsp; &nbsp;}</span><br><span></span><br><span>-- </span><br><span>2.7.4</span><br><span></span><br></div></blockquote></body></html>
  
Tom Rymes Oct. 25, 2017, 9:52 p.m. UTC | #2
Never mind, I sent before reading the notes. Sorry about that.

Tom

> On Oct 25, 2017, at 6:50 AM, Tom Rymes <trymes@rymes.com> wrote:
> 
> Alexander,
> 
> Will this also fix the behavior seen in bug 11235?
> 
> https://bugzilla.ipfire.org/show_bug.cgi?id=11235
> 
> Tom
> 
>> On Oct 25, 2017, at 5:42 AM, Alexander Marx <alexander.marx@ipfire.org> wrote:
>> 
>> The check_net_internal_exact function needs subnetmask in cidr notation to work.
>> Routing.cgi was also updated to use this function.
>> ---
>> config/cfgroot/general-functions.pl | 8 ++++----
>> html/cgi-bin/routing.cgi            | 2 +-
>> 2 files changed, 5 insertions(+), 5 deletions(-)
>> 
>> diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl
>> index 0577afe..024285e 100644
>> --- a/config/cfgroot/general-functions.pl
>> +++ b/config/cfgroot/general-functions.pl
>> @@ -579,10 +579,10 @@ sub check_net_internal_exact{
>>    $cidr=&iporsubtocidr($cidr);
>>    #check if we use one of ipfire's networks (green,orange,blue)
>>    &readhash("${General::swroot}/ethernet/settings", \%ownnet);
>> -    if (($ownnet{'GREEN_NETADDRESS'}      ne '' && $ownnet{'GREEN_NETADDRESS'}    ne '0.0.0.0') && &Network::network_equal("$ownnet{'GREEN_NETADDRESS'}/$ownnet{'GREEN_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err green'};return $errormessage;}
>> -    if (($ownnet{'ORANGE_NETADDRESS'}    ne '' && $ownnet{'ORANGE_NETADDRESS'}    ne '0.0.0.0') && &Network::network_equal("$ownnet{'ORANGE_NETADDRESS'}/$ownnet{'ORANGE_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err orange'};return $errormessage;}
>> -    if (($ownnet{'BLUE_NETADDRESS'}    ne '' && $ownnet{'BLUE_NETADDRESS'}    ne '0.0.0.0') && &Network::network_equal("$ownnet{'BLUE_NETADDRESS'}/$ownnet{'BLUE_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err blue'};return $errormessage;}
>> -    if (($ownnet{'RED_NETADDRESS'}        ne '' && $ownnet{'RED_NETADDRESS'}        ne '0.0.0.0') && &Network::network_equal("$ownnet{'RED_NETADDRESS'}/$ownnet{'RED_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err red'};return $errormessage;}
>> +    if (($ownnet{'GREEN_NETADDRESS'}      ne '' && $ownnet{'GREEN_NETADDRESS'}    ne '0.0.0.0') && &Network::network_equal("$ownnet{'GREEN_NETADDRESS'}/".&iporsubtocidr($ownnet{'GREEN_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err green'};return $errormessage;}
>> +    if (($ownnet{'ORANGE_NETADDRESS'}    ne '' && $ownnet{'ORANGE_NETADDRESS'}    ne '0.0.0.0') && &Network::network_equal("$ownnet{'ORANGE_NETADDRESS'}/".&iporsubtocidr($ownnet{'ORANGE_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err orange'};return $errormessage;}
>> +    if (($ownnet{'BLUE_NETADDRESS'}    ne '' && $ownnet{'BLUE_NETADDRESS'}    ne '0.0.0.0') && &Network::network_equal("$ownnet{'BLUE_NETADDRESS'}/".&iporsubtocidr($ownnet{'BLUE_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err blue'};return $errormessage;}
>> +    if (($ownnet{'RED_NETADDRESS'}        ne '' && $ownnet{'RED_NETADDRESS'}        ne '0.0.0.0') && &Network::network_equal("$ownnet{'RED_NETADDRESS'}/".&iporsubtocidr($ownnet{'RED_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err red'};return $errormessage;}
>> }
>> 
>> sub validport
>> diff --git a/html/cgi-bin/routing.cgi b/html/cgi-bin/routing.cgi
>> index 15989bd..f2014e2 100644
>> --- a/html/cgi-bin/routing.cgi
>> +++ b/html/cgi-bin/routing.cgi
>> @@ -154,7 +154,7 @@ if ($settings{'ACTION'} eq $Lang::tr{'add'}) {
>>            last;
>>        }
>>        #Is the network part of an internal network?
>> -        $errormessage .= &General::check_net_internal($settings{'IP'});
>> +        $errormessage .= &General::check_net_internal_exact($settings{'IP'});
>>        last;
>>    }
>> 
>> -- 
>> 2.7.4
>>
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Never mind, I sent before reading the notes. Sorry about that.</div><div><br></div><div>Tom</div><div><br>On Oct 25, 2017, at 6:50 AM, Tom Rymes &lt;<a href="mailto:trymes@rymes.com">trymes@rymes.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div></div><div>Alexander,</div><div><br></div><div>Will this also fix the behavior seen in bug 11235?</div><div><br></div><div><a href="https://bugzilla.ipfire.org/show_bug.cgi?id=11235">https://bugzilla.ipfire.org/show_bug.cgi?id=11235</a></div><div><br></div><div>Tom</div><div><br>On Oct 25, 2017, at 5:42 AM, Alexander Marx &lt;<a href="mailto:alexander.marx@ipfire.org">alexander.marx@ipfire.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><span>The check_net_internal_exact function needs subnetmask in cidr notation to work.</span><br><span>Routing.cgi was also updated to use this function.</span><br><span>---</span><br><span> config/cfgroot/general-functions.pl | 8 ++++----</span><br><span> html/cgi-bin/routing.cgi &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 2 +-</span><br><span> 2 files changed, 5 insertions(+), 5 deletions(-)</span><br><span></span><br><span>diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl</span><br><span>index 0577afe..024285e 100644</span><br><span>--- a/config/cfgroot/general-functions.pl</span><br><span>+++ b/config/cfgroot/general-functions.pl</span><br><span>@@ -579,10 +579,10 @@ sub check_net_internal_exact{</span><br><span>  &nbsp; &nbsp;$cidr=&amp;iporsubtocidr($cidr);</span><br><span>  &nbsp; &nbsp;#check if we use one of ipfire's networks (green,orange,blue)</span><br><span>  &nbsp; &nbsp;&amp;readhash("${General::swroot}/ethernet/settings", \%ownnet);</span><br><span>- &nbsp; &nbsp;if (($ownnet{'GREEN_NETADDRESS'} &nbsp; &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'GREEN_NETADDRESS'}  &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'GREEN_NETADDRESS'}/$ownnet{'GREEN_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err green'};return $errormessage;}</span><br><span>- &nbsp; &nbsp;if (($ownnet{'ORANGE_NETADDRESS'} &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'ORANGE_NETADDRESS'}  &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'ORANGE_NETADDRESS'}/$ownnet{'ORANGE_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err orange'};return $errormessage;}</span><br><span>- &nbsp; &nbsp;if (($ownnet{'BLUE_NETADDRESS'}  &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'BLUE_NETADDRESS'}  &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'BLUE_NETADDRESS'}/$ownnet{'BLUE_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err blue'};return $errormessage;}</span><br><span>- &nbsp; &nbsp;if (($ownnet{'RED_NETADDRESS'}  &nbsp; &nbsp; &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'RED_NETADDRESS'}  &nbsp; &nbsp; &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'RED_NETADDRESS'}/$ownnet{'RED_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err red'};return $errormessage;}</span><br><span>+ &nbsp; &nbsp;if (($ownnet{'GREEN_NETADDRESS'} &nbsp; &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'GREEN_NETADDRESS'}  &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'GREEN_NETADDRESS'}/".&amp;iporsubtocidr($ownnet{'GREEN_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err green'};return $errormessage;}</span><br><span>+ &nbsp; &nbsp;if (($ownnet{'ORANGE_NETADDRESS'} &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'ORANGE_NETADDRESS'}  &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'ORANGE_NETADDRESS'}/".&amp;iporsubtocidr($ownnet{'ORANGE_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err orange'};return $errormessage;}</span><br><span>+ &nbsp; &nbsp;if (($ownnet{'BLUE_NETADDRESS'}  &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'BLUE_NETADDRESS'}  &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'BLUE_NETADDRESS'}/".&amp;iporsubtocidr($ownnet{'BLUE_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err blue'};return $errormessage;}</span><br><span>+ &nbsp; &nbsp;if (($ownnet{'RED_NETADDRESS'}  &nbsp; &nbsp; &nbsp; &nbsp;ne '' &amp;&amp; $ownnet{'RED_NETADDRESS'}  &nbsp; &nbsp; &nbsp; &nbsp;ne '0.0.0.0') &amp;&amp; &amp;Network::network_equal("$ownnet{'RED_NETADDRESS'}/".&amp;iporsubtocidr($ownnet{'RED_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err red'};return $errormessage;}</span><br><span> }</span><br><span></span><br><span> sub validport</span><br><span>diff --git a/html/cgi-bin/routing.cgi b/html/cgi-bin/routing.cgi</span><br><span>index 15989bd..f2014e2 100644</span><br><span>--- a/html/cgi-bin/routing.cgi</span><br><span>+++ b/html/cgi-bin/routing.cgi</span><br><span>@@ -154,7 +154,7 @@ if ($settings{'ACTION'} eq $Lang::tr{'add'}) {</span><br><span>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;last;</span><br><span>  &nbsp; &nbsp; &nbsp; &nbsp;}</span><br><span>  &nbsp; &nbsp; &nbsp; &nbsp;#Is the network part of an internal network?</span><br><span>- &nbsp; &nbsp; &nbsp; &nbsp;$errormessage .= &amp;General::check_net_internal($settings{'IP'});</span><br><span>+ &nbsp; &nbsp; &nbsp; &nbsp;$errormessage .= &amp;General::check_net_internal_exact($settings{'IP'});</span><br><span>  &nbsp; &nbsp; &nbsp; &nbsp;last;</span><br><span>  &nbsp; &nbsp;}</span><br><span></span><br><span>-- </span><br><span>2.7.4</span><br><span></span><br></div></blockquote></div></blockquote></body></html>
  

Patch

diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl
index 0577afe..024285e 100644
--- a/config/cfgroot/general-functions.pl
+++ b/config/cfgroot/general-functions.pl
@@ -579,10 +579,10 @@  sub check_net_internal_exact{
 	$cidr=&iporsubtocidr($cidr);
 	#check if we use one of ipfire's networks (green,orange,blue)
 	&readhash("${General::swroot}/ethernet/settings", \%ownnet);
-	if (($ownnet{'GREEN_NETADDRESS'}  	ne '' && $ownnet{'GREEN_NETADDRESS'} 	ne '0.0.0.0') && &Network::network_equal("$ownnet{'GREEN_NETADDRESS'}/$ownnet{'GREEN_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err green'};return $errormessage;}
-	if (($ownnet{'ORANGE_NETADDRESS'}	ne '' && $ownnet{'ORANGE_NETADDRESS'} 	ne '0.0.0.0') && &Network::network_equal("$ownnet{'ORANGE_NETADDRESS'}/$ownnet{'ORANGE_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err orange'};return $errormessage;}
-	if (($ownnet{'BLUE_NETADDRESS'} 	ne '' && $ownnet{'BLUE_NETADDRESS'} 	ne '0.0.0.0') && &Network::network_equal("$ownnet{'BLUE_NETADDRESS'}/$ownnet{'BLUE_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err blue'};return $errormessage;}
-	if (($ownnet{'RED_NETADDRESS'} 		ne '' && $ownnet{'RED_NETADDRESS'} 		ne '0.0.0.0') && &Network::network_equal("$ownnet{'RED_NETADDRESS'}/$ownnet{'RED_NETMASK'}", $network)){ $errormessage=$Lang::tr{'ccd err red'};return $errormessage;}
+	if (($ownnet{'GREEN_NETADDRESS'}  	ne '' && $ownnet{'GREEN_NETADDRESS'} 	ne '0.0.0.0') && &Network::network_equal("$ownnet{'GREEN_NETADDRESS'}/".&iporsubtocidr($ownnet{'GREEN_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err green'};return $errormessage;}
+	if (($ownnet{'ORANGE_NETADDRESS'}	ne '' && $ownnet{'ORANGE_NETADDRESS'} 	ne '0.0.0.0') && &Network::network_equal("$ownnet{'ORANGE_NETADDRESS'}/".&iporsubtocidr($ownnet{'ORANGE_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err orange'};return $errormessage;}
+	if (($ownnet{'BLUE_NETADDRESS'} 	ne '' && $ownnet{'BLUE_NETADDRESS'} 	ne '0.0.0.0') && &Network::network_equal("$ownnet{'BLUE_NETADDRESS'}/".&iporsubtocidr($ownnet{'BLUE_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err blue'};return $errormessage;}
+	if (($ownnet{'RED_NETADDRESS'} 		ne '' && $ownnet{'RED_NETADDRESS'} 		ne '0.0.0.0') && &Network::network_equal("$ownnet{'RED_NETADDRESS'}/".&iporsubtocidr($ownnet{'RED_NETMASK'}), $network)){ $errormessage=$Lang::tr{'ccd err red'};return $errormessage;}
 }
 
 sub validport
diff --git a/html/cgi-bin/routing.cgi b/html/cgi-bin/routing.cgi
index 15989bd..f2014e2 100644
--- a/html/cgi-bin/routing.cgi
+++ b/html/cgi-bin/routing.cgi
@@ -154,7 +154,7 @@  if ($settings{'ACTION'} eq $Lang::tr{'add'}) {
 			last;
 		}
 		#Is the network part of an internal network?
-		$errormessage .= &General::check_net_internal($settings{'IP'});
+		$errormessage .= &General::check_net_internal_exact($settings{'IP'});
 		last;
 	}