diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2008-03-09 14:05:41 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2008-03-09 14:19:26 +0100 |
commit | 6cf26ce0fae559bff09e497789b8588c6ccee1fa (patch) | |
tree | 3b697bfcef6701d377e7589d06745269e1023d87 | |
parent | c91a72996a3ef8a815f3ad4608c82d99ea16494f (diff) |
Empty gateway in slackware if this address is in the same network than the interface being deleted.stb-2-4
-rw-r--r-- | Network/Ifaces.pm | 12 |
1 files changed, 11 insertions, 1 deletions
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", ""); + } } } |