=================================================================== RCS file: /home/cvsd/home/cvs/scripts/shell/firewall/fw-universal.sh,v retrieving revision 2.103 retrieving revision 2.104 diff -u -p -r2.103 -r2.104 --- scripts/shell/firewall/fw-universal.sh 2014/04/29 23:22:55 2.103 +++ scripts/shell/firewall/fw-universal.sh 2015/10/12 22:41:24 2.104 @@ -22,7 +22,7 @@ # Licensed under terms of GNU General Public License. # All rights reserved. # -# $Platon: scripts/shell/firewall/fw-universal.sh,v 2.102 2014-04-15 05:02:32 nepto Exp $ +# $Platon: scripts/shell/firewall/fw-universal.sh,v 2.103 2014-04-29 23:22:55 nepto Exp $ # # Changelog: # 2003-10-24 - created @@ -1658,7 +1658,8 @@ while (my $line = ) { $iface = $1; my $iface_hwaddr = $2; 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" $ifname{$iface} = $x_iface; $ipcount{$iface}++; @@ -1678,6 +1679,13 @@ while (my $line = ) { push @{$ip6{$iface}}, $fields[3]; $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]; + } } @@ -1691,8 +1699,8 @@ map { printf "IPcount_%s=\"%s\"; export map { printf "IFname_%s=\"%s\"; export IFname_%s;\n", $_, $ifname{$_}, $_; } keys %ifname; printf "interfaces=\"%s\"; export interfaces;\n", join(" ", sort keys %ip); '` - eval "$parsed_interfaces"; #echo "$parsed_interfaces"; + eval "$parsed_interfaces"; parsed_routes=`$PERL -e ' $\ = "\n"; @@ -1741,6 +1749,7 @@ printf "interfaces=\"%s\"; export inter } # }}} '` + #echo $parsed_routes eval "$parsed_routes"; # Now we have defined variables like this: