=================================================================== RCS file: /home/cvsd/home/cvs/scripts/shell/firewall/fw-universal.sh,v retrieving revision 2.121 retrieving revision 2.122 diff -u -p -r2.121 -r2.122 --- scripts/shell/firewall/fw-universal.sh 2019/10/08 22:25:30 2.121 +++ scripts/shell/firewall/fw-universal.sh 2020/09/17 18:58:29 2.122 @@ -22,7 +22,7 @@ # Licensed under terms of GNU General Public License. # All rights reserved. # -# $Platon: scripts/shell/firewall/fw-universal.sh,v 2.120 2019/02/14 23:14:32 nepto Exp $ +# $Platon: scripts/shell/firewall/fw-universal.sh,v 2.121 2019/10/08 22:25:30 nepto Exp $ # # Changelog: # 2003-10-24 - created @@ -269,7 +269,7 @@ unload_modules() print_iface_status() { # {{{ # Print interfaces: - print_info "$(pad7 "# iface") | $(pad15 "IP address") | $(pad15 "Gateway") | $(pad15 "Broadcast") | $(pad15 "Netmask") | HW address"; + print_info "$(pad15 "# iface") | $(pad15 "IP address") | $(pad15 "Gateway") | $(pad15 "Broadcast") | $(pad15 "Netmask") | HW address"; for iface in $interfaces; do IPS="IP_$iface"; for IP in ${!IPS}; do @@ -277,7 +277,7 @@ print_iface_status() Bcast="Bcast_$iface"; Mask="Mask_$iface"; HWaddr="HWaddr_$iface"; - print_info "$(pad7 $iface) | $(pad15 ${IP}) | $(pad15 ${!Gateway}) | $(pad15 ${!Bcast}) | $(pad15 ${!Mask}) | ${!HWaddr}"; + print_info "$(pad15 $iface) | $(pad15 ${IP}) | $(pad15 ${!Gateway}) | $(pad15 ${!Bcast}) | $(pad15 ${!Mask}) | ${!HWaddr}"; done done } # }}} @@ -509,7 +509,7 @@ masquerade() return; fi - print_info -en "NAT: Masquerading local subnet: $NAT_SUBNET_IFACE --> $NAT_LAN_IFACE" + print_info -en "NAT: Masquerading local subnet: $NAT_SUBNET_IFACE -> $NAT_LAN_IFACE" if [ "X$XEN_MODE" = "Xon" ]; then if [ -n "$NAT_SUBNET_SRC" ]; then @@ -1758,13 +1758,14 @@ my (%ip, %ifname, %ip6, %scope6, %bcast, while (my $line = ) { chomp $line; - if ($line =~ m/^([a-z0-9:]+)\s+.*?([a-z0-9:]+)\s*$/i) { # Linux interface + if ($line =~ m/^([a-z0-9:-]+)\s+.*?([a-z0-9:]+)\s*$/i) { # Linux interface $iface = $1; my $iface_hwaddr = $2; my $x_iface = $iface; $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" + $iface =~ s/:/_/g; # convert "eth0:0" -> "eth0_0" + $iface =~ s/-/_/g; # convert "br-a97b1d2fbcc4" -> "br_a97b1d2fbcc4" (Docker) + $x_iface = [ $x_iface =~ m/^([a-z0-9]+)/i ]->[0]; # convert "eth0:0" -> "eth0" $ifname{$iface} = $x_iface; $ipcount{$iface}++; $hwaddr{$iface} = $iface_hwaddr; @@ -1815,6 +1816,10 @@ printf "interfaces=\"%s\"; export inter my @vals = split(/\s+/, $line); foreach my $key (@columns) { $iface->{$key} = shift @vals; + if ($key eq "Iface") { + # convert "br-a97b1d2fbcc4" -> "br_a97b1d2fbcc4" (Docker) + $iface->{$key} =~ s/-/_/g; + } } foreach my $key (qw( Gateway Destination )) {