summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2008-03-09 14:05:41 +0100
committerCarlos Garnacho <carlosg@gnome.org>2008-03-09 14:05:41 +0100
commit3db4b0ca24cf6a60c56eb71f5725406b2ce06fef (patch)
tree0a8b45c3355f13be38dbeddaed869084cdb37204
parent8fd64e70c0be223f7645342ecff88354686807cc (diff)
Empty gateway in slackware if this address is in the same network than the interface being deleted.
-rw-r--r--Network/Ifaces.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/Network/Ifaces.pm b/Network/Ifaces.pm
index d1a9849..d847bd0 100644
--- a/Network/Ifaces.pm
+++ b/Network/Ifaces.pm
@@ -1677,7 +1677,8 @@ sub delete_pld_interface
sub delete_slackware_interface
{
my ($old_hash) = @_;
- my ($rcinetconf, $rcinet, $pppscript, $dev);
+ my ($rcinetconf, $pppscript, $dev);
+ my ($address, $netmask, $gateway);
$rcinetconf = "/etc/rc.d/rc.inet1.conf";
$pppscript = "/etc/ppp/pppscript";
@@ -1689,11 +1690,20 @@ sub delete_slackware_interface
}
else
{
+ $address = &Utils::Parse::get_rcinet1conf ($rcinetconf, $dev, "IPADDR");
+ $netmask = &Utils::Parse::get_rcinet1conf ($rcinetconf, $dev, "NETMASK");
+ $gateway = &Utils::Parse::get_sh ($rcinetconf, "GATEWAY");
+
# empty the values
&Utils::Replace::set_rcinet1conf ($rcinetconf, $dev, "IPADDR", "");
&Utils::Replace::set_rcinet1conf ($rcinetconf, $dev, "NETMASK", "");
&Utils::Replace::set_rcinet1conf ($rcinetconf, $dev, "USE_DHCP", "");
&Utils::Replace::set_rcinet1conf ($rcinetconf, $dev, "DHCP_HOSTNAME", "");
+
+ if (&is_ip_in_same_network ($address, $gateway, $netmask))
+ {
+ &Utils::Replace::set_rcinet1conf_global ($rcinetconf, "GATEWAY", "");
+ }
}
}