verzia 2.102, 2014/04/15 05:02:32 |
verzia 2.104, 2015/10/12 22:41:24 |
|
|
# Licensed under terms of GNU General Public License. |
# Licensed under terms of GNU General Public License. |
# All rights reserved. |
# All rights reserved. |
# |
# |
# $Platon: scripts/shell/firewall/fw-universal.sh,v 2.101 2013-09-28 18:51:30 nepto Exp $ |
# $Platon: scripts/shell/firewall/fw-universal.sh,v 2.103 2014-04-29 23:22:55 nepto Exp $ |
# |
# |
# Changelog: |
# Changelog: |
# 2003-10-24 - created |
# 2003-10-24 - created |
Riadok 1119 allow_input() |
|
Riadok 1119 allow_input() |
|
port="ALL"; |
port="ALL"; |
fi |
fi |
print_info -en " $port"`[ ! -z "$src_ip" ] && echo "[$src_ip]"` |
print_info -en " $port"`[ ! -z "$src_ip" ] && echo "[$src_ip]"` |
if [ $(( ++counter )) -ge 5 -o "$port" -eq "10050" ]; then counter=0; print_info ""; fi; |
if [ $(( ++counter )) -ge 5 -o "x$port" = "x10050" ]; then counter=0; print_info ""; fi; |
echo $port | grep -q , |
echo $port | grep -q , |
multiport="$?"; |
multiport="$?"; |
if [ "$multiport" -eq 0 ]; then |
if [ "$multiport" -eq 0 ]; then |
Riadok 1658 while (my $line = <STDIN>) { |
|
Riadok 1658 while (my $line = <STDIN>) { |
|
$iface = $1; |
$iface = $1; |
my $iface_hwaddr = $2; |
my $iface_hwaddr = $2; |
my $x_iface = $iface; |
my $x_iface = $iface; |
$iface =~ s/:/_/; # convert "eth0:0" --> "eth0_0" |
$iface =~ s/:$//g; |
|
$iface =~ s/:/_/g; # convert "eth0:0" --> "eth0_0" |
$x_iface = [ $x_iface =~ m/^([a-z0-9]+)/i ]->[0]; # convert "eth0:0" --> "eth0" |
$x_iface = [ $x_iface =~ m/^([a-z0-9]+)/i ]->[0]; # convert "eth0:0" --> "eth0" |
$ifname{$iface} = $x_iface; |
$ifname{$iface} = $x_iface; |
$ipcount{$iface}++; |
$ipcount{$iface}++; |
Riadok 1678 while (my $line = <STDIN>) { |
|
Riadok 1679 while (my $line = <STDIN>) { |
|
push @{$ip6{$iface}}, $fields[3]; |
push @{$ip6{$iface}}, $fields[3]; |
$scope6{$iface} = [ $fields[4] =~ m/Scope:(.*)$/i ]->[0]; |
$scope6{$iface} = [ $fields[4] =~ m/Scope:(.*)$/i ]->[0]; |
} |
} |
|
elsif ($line =~ m/^[ \t]+inet\s/) { # Linux IP address |
|
die unless defined $iface; |
|
my @fields = split(/[\s:]+/, $line); |
|
push @{$ip{$iface}}, $fields[2]; |
|
$bcast{$iface} = (defined($fields[5]) and $fields[5] eq "broadcast") ? $fields[6] : ""; |
|
$mask{$iface} = $fields[4]; |
|
} |
|
|
} |
} |
|
|
Riadok 1691 map { printf "IPcount_%s=\"%s\"; export |
|
Riadok 1699 map { printf "IPcount_%s=\"%s\"; export |
|
map { printf "IFname_%s=\"%s\"; export IFname_%s;\n", $_, $ifname{$_}, $_; } keys %ifname; |
map { printf "IFname_%s=\"%s\"; export IFname_%s;\n", $_, $ifname{$_}, $_; } keys %ifname; |
printf "interfaces=\"%s\"; export interfaces;\n", join(" ", sort keys %ip); |
printf "interfaces=\"%s\"; export interfaces;\n", join(" ", sort keys %ip); |
'` |
'` |
eval "$parsed_interfaces"; |
|
#echo "$parsed_interfaces"; |
#echo "$parsed_interfaces"; |
|
eval "$parsed_interfaces"; |
|
|
parsed_routes=`$PERL -e ' |
parsed_routes=`$PERL -e ' |
$\ = "\n"; |
$\ = "\n"; |
Riadok 1741 printf "interfaces=\"%s\"; export inter |
|
Riadok 1749 printf "interfaces=\"%s\"; export inter |
|
|
|
} # }}} |
} # }}} |
'` |
'` |
|
#echo $parsed_routes |
eval "$parsed_routes"; |
eval "$parsed_routes"; |
|
|
# Now we have defined variables like this: |
# Now we have defined variables like this: |