summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/drakfirewall.pm15
-rw-r--r--perl-install/network/shorewall.pm18
2 files changed, 14 insertions, 19 deletions
diff --git a/perl-install/network/drakfirewall.pm b/perl-install/network/drakfirewall.pm
index b09342752..554f6298f 100644
--- a/perl-install/network/drakfirewall.pm
+++ b/perl-install/network/drakfirewall.pm
@@ -110,8 +110,8 @@ sub from_ports {
}
sub default_from_pkgs {
- my ($in) = @_;
- my @pkgs = $in->do_pkgs->are_installed(map { split ' ', $_->{pkg} } @all_servers);
+ my ($do_pkgs) = @_;
+ my @pkgs = $do_pkgs->are_installed(map { split ' ', $_->{pkg} } @all_servers);
[ grep {
my $s = $_;
exists $s->{force_default_selection} ?
@@ -120,15 +120,14 @@ sub default_from_pkgs {
} @all_servers ];
}
-sub get_ports {
- my ($in, $_ports) = @_;
- my $shorewall = network::shorewall::read($in, 'silent') or return;
+sub get_ports() {
+ my $shorewall = network::shorewall::read() or return;
\$shorewall->{ports};
}
sub set_ports {
my ($in, $disabled, $ports) = @_;
- my $shorewall = network::shorewall::read($in, 'not_silent') || network::shorewall::default_interfaces($in) or die N("No network card");
+ my $shorewall = network::shorewall::read($in) || network::shorewall::default_interfaces($in) or die N("No network card");
if (!$disabled || -x "$::prefix/sbin/shorewall") {
$in->do_pkgs->ensure_binary_is_installed('shorewall', 'shorewall', $::isInstall) or return;
@@ -141,12 +140,12 @@ sub set_ports {
sub get_conf {
my ($in, $disabled, $o_ports) = @_;
- my $possible_servers = default_from_pkgs($in);
+ my $possible_servers = default_from_pkgs($in->do_pkgs);
$_->{hide} = 0 foreach @$possible_servers;
if ($o_ports) {
$disabled, from_ports($o_ports);
- } elsif (my $shorewall = network::shorewall::read($in, 'silent')) {
+ } elsif (my $shorewall = network::shorewall::read()) {
$shorewall->{disabled}, from_ports(\$shorewall->{ports});
} else {
$in->ask_okcancel('', N("drakfirewall configurator
diff --git a/perl-install/network/shorewall.pm b/perl-install/network/shorewall.pm
index 563914578..eb3a4e045 100644
--- a/perl-install/network/shorewall.pm
+++ b/perl-install/network/shorewall.pm
@@ -61,11 +61,10 @@ sub get_net_device() {
$default_dev;
}
-sub default_interfaces_silent {
- my ($_in) = @_;
- my %conf;
- my @l = detect_devices::getNet() or return;
- if (@l == 1) {
+sub default_interfaces_silent() {
+ my %conf;
+ my @l = detect_devices::getNet() or return;
+ if (@l == 1) {
$conf{net_interface} = $l[0];
} else {
$conf{net_interface} = get_net_device() || $l[0];
@@ -103,7 +102,7 @@ Examples:
}
sub read {
- my ($in, $mode) = @_;
+ my ($o_in) = @_;
my %conf = (disabled => !glob_("$::prefix/etc/rc3.d/S*shorewall"),
ports => join(' ', map {
my $e = $_;
@@ -114,11 +113,8 @@ sub read {
if (my ($e) = get_config_file('masq')) {
$conf{masquerade}{subnet} = $e->[1] if $e->[1];
}
- if ($mode eq 'silent') {
- put_in_hash(\%conf, default_interfaces_silent($in));
- } else {
- put_in_hash(\%conf, default_interfaces($in));
- }
+ put_in_hash(\%conf, $o_in ? default_interfaces($o_in) : default_interfaces_silent());
+
$conf{net_interface} && \%conf;
}