Second (untested) attempt to implement ip address addition

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5621 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-03-22 02:13:30 +00:00
parent 41ac708a5d
commit 5ed65582ee
2 changed files with 20 additions and 2 deletions

View File

@ -32,7 +32,7 @@ use Shorewall::IPAddrs;
use strict; use strict;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( setup_masq setup_nat ); our @EXPORT = qw( setup_masq setup_nat add_addresses );
our @EXPORT_OK = (); our @EXPORT_OK = ();
our @VERSION = 1.00; our @VERSION = 1.00;
@ -227,7 +227,7 @@ sub setup_one_masq($$$$$$)
unless ( $addresses_to_add{$addr} ) { unless ( $addresses_to_add{$addr} ) {
emit "del_ip_addr $addr $interface" unless $config{RETAIN_ALIASES}; emit "del_ip_addr $addr $interface" unless $config{RETAIN_ALIASES};
$addresses_to_add{$addr} = 1; $addresses_to_add{$addr} = 1;
push @addresses_to_add, "$interface:$alias"; push @addresses_to_add, $addr, "$interface:$alias";
$alias++; $alias++;
} }
} }
@ -382,4 +382,18 @@ sub setup_nat() {
$comment = ''; $comment = '';
} }
sub add_addresses () {
if ( @addresses_to_add ) {
my $arg = '';
while ( @addresses_to_add ) {
my $addr = shift @addresses_to_add;
my $interface = shift @addresses_to_add;
$arg = "$arg $addr $interface";
}
emit "add_ip_aliases $arg";
}
}
1; 1;

View File

@ -520,6 +520,10 @@ sub generate_script_3() {
dump_zone_contents; dump_zone_contents;
emit_unindented '__EOF__'; emit_unindented '__EOF__';
emit '> ${VARDIR}/nat';
add_addresses;
pop_indent; pop_indent;
emit "}\n"; emit "}\n";