]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - config/firewall/rules.pl
523f6e3422c28cadf746284f9928b729ce8217aa
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2013 Alexander Marx <amarx@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
25 require '/var/ipfire/general-functions.pl' ;
26 require "${General::swroot}/lang.pl" ;
27 require "/usr/lib/firewall/firewall-lib.pl" ;
29 # Set to one to enable debugging mode.
32 my $IPTABLES = "iptables --wait" ;
35 my $CHAIN = "FORWARDFW" ;
36 my $CHAIN_NAT_SOURCE = "NAT_SOURCE" ;
37 my $CHAIN_NAT_DESTINATION = "NAT_DESTINATION" ;
40 my %defaultNetworks =();
50 my %configoutgoingfw =();
56 my $configfwdfw = "${General::swroot}/firewall/config" ;
57 my $configinput = "${General::swroot}/firewall/input" ;
58 my $configoutgoing = "${General::swroot}/firewall/outgoing" ;
59 my $p2pfile = "${General::swroot}/firewall/p2protocols" ;
60 my $configgrp = "${General::swroot}/fwhosts/customgroups" ;
61 my $netsettings = "${General::swroot}/ethernet/settings" ;
62 my $errormessage = '' ;
66 my ( $TYPE , $PROT , $SPROT , $DPROT , $SPORT , $DPORT , $SRC_TGT );
67 my $conexists = 'off' ;
71 & General
:: readhash
( "${General::swroot}/firewall/settings" , \
%fwdfwsettings );
72 & General
:: readhash
( " $netsettings " , \
%defaultNetworks );
73 & General
:: readhasharray
( $configfwdfw , \
%configfwdfw );
74 & General
:: readhasharray
( $configinput , \
%configinputfw );
75 & General
:: readhasharray
( $configoutgoing , \
%configoutgoingfw );
76 & General
:: readhasharray
( $configgrp , \
%customgrp );
77 & General
:: get_aliases
( \
%aliases );
79 #check if we have an internetconnection
80 open ( CONN
, "/var/ipfire/red/iface" );
84 if (- f
"/var/ipfire/red/active" ){
88 open ( CONN1
, "/var/ipfire/red/local-ipaddress" );
99 # Reload firewall rules.
102 # Load P2P block rules.
105 # Reload firewall policy.
106 run
( "/usr/sbin/firewall-policy" );
110 # Executes or prints the given shell command.
123 print STDERR
" $message \n " ;
127 run
( " $IPTABLES -F FORWARDFW" );
128 run
( " $IPTABLES -F INPUTFW" );
129 run
( " $IPTABLES -F OUTGOINGFW" );
130 run
( " $IPTABLES -t nat -F NAT_DESTINATION" );
131 run
( " $IPTABLES -t nat -F NAT_SOURCE" );
135 if (! - z
"${General::swroot}/firewall/config" ){
136 & buildrules
( \
%configfwdfw );
138 if (! - z
"${General::swroot}/firewall/input" ){
139 & buildrules
( \
%configinputfw );
141 if (! - z
"${General::swroot}/firewall/outgoing" ){
142 & buildrules
( \
%configoutgoingfw );
154 foreach my $key ( sort { $a <=> $b } keys % $hash ){
155 next if (($ $hash { $key }[ 6 ] eq 'RED' || $ $hash { $key }[ 6 ] eq 'RED1' ) && $conexists eq 'off' );
162 # Check if logging should be enabled.
164 if ($ $hash { $key }[ 17 ] eq 'ON' ) {
171 # Check if NAT is enabled and initialize variables, that we use for that.
172 if ($ $hash { $key }[ 28 ] eq 'ON' ) {
176 if ($ $hash { $key }[ 31 ] eq 'dnat' ) {
179 if ($ $hash { $key }[ 30 ] =~ /\|/ ) {
180 $ $hash { $key }[ 30 ]=~ tr/|/,/ ;
181 $fireport = '-m multiport --dport ' .$ $hash { $key }[ 30 ];
183 $fireport = '--dport ' .$ $hash { $key }[ 30 ] if ($ $hash { $key }[ 30 ]> 0 );
187 } elsif ($ $hash { $key }[ 31 ] eq 'snat' ) {
191 print_error
( "Invalid NAT mode: $ $hash { $key }[31]" );
195 $natip = & get_nat_ip
($ $hash { $key }[ 29 ], $NAT_MODE );
199 if ($ $hash { $key }[ 2 ] eq 'ON' ){
201 if ($ $hash { $key }[ 3 ] eq 'cust_grp_src' ){
202 foreach my $grp ( sort { $a <=> $b } keys %customgrp ){
203 if ( $customgrp { $grp }[ 0 ] eq $ $hash { $key }[ 4 ]){
204 & get_address
( $customgrp { $grp }[ 3 ], $customgrp { $grp }[ 2 ], "src" );
208 & get_address
($ $hash { $key }[ 3 ],$ $hash { $key }[ 4 ], "src" );
211 if ($ $hash { $key }[ 5 ] eq 'cust_grp_tgt' ){
212 foreach my $grp ( sort { $a <=> $b } keys %customgrp ){
213 if ( $customgrp { $grp }[ 0 ] eq $ $hash { $key }[ 6 ]){
214 & get_address
( $customgrp { $grp }[ 3 ], $customgrp { $grp }[ 2 ], "tgt" );
217 } elsif ($ $hash { $key }[ 5 ] eq 'ipfire' ){
218 if ($ $hash { $key }[ 6 ] eq 'GREEN' ){
219 $targethash { $key }[ 0 ]= $defaultNetworks { 'GREEN_ADDRESS' };
221 if ($ $hash { $key }[ 6 ] eq 'BLUE' ){
222 $targethash { $key }[ 0 ]= $defaultNetworks { 'BLUE_ADDRESS' };
224 if ($ $hash { $key }[ 6 ] eq 'ORANGE' ){
225 $targethash { $key }[ 0 ]= $defaultNetworks { 'ORANGE_ADDRESS' };
227 if ($ $hash { $key }[ 6 ] eq 'ALL' ){
228 $targethash { $key }[ 0 ]= '0.0.0.0/0' ;
230 if ($ $hash { $key }[ 6 ] eq 'RED' || $ $hash { $key }[ 6 ] eq 'RED1' ){
231 open ( FILE
, "/var/ipfire/red/local-ipaddress" ) or die "Couldn't open local-ipaddress" ;
232 $targethash { $key }[ 0 ]= < FILE
>;
235 foreach my $alias ( sort keys %aliases ){
236 if ($ $hash { $key }[ 6 ] eq $alias ){
237 $targethash { $key }[ 0 ]= $aliases { $alias }{ 'IPT' };
242 & get_address
($ $hash { $key }[ 5 ],$ $hash { $key }[ 6 ], "tgt" );
244 ##get source prot and port
246 $SPORT = & get_port
( $hash , $key );
249 ##get target prot and port
250 $DPROT =& get_prot
( $hash , $key );
252 if ( $DPROT eq '' ){ $DPROT = ' ' ;}
253 @DPROT = split ( "," , $DPROT );
256 if ($ $hash { $key }[ 18 ] eq 'ON' ){
257 my ( $time1 , $time2 , $daylight );
258 $daylight =$ $hash { $key }[ 28 ];
259 $time1 =& get_time
($ $hash { $key }[ 26 ], $daylight );
260 $time2 =& get_time
($ $hash { $key }[ 27 ], $daylight );
261 if ($ $hash { $key }[ 19 ] ne '' ){ push ( @timeframe , "Mon" );}
262 if ($ $hash { $key }[ 20 ] ne '' ){ push ( @timeframe , "Tue" );}
263 if ($ $hash { $key }[ 21 ] ne '' ){ push ( @timeframe , "Wed" );}
264 if ($ $hash { $key }[ 22 ] ne '' ){ push ( @timeframe , "Thu" );}
265 if ($ $hash { $key }[ 23 ] ne '' ){ push ( @timeframe , "Fri" );}
266 if ($ $hash { $key }[ 24 ] ne '' ){ push ( @timeframe , "Sat" );}
267 if ($ $hash { $key }[ 25 ] ne '' ){ push ( @timeframe , "Sun" );}
268 $TIME = join ( "," , @timeframe );
270 $TIMEFROM = "--timestart $time1 " ;
271 $TIMETILL = "--timestop $time2 " ;
272 $TIME = "-m time --weekdays $TIME $TIMEFROM $TIMETILL " ;
274 foreach my $DPROT ( @DPROT ){
275 $DPORT = & get_port
( $hash , $key , $DPROT );
277 $PROT = "-p $PROT " if ( $PROT ne '' && $PROT ne ' ' );
278 if ( $DPROT ne 'TCP' && $DPROT ne 'UDP' && $DPROT ne 'ICMP' ){
281 foreach my $a ( sort keys %sourcehash ){
282 foreach my $b ( sort keys %targethash ){
283 if (! $sourcehash { $a }[ 0 ] || ! $targethash { $b }[ 0 ] || ( $natip eq '-d ' && $NAT ) || (! $natip && $NAT )){
284 #Skip rules when no RED IP is set (DHCP,DSL)
287 next if ( $targethash { $b }[ 0 ] eq 'none' );
289 if ( $sourcehash { $a }[ 0 ] ne $targethash { $b }[ 0 ] && $targethash { $b }[ 0 ] ne 'none' || $sourcehash { $a }[ 0 ] eq '0.0.0.0/0.0.0.0' ){
291 if ( substr ( $sourcehash { $a }[ 0 ], 3 , 3 ) ne 'mac' && $sourcehash { $a }[ 0 ] ne '' ){ $STAG = "-s" ;}
293 if ( substr ( $DPORT , 2 , 4 ) eq 'icmp' ){
294 my @icmprule = split ( "," , substr ( $DPORT , 12 ,));
296 $icmptype = "--icmp-type " ;
302 run
( " $IPTABLES -A $ $hash { $key }[1] $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $icmptype $_ $TIME -j LOG" );
304 run
( " $IPTABLES -A $ $hash { $key }[1] $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $icmptype $_ $TIME -j $ $hash { $key }[0]" );
306 #PROCESS DNAT RULE (Portforward)
307 } elsif ( $NAT && $NAT_MODE eq "DNAT" ) {
309 run
( " $IPTABLES -t nat -A $CHAIN_NAT_DESTINATION $PROT $STAG $sourcehash { $a }[0] $SPORT $natip $fireport $TIME -j LOG --log-prefix 'DNAT'" );
311 my ( $ip , $sub ) = split ( "/" , $targethash { $b }[ 0 ]);
312 #Process NAT with servicegroup used
313 if ($ $hash { $key }[ 14 ] eq 'cust_srvgrp' ) {
314 run
( " $IPTABLES -t nat -A $CHAIN_NAT_DESTINATION $PROT $STAG $sourcehash { $a }[0] $SPORT $natip $fireport $TIME -j DNAT --to-destination $ip $DPORT " );
315 $fwaccessdport = $DPORT ;
317 run
( " $IPTABLES -t nat -A $CHAIN_NAT_DESTINATION $PROT $STAG $sourcehash { $a }[0] $SPORT $natip $fireport $TIME -j DNAT --to-destination $ip $DPORT " );
320 $fwaccessdport = "--dport " . substr ( $DPORT , 1 ,);
321 } elsif (! $DPORT && $ $hash { $key }[ 30 ] ne '' ){
322 if ($ $hash { $key }[ 30 ]=~ m/|/i ){
323 $ $hash { $key }[ 30 ] =~ s/\|/,/g ;
324 $fwaccessdport = "-m multiport --dport $ $hash { $key }[30]" ;
326 $fwaccessdport = "--dport $ $hash { $key }[30]" ;
330 run
( " $IPTABLES -A FORWARDFW $PROT $STAG $sourcehash { $a }[0] -d $ip $fwaccessdport $TIME -j $ $hash { $key }[0]" );
333 } elsif ( $NAT && $NAT_MODE eq "SNAT" ) {
335 run
( " $IPTABLES -t nat -A $CHAIN_NAT_SOURCE $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $DPORT $TIME -j LOG --log-prefix 'SNAT'" );
337 run
( " $IPTABLES -t nat -A $CHAIN_NAT_SOURCE $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $DPORT $TIME -j SNAT --to-source $natip " );
339 #PROCESS EVERY OTHER RULE (If NOT ICMP, else the rule would be applied double)
340 if ( $PROT ne '-p ICMP' ){
342 run
( " $IPTABLES -A $ $hash { $key }[1] $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $DPORT $TIME -j LOG" );
344 run
( " $IPTABLES -A $ $hash { $key }[1] $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $DPORT $TIME -j $ $hash { $key }[0]" );
346 #PROCESS Prot ICMP and type = All ICMP-Types
347 if ( $PROT eq '-p ICMP' && $ $hash { $key }[ 9 ] eq 'All ICMP-Types' ){
349 run
( " $IPTABLES -A $ $hash { $key }[1] $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $DPORT $TIME -j LOG" );
351 run
( " $IPTABLES -A $ $hash { $key }[1] $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $DPORT $TIME -j $ $hash { $key }[0]" );
369 if ( $val eq 'RED' || $val eq 'GREEN' || $val eq 'ORANGE' || $val eq 'BLUE' ){
370 $result = $defaultNetworks { $val . '_ADDRESS' };
371 } elsif ( $val eq 'ALL' ){
373 } elsif ( $val eq 'Default IP' && $type eq "DNAT" ){
374 $result = '-d ' . $redip ;
375 } elsif ( $val eq 'Default IP' && $type eq "SNAT" ){
378 foreach my $al ( sort keys %aliases ){
379 if ( $val eq $al && $type eq "DNAT" ){
380 $result = '-d ' . $aliases { $al }{ 'IPT' };
381 } elsif ( $val eq $al && $type eq "SNAT" ){
382 $result = $aliases { $al }{ 'IPT' };
395 $minutes = & utcmin
( $val );
396 $ruletime = $minutes + & time_get_utc
( $val );
397 if ( $ruletime < 0 ){ $ruletime += 1440 ;}
398 if ( $ruletime > 1440 ){ $ruletime -= 1440 ;}
399 $time = sprintf " %02d : %02d " , $ruletime / 60 , $ruletime % 60 ;
404 # Calculates the UTCtime from a given time
406 my @localtime = localtime ( time );
407 my @gmtime = gmtime ( time );
408 my $diff = ( $gmtime [ 2 ]* 60 + $gmtime [ 1 ] %60 )-( $localtime [ 2 ]* 60 + $localtime [ 1 ] %60 );
414 my ( $hrs , $min ) = split ( ":" , $ruletime );
415 my $newtime = $hrs * 60 + $min ;
422 open ( FILE
, "< $p2pfile " ) or die "Unable to read $p2pfile " ;
425 my $CMD = "-m ipp2p" ;
426 foreach my $p2pentry ( sort @p2ps ) {
427 my @p2pline = split ( /\;/ , $p2pentry );
428 if ( $fwdfwsettings { 'POLICY' } eq 'MODE1' ) {
430 if ( " $p2pline [2]" eq "on" ) {
431 $P2PSTRING = " $P2PSTRING -- $p2pline [1]" ;
435 if ( " $p2pline [2]" eq "off" ) {
436 $P2PSTRING = " $P2PSTRING -- $p2pline [1]" ;
442 run
( " $IPTABLES -A FORWARDFW $CMD $P2PSTRING -j $DO " );
447 my $base = shift ; #source of checking ($configfwdfw{$key}[x] or groupkey
449 my $type = shift ; #src or tgt
456 my $key = & General
:: findhasharraykey
( $hash );
457 if ( $base eq 'src_addr' || $base eq 'tgt_addr' ){
458 if (& General
:: validmac
( $base2 )){
459 $ $hash { $key }[ 0 ] = "-m mac --mac-source $base2 " ;
461 $ $hash { $key }[ 0 ] = $base2 ;
463 } elsif ( $base eq 'std_net_src' || $base eq 'std_net_tgt' || $base eq 'Standard Network' ){
464 $ $hash { $key }[ 0 ]=& fwlib
:: get_std_net_ip
( $base2 , $con );
465 } elsif ( $base eq 'cust_net_src' || $base eq 'cust_net_tgt' || $base eq 'Custom Network' ){
466 $ $hash { $key }[ 0 ]=& fwlib
:: get_net_ip
( $base2 );
467 } elsif ( $base eq 'cust_host_src' || $base eq 'cust_host_tgt' || $base eq 'Custom Host' ){
468 $ $hash { $key }[ 0 ]=& fwlib
:: get_host_ip
( $base2 , $type );
469 } elsif ( $base eq 'ovpn_net_src' || $base eq 'ovpn_net_tgt' || $base eq 'OpenVPN static network' ){
470 $ $hash { $key }[ 0 ]=& fwlib
:: get_ovpn_net_ip
( $base2 , 1 );
471 } elsif ( $base eq 'ovpn_host_src' || $base eq 'ovpn_host_tgt' || $base eq 'OpenVPN static host' ){
472 $ $hash { $key }[ 0 ]=& fwlib
:: get_ovpn_host_ip
( $base2 , 33 );
473 } elsif ( $base eq 'ovpn_n2n_src' || $base eq 'ovpn_n2n_tgt' || $base eq 'OpenVPN N-2-N' ){
474 $ $hash { $key }[ 0 ]=& fwlib
:: get_ovpn_n2n_ip
( $base2 , 11 );
475 } elsif ( $base eq 'ipsec_net_src' || $base eq 'ipsec_net_tgt' || $base eq 'IpSec Network' ){
476 $ $hash { $key }[ 0 ]=& fwlib
:: get_ipsec_net_ip
( $base2 , 11 );
477 } elsif ( $base eq 'ipfire_src' ){
478 if ( $base2 eq 'GREEN' ){
479 $ $hash { $key }[ 0 ]= $defaultNetworks { 'GREEN_ADDRESS' };
481 if ( $base2 eq 'BLUE' ){
482 $ $hash { $key }[ 0 ]= $defaultNetworks { 'BLUE_ADDRESS' };
484 if ( $base2 eq 'ORANGE' ){
485 $ $hash { $key }[ 0 ]= $defaultNetworks { 'ORANGE_ADDRESS' };
488 $ $hash { $key }[ 0 ]= '0.0.0.0/0' ;
490 if ( $base2 eq 'RED' || $base2 eq 'RED1' ){
491 open ( FILE
, "/var/ipfire/red/local-ipaddress" );
492 $ $hash { $key }[ 0 ]= < FILE
>;
495 foreach my $alias ( sort keys %aliases ){
496 if ( $base2 eq $alias ){
497 $ $hash { $key }[ 0 ]= $aliases { $alias }{ 'IPT' };
507 #check AH,GRE,ESP or ICMP
508 if ($ $hash { $key }[ 7 ] ne 'ON' && $ $hash { $key }[ 11 ] ne 'ON' ){
509 return "$ $hash { $key }[8]" ;
511 if ($ $hash { $key }[ 7 ] eq 'ON' || $ $hash { $key }[ 11 ] eq 'ON' ){
512 #check if servicegroup or service
513 if ($ $hash { $key }[ 14 ] eq 'cust_srv' ){
514 return & fwlib
:: get_srv_prot
($ $hash { $key }[ 15 ]);
515 } elsif ($ $hash { $key }[ 14 ] eq 'cust_srvgrp' ){
516 return & fwlib
:: get_srvgrp_prot
($ $hash { $key }[ 15 ]);
517 } elsif (($ $hash { $key }[ 10 ] ne '' || $ $hash { $key }[ 15 ] ne '' ) && $ $hash { $key }[ 8 ] eq '' ){ #when ports are used and prot set to "all"
519 } elsif (($ $hash { $key }[ 10 ] ne '' || $ $hash { $key }[ 15 ] ne '' ) && ($ $hash { $key }[ 8 ] eq 'TCP' || $ $hash { $key }[ 8 ] eq 'UDP' )){ #when ports are used and prot set to "tcp" or "udp"
520 return "$ $hash { $key }[8]" ;
521 } elsif (($ $hash { $key }[ 10 ] eq '' && $ $hash { $key }[ 15 ] eq '' ) && $ $hash { $key }[ 8 ] ne 'ICMP' ){ #when ports are NOT used and prot NOT set to "ICMP"
522 return "$ $hash { $key }[8]" ;
524 return "$ $hash { $key }[8]" ;
528 if ( $SRC_TGT eq '' && $ $hash { $key }[ 31 ] eq 'dnat' && $ $hash { $key }[ 11 ] eq '' && $ $hash { $key }[ 12 ] ne '' ){
529 return "$ $hash { $key }[8]" ;
537 #Get manual defined Ports from SOURCE
538 if ($ $hash { $key }[ 7 ] eq 'ON' && $SRC_TGT eq 'SRC' ){
539 if ($ $hash { $key }[ 10 ] ne '' ){
540 $ $hash { $key }[ 10 ] =~ s/\|/,/g ;
541 if ( index ($ $hash { $key }[ 10 ], "," ) > 0 ){
542 return "-m multiport --sport $ $hash { $key }[10] " ;
544 if ($ $hash { $key }[ 28 ] ne 'ON' || ($ $hash { $key }[ 28 ] eq 'ON' && $ $hash { $key }[ 31 ] eq 'snat' ) ||($ $hash { $key }[ 28 ] eq 'ON' && $ $hash { $key }[ 31 ] eq 'dnat' ) ){
545 return "--sport $ $hash { $key }[10] " ;
547 return ":$ $hash { $key }[10]" ;
551 #Get manual ports from TARGET
552 } elsif ($ $hash { $key }[ 11 ] eq 'ON' && $SRC_TGT eq '' ){
553 if ($ $hash { $key }[ 14 ] eq 'TGT_PORT' ){
554 if ($ $hash { $key }[ 15 ] ne '' ){
555 $ $hash { $key }[ 15 ] =~ s/\|/,/g ;
556 if ( index ($ $hash { $key }[ 15 ], "," ) > 0 ){
557 return "-m multiport --dport $ $hash { $key }[15] " ;
559 if ($ $hash { $key }[ 28 ] ne 'ON' || ($ $hash { $key }[ 28 ] eq 'ON' && $ $hash { $key }[ 31 ] eq 'snat' ) ){
560 return "--dport $ $hash { $key }[15] " ;
562 $ $hash { $key }[ 15 ] =~ s/\:/-/g ;
563 return ":$ $hash { $key }[15]" ;
567 #Get ports defined in custom Service (firewall-groups)
568 } elsif ($ $hash { $key }[ 14 ] eq 'cust_srv' ){
569 if ( $prot ne 'ICMP' ){
570 if ($ $hash { $key }[ 31 ] eq 'dnat' && $ $hash { $key }[ 28 ] eq 'ON' ){
571 my $ports =& fwlib
:: get_srv_port
($ $hash { $key }[ 15 ], 1 , $prot );
575 return "--dport " .& fwlib
:: get_srv_port
($ $hash { $key }[ 15 ], 1 , $prot );
577 } elsif ( $prot eq 'ICMP' && $ $hash { $key }[ 11 ] eq 'ON' ){ #When PROT is ICMP and "use targetport is checked, this is an icmp-service
578 return "--icmp-type " .& fwlib
:: get_srv_port
($ $hash { $key }[ 15 ], 3 , $prot );
580 #Get ports from services which are used in custom servicegroups (firewall-groups)
581 } elsif ($ $hash { $key }[ 14 ] eq 'cust_srvgrp' ){
582 if ( $prot ne 'ICMP' ){
583 return & fwlib
:: get_srvgrp_port
($ $hash { $key }[ 15 ], $prot );
585 elsif ( $prot eq 'ICMP' ){
586 return & fwlib
:: get_srvgrp_port
($ $hash { $key }[ 15 ], $prot );
591 if ($ $hash { $key }[ 7 ] ne 'ON' && $ $hash { $key }[ 11 ] ne 'ON' && $SRC_TGT eq '' ){
592 if ($ $hash { $key }[ 9 ] ne '' && $ $hash { $key }[ 9 ] ne 'All ICMP-Types' ){
593 return "--icmp-type $ $hash { $key }[9] " ;
594 } elsif ($ $hash { $key }[ 9 ] eq 'All ICMP-Types' ){