]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - config/forwardfw/firewall-lib.pl
Merge remote-tracking branch 'ms/firewall-new' into firewall
[people/teissler/ipfire-2.x.git] / config / forwardfw / firewall-lib.pl
index 44c0079b7c383ec28a103772d6a47d0ad9564f12..a1f96ba40ff1af290ce90a14bc7f52bc5f165ce6 100755 (executable)
@@ -68,7 +68,7 @@ my $field;
 sub get_srv_prot
 {
        my $val=shift;
-       foreach my $key (sort keys %customservice){
+       foreach my $key (sort {$a <=> $b} keys %customservice){
                if($customservice{$key}[0] eq $val){
                        if ($customservice{$key}[0] eq $val){
                                return $customservice{$key}[2];
@@ -83,7 +83,7 @@ sub get_srvgrp_prot
        my $tcp;
        my $udp;
        my $icmp;
-       foreach my $key (sort keys %customservicegrp){
+       foreach my $key (sort {$a <=> $b} keys %customservicegrp){
                if($customservicegrp{$key}[0] eq $val){
                        if (&get_srv_prot($customservicegrp{$key}[2]) eq 'TCP'){ 
                                $tcp=1;
@@ -108,7 +108,7 @@ sub get_srv_port
        my $val=shift;
        my $field=shift;
        my $prot=shift;
-       foreach my $key (sort keys %customservice){
+       foreach my $key (sort {$a <=> $b} keys %customservice){
                if($customservice{$key}[0] eq $val){
                        if($customservice{$key}[2] eq $prot){
                                return $customservice{$key}[$field];
@@ -123,7 +123,7 @@ sub get_srvgrp_port
        my $back;
        my $value;
        my @ips=();
-       foreach my $key (sort keys %customservicegrp){
+       foreach my $key (sort {$a <=> $b} keys %customservicegrp){
                if($customservicegrp{$key}[0] eq $val){
                        if ($prot ne 'ICMP'){
                                $value=&get_srv_port($customservicegrp{$key}[2],1,$prot);
@@ -146,7 +146,7 @@ sub get_ipsec_net_ip
 {
        my $val=shift;
        my $field=shift;
-       foreach my $key (sort keys %ipsecconf){
+       foreach my $key (sort {$a <=> $b} keys %ipsecconf){
                if($ipsecconf{$key}[1] eq $val){
                        return $ipsecconf{$key}[$field];
                }
@@ -156,7 +156,7 @@ sub get_ipsec_host_ip
 {
        my $val=shift;
        my $field=shift;
-       foreach my $key (sort keys %ipsecconf){
+       foreach my $key (sort {$a <=> $b} keys %ipsecconf){
                if($ipsecconf{$key}[1] eq $val){
                        return $ipsecconf{$key}[$field];
                }
@@ -166,7 +166,7 @@ sub get_ovpn_n2n_ip
 {
        my $val=shift;
        my $field=shift;
-       foreach my $key (sort keys %ccdhost){
+       foreach my $key (sort {$a <=> $b} keys %ccdhost){
                if($ccdhost{$key}[1] eq $val){
                        return $ccdhost{$key}[$field];
                }
@@ -176,7 +176,7 @@ sub get_ovpn_host_ip
 {
        my $val=shift;
        my $field=shift;
-       foreach my $key (sort keys %ccdhost){
+       foreach my $key (sort {$a <=> $b} keys %ccdhost){
                if($ccdhost{$key}[1] eq $val){
                        return $ccdhost{$key}[$field];
                }
@@ -187,7 +187,7 @@ sub get_ovpn_net_ip
        
        my $val=shift;
        my $field=shift;
-       foreach my $key (sort keys %ccdnet){
+       foreach my $key (sort {$a <=> $b} keys %ccdnet){
                if($ccdnet{$key}[0] eq $val){
                        return $ccdnet{$key}[$field];
                }
@@ -197,7 +197,7 @@ sub get_grp_ip
 {
        my $val=shift;
        my $src=shift;
-       foreach my $key (sort keys %customgrp){
+       foreach my $key (sort {$a <=> $b} keys %customgrp){
                if ($customgrp{$key}[0] eq $val){
                        &get_address($customgrp{$key}[3],$src);
                }
@@ -207,6 +207,7 @@ sub get_grp_ip
 sub get_std_net_ip
 {
        my $val=shift;
+       my $con=shift;
        if ($val eq 'ALL'){
                return "0.0.0.0/0.0.0.0";
        }elsif($val eq 'GREEN'){
@@ -216,17 +217,19 @@ sub get_std_net_ip
        }elsif($val eq 'BLUE'){
                return "$netsettings{'BLUE_NETADDRESS'}/$netsettings{'BLUE_NETMASK'}";
        }elsif($val eq 'RED'){
-               return "0.0.0.0/0 -o red0";
+               return "0.0.0.0/0 -o $con";
        }elsif($val =~ /OpenVPN/i){
                return "$ovpnsettings{'DOVPN_SUBNET'}";
        }elsif($val =~ /IPsec/i){
                return "$ipsecsettings{'RW_NET'}";
+       }elsif($val eq 'IPFire'){
+               return ;
        }
 }
 sub get_net_ip
 {
        my $val=shift;
-       foreach my $key (sort keys %customnetwork){
+       foreach my $key (sort {$a <=> $b} keys %customnetwork){
                if($customnetwork{$key}[0] eq $val){
                        return "$customnetwork{$key}[1]/$customnetwork{$key}[2]";
                }  
@@ -236,7 +239,7 @@ sub get_host_ip
 {
        my $val=shift;
        my $src=shift;
-       foreach my $key (sort keys %customhost){
+       foreach my $key (sort {$a <=> $b} keys %customhost){
                if($customhost{$key}[0] eq $val){
                        if ($customhost{$key}[1] eq 'mac' && $src eq 'src'){
                        return "-m mac --mac-source $customhost{$key}[2]";