summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorFlorin Grad <florin@mandriva.com>2003-09-24 13:14:57 +0000
committerFlorin Grad <florin@mandriva.com>2003-09-24 13:14:57 +0000
commit37d7bb620ac71f550cdbdc7276235ef1eaa10834 (patch)
tree1b63a12c8ad4193b5d88ade8928c0d5f2a11ca16 /perl-install
parent64b8c4867e4bae1c43af9a8dfaee73f3c68887df (diff)
downloaddrakx-37d7bb620ac71f550cdbdc7276235ef1eaa10834.tar
drakx-37d7bb620ac71f550cdbdc7276235ef1eaa10834.tar.gz
drakx-37d7bb620ac71f550cdbdc7276235ef1eaa10834.tar.bz2
drakx-37d7bb620ac71f550cdbdc7276235ef1eaa10834.tar.xz
drakx-37d7bb620ac71f550cdbdc7276235ef1eaa10834.zip
allow drakfirewall to choose the interface
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/network/drakfirewall.pm16
-rw-r--r--perl-install/network/shorewall.pm51
2 files changed, 49 insertions, 18 deletions
diff --git a/perl-install/network/drakfirewall.pm b/perl-install/network/drakfirewall.pm
index dc2dcc668..c5b8c6288 100644
--- a/perl-install/network/drakfirewall.pm
+++ b/perl-install/network/drakfirewall.pm
@@ -1,7 +1,7 @@
package network::drakfirewall; # $Id$
-use diagnostics;
-use strict;
+
+
use network::shorewall;
use common;
@@ -105,16 +105,14 @@ sub default_from_pkgs {
}
sub get_ports {
- my ($_ports) = @_;
- my $shorewall = network::shorewall::read() or return;
+ my ($in, $_ports) = @_;
+ my $shorewall = network::shorewall::read($in,'silent') or return;
\$shorewall->{ports};
}
sub set_ports {
my ($in, $disabled, $ports) = @_;
-
- my $shorewall = network::shorewall::read() || network::shorewall::default_interfaces() or die \N("No network card");
-
+ my $shorewall = network::shorewall::read($in,'not_silent') || network::shorewall::default_interfaces($in) or die \N("No network card");
if (!$disabled || -x "$::prefix/sbin/shorewall") {
$in->do_pkgs->ensure_is_installed('shorewall', '/sbin/shorewall', $::isInstall) or return;
@@ -126,13 +124,13 @@ sub set_ports {
sub get_conf {
my ($in, $disabled, $o_ports) = @_;
-
+
my $possible_servers = default_from_pkgs($in);
$_->{hide} = 0 foreach @$possible_servers;
if ($o_ports) {
$disabled, from_ports($o_ports);
- } elsif (my $shorewall = network::shorewall::read()) {
+ } elsif (my $shorewall = network::shorewall::read($in,'silent')) {
$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 4cbc6e74d..489beb8d6 100644
--- a/perl-install/network/shorewall.pm
+++ b/perl-install/network/shorewall.pm
@@ -46,22 +46,51 @@ sub get_config_file {
map { [ split ' ' ] } grep { !/^#/ } cat_("$::prefix/etc/shorewall/$file");
}
-sub default_interfaces() {
- my %conf;
-
- my @l = detect_devices::getNet() or return;
- if (@l == 1) {
+sub default_interfaces_silent($) {
+ my ($in) = @_;
+ my %conf;
+ my @l = detect_devices::getNet() or return;
+ if (@l == 1) {
$conf{net_interface} = $l[0];
} else {
$conf{net_interface} = network::netconnect::get_net_device() || $l[0];
- $conf{loc_interface} = [ grep { $_ ne $conf{net_interface} } @l ];
+ $conf{loc_interface} = [ grep { $_ ne $conf{net_interface} } @l ];
}
\%conf;
}
-sub read() {
- my %conf;
+sub default_interfaces($) {
+ my ($in) = @_;
+ my %conf;
+ my $card_netconnect = network::netconnect::get_net_device() || "eth0";
+ defined $card_netconnect and log::l("[drakgw] Information from netconnect: ignore card $card_netconnect");
+
+ my @l = detect_devices::getNet() or return;
+ if (@l == 1) {
+ $conf{net_interface} = $l[0];
+ } else {
+ $in->ask_from('',
+ N("Please enter the name of the interface connected to the internet.
+
+Examples:
+ ppp+ for modem or DSL connections,
+ eth0, or eth1 for cable connection,
+ ippp+ for a isdn connection.
+", $card_netconnect),
+ [ { label => N("Net Device"), val => \$card_netconnect, type => 'entry' } ]);
+ put_in_hash($conf ||= {}, {
+ net_interface => $card_netconnect,
+ });
+ $conf{net_interface} = $card_netconnect;
+ #$conf{net_interface} = network::netconnect::get_net_device() || $l[0];
+ $conf{loc_interface} = [ grep { $_ ne $conf{net_interface} } @l ];
+ }
+ \%conf;
+}
+sub read($$) {
+ my %conf;
+ my ($in,$mode) = @_;
$conf{disabled} = !glob_("$::prefix/etc/rc3.d/S*shorewall");
$conf{ports} =
@@ -73,7 +102,11 @@ sub read() {
if (my ($e) = get_config_file('masq')) {
$conf{masquerade}{subnet} = $e->[1] if $e->[1];
}
- put_in_hash(\%conf, default_interfaces());
+ if ($mode eq 'silent') {
+ put_in_hash(\%conf, default_interfaces_silent($in));
+ } else {
+ put_in_hash(\%conf, default_interfaces($in));
+ };
foreach (get_config_file('interfaces')) {
my ($name, $interface) = @$_;
if ($name eq 'masq') {