diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2007-12-18 17:05:11 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2007-12-18 17:07:18 +0100 |
commit | b2e263888b0bd2cc30c190f0a6788d3e383ced04 (patch) | |
tree | d814d4ddffc56e5b0db8d45411b4ed3f47170c27 | |
parent | ee02c935d5fe4e513b42e614bc543e62aa453f0f (diff) |
Use /etc/rc.d/rc.inet1 to start/stop interfaces for slackware
-rw-r--r-- | Network/Ifaces.pm | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/Network/Ifaces.pm b/Network/Ifaces.pm index aff1edd..506701c 100644 --- a/Network/Ifaces.pm +++ b/Network/Ifaces.pm @@ -1426,51 +1426,26 @@ sub activate_suse_interface sub activate_slackware_interface_by_dev { my ($dev, $enabled) = @_; - my ($address, $netmask, $gateway); - my ($file) = "/etc/rc.d/rc.inet1.conf"; - my ($ret) = 0; + my ($command, $ret); &Utils::Report::enter (); + $command = "/etc/rc.d/rc.inet1 "; + $command .= $dev; + if ($enabled) { &Utils::Report::do_report ("network_iface_activate", $dev); - - if ($dev =~ /^ppp/) - { - $ret = &Utils::File::run ("ppp-go"); - } - else - { - if (&Utils::Parse::get_rcinet1conf_bool ($file, $dev, USE_DHCP)) - { - # Use DHCP - $ret = &Utils::File::run ("dhclient $dev"); - } - else - { - $address = &Utils::Parse::get_rcinet1conf ($file, $dev, "IPADDR"); - $netmask = &Utils::Parse::get_rcinet1conf ($file, $dev, "NETMASK"); - $gateway = &get_gateway ($file, "GATEWAY", $address, $netmask); - - $ret = &Utils::File::run ("ifconfig $dev $address netmask $netmask up"); - - # Add the gateway if necessary - if ($gateway ne undef) - { - &Utils::File::run ("route add default gw $gateway"); - } - } - } + $command .= "_start"; } else { &Utils::Report::do_report ("network_iface_deactivate", $dev); - - $ret = &Utils::File::run ("ifconfig $dev down") if ($dev =~ /^eth/); - $ret = &Utils::File::run ("ppp-off") if ($dev =~ /^ppp/); + $command .= "_stop"; } + $ret = &Utils::File::run ($command); + &Utils::Report::leave (); return -1 if ($ret != 0); return 0; |