From 6cf26ce0fae559bff09e497789b8588c6ccee1fa Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Sun, 9 Mar 2008 14:05:41 +0100 Subject: Empty gateway in slackware if this address is in the same network than the interface being deleted. --- Network/Ifaces.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Network/Ifaces.pm b/Network/Ifaces.pm index e045254..f183ff7 100644 --- a/Network/Ifaces.pm +++ b/Network/Ifaces.pm @@ -1672,7 +1672,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"; @@ -1684,11 +1685,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", ""); + } } } -- cgit v1.2.3