summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohit Mehta <mohit@vyatta.com>2011-01-27 13:00:02 -0800
committerMohit Mehta <mohit@vyatta.com>2011-01-27 13:53:49 -0800
commiteb48d5bdb7a1782cf7ed409743fdb68e4cc89cc6 (patch)
tree9bcd96f52e58033086981ed2d9001f05d1b8dfcc
parent46ad7f52c90e22bd231af63e78096fc6e8de319e (diff)
downloadvyatta-cfg-quagga-eb48d5bdb7a1782cf7ed409743fdb68e4cc89cc6.tar.gz
vyatta-cfg-quagga-eb48d5bdb7a1782cf7ed409743fdb68e4cc89cc6.zip
Fix Bug 6696 Internal error for release/renew dhcp interface under op mode
* do not execute config-mode actions when called from op-mode (cherry picked from commit c385ddc400788eff46f10fea6b57b593607dc290)
-rwxr-xr-xscripts/vyatta-interfaces.pl24
1 files changed, 15 insertions, 9 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index efefca9a..94a822e0 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -190,13 +190,16 @@ sub is_intf_disabled {
}
sub run_dhclient {
- my $intf = shift;
+ my ($intf, $op_mode) = @_;
- my ($intf_config_file, $intf_process_id_file, $intf_leases_file)
- = generate_dhclient_intf_files($intf);
- dhcp_update_config($intf_config_file, $intf);
+ my ($intf_config_file, $intf_process_id_file, $intf_leases_file)
+ = generate_dhclient_intf_files($intf);
- return if is_intf_disabled($intf);
+ # perform config mode actions if not called from op-mode
+ if (!defined $op_mode) {
+ dhcp_update_config($intf_config_file, $intf);
+ return if is_intf_disabled($intf);
+ }
my $cmd = "$dhcp_daemon -pf $intf_process_id_file -x $intf 2> /dev/null; rm -f $intf_process_id_file 2> /dev/null;";
$cmd .= "$dhcp_daemon -q -nw -cf $intf_config_file -pf $intf_process_id_file -lf $intf_leases_file $intf 2> /dev/null &";
@@ -206,9 +209,12 @@ sub run_dhclient {
}
sub stop_dhclient {
- my $intf = shift;
+ my ($intf, $op_mode) = @_;
- return if is_intf_disabled($intf);
+ # perform config mode actions if not called from op-mode
+ if (!defined $op_mode) {
+ return if is_intf_disabled($intf);
+ }
my ($intf_config_file, $intf_process_id_file, $intf_leases_file)
= generate_dhclient_intf_files($intf);
@@ -325,12 +331,12 @@ sub dhcp {
if (-e $release_file);
print "Releasing DHCP lease on $intf ...\n";
- stop_dhclient($intf);
+ stop_dhclient($intf, 'op_mode');
mkdir ($tmp_dhclient_dir) if (! -d $tmp_dhclient_dir );
touch ($release_file);
} elsif ($request eq "renew") {
print "Renewing DHCP lease on $intf ...\n";
- run_dhclient($intf);
+ run_dhclient($intf, 'op_mode');
unlink ($release_file);
} elsif ($request eq "start") {
print "Starting DHCP client on $intf ...\n";