summaryrefslogtreecommitdiff
path: root/scripts/vyatta-interfaces.pl
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-22 10:32:04 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-22 11:14:18 -0800
commit39a799dac616edd4b42a1b4de2c861f248318e1f (patch)
tree821d778a77ff75015dba4936ca10652824224ef9 /scripts/vyatta-interfaces.pl
parentb17d21023482c752c490754a11450d4c41c83607 (diff)
downloadvyatta-cfg-system-39a799dac616edd4b42a1b4de2c861f248318e1f.tar.gz
vyatta-cfg-system-39a799dac616edd4b42a1b4de2c861f248318e1f.zip
Use script vyatta-address to set interface
Avoid the overhead of perl compilation of vyatta-interfaces for each address added. Handle the case of deleting address on deleted device cleanly. Clean up dhcpv6 script so it can be used on interfaces other than ethernet.
Diffstat (limited to 'scripts/vyatta-interfaces.pl')
-rwxr-xr-xscripts/vyatta-interfaces.pl17
1 files changed, 14 insertions, 3 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index d625d262..a7384eea 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -486,10 +486,10 @@ sub dhcp {
my ($request, $intf) = @_;
die "$intf is not using DHCP to get an IP address\n"
- unless is_dhcp_enabled($intf);
+ unless ($request eq 'start' || is_dhcp_enabled($intf));
- die "$intf is disabled. Unable to release/renew lease\n"
- if is_intf_down($intf);
+ die "$intf is disabled.\n"
+ if ($request ne 'stop' && is_intf_down($intf));
my $tmp_dhclient_dir = '/var/run/vyatta/dhclient/';
my $release_file = $tmp_dhclient_dir . 'dhclient_release_' . $intf;
@@ -505,6 +505,17 @@ sub dhcp {
print "Renewing DHCP lease on $intf ...\n";
run_dhclient($intf);
unlink ($release_file);
+ } elsif ($request eq "start") {
+ print "Starting DHCP client on $intf ...\n";
+ touch("/var/lib/dhcp3/$intf");
+ run_dhclient($intf);
+ } elsif ($request eq "stop") {
+ print "Stopping DHCP client on $intf ...\n";
+ stop_dhclient($intf);
+ unlink("/var/lib/dhcp3/dhclient_$intf\_lease");
+ unlink("/var/lib/dhcp3/$intf");
+ unlink("/var/run/vyatta/dhclient/dhclient_release_$intf");
+ unlink("/var/lib/dhcp3/dhclient_$intf\.conf");
} else {
die "Unknown DHCP request: $request\n";
}