diff options
author | Rick Balocca <rbalocca@vyatta.com> | 2008-07-16 16:27:14 -0700 |
---|---|---|
committer | Rick Balocca <rbalocca@vyatta.com> | 2008-07-16 16:27:14 -0700 |
commit | 4d30cb1f1ca2a551ca9a594a0a49a018910e1fca (patch) | |
tree | 0544b540bf01983267ff512b7928f4fe3c89d9c2 | |
parent | 5203e1fafc937098a514164db30857e32283c000 (diff) | |
parent | 86c4b36e8d2e610a5d0286a6c2c9b95314c1e80f (diff) | |
download | vyatta-cfg-4d30cb1f1ca2a551ca9a594a0a49a018910e1fca.tar.gz vyatta-cfg-4d30cb1f1ca2a551ca9a594a0a49a018910e1fca.zip |
Merge branch 'hollywood'
-rwxr-xr-x | scripts/VyattaConfig.pm | 5 | ||||
-rwxr-xr-x | scripts/VyattaConfigLoad.pm | 1 | ||||
-rw-r--r-- | scripts/vyatta-interfaces.pl | 24 |
3 files changed, 24 insertions, 6 deletions
diff --git a/scripts/VyattaConfig.pm b/scripts/VyattaConfig.pm index 941bb63..9ddc8ef 100755 --- a/scripts/VyattaConfig.pm +++ b/scripts/VyattaConfig.pm @@ -262,7 +262,10 @@ sub returnValues { # node is relative sub returnOrigValues { my $val = returnOrigValue(@_); - my @values = split("\n", $val); + my @values = (); + if (defined($val)) { + @values = split("\n", $val); + } return @values; } diff --git a/scripts/VyattaConfigLoad.pm b/scripts/VyattaConfigLoad.pm index 1a7f26e..71203be 100755 --- a/scripts/VyattaConfigLoad.pm +++ b/scripts/VyattaConfigLoad.pm @@ -32,6 +32,7 @@ my %config_rank = ( 'qos-policy' => 1100, 'firewall' => 1020, 'service nat' => 1010, + 'system host-name' => 1005, 'interfaces' => 1000, 'interfaces bridge' => 990, 'interfaces ethernet' => 980, diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index 1511c12..18fbf61 100644 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -111,9 +111,6 @@ sub dhcp_conf_header { my $date = `date`; chomp $date; $output = "#\n# autogenerated by vyatta-interfaces.pl on $date\n#\n"; - $output .= "request subnet-mask, broadcast-address, time-offset, routers,\n"; - $output .= "\tdomain-name, domain-name-servers, host-name,\n"; - $output .= "\tinterface-mtu;\n\n"; return $output; } @@ -179,6 +176,15 @@ sub get_hostname { return $hostname; } +sub is_domain_name_set { + my $config = new VyattaConfig; + $config->setLevel("system"); + my $domainname = undef; + $domainname = $config->returnValue("domain-name"); + return $domainname; +} + + sub dhcp_update_config { my ($conf_file, $intf) = @_; @@ -189,6 +195,14 @@ sub dhcp_update_config { if (defined($hostname)) { $output .= "\tsend host-name \"$hostname\";\n"; } + $output .= "\trequest subnet-mask, broadcast-address, routers, domain-name-servers"; + my $domainname = is_domain_name_set(); + if (!defined($domainname)) { + $output .= ", domain-name;\n"; + } else { + $output .= ";\n"; + } + $output .= "}\n\n"; dhcp_write_file($conf_file, $output); @@ -242,8 +256,8 @@ sub stop_dhclient { my $intf = shift; my ($intf_config_file, $intf_process_id_file, $intf_leases_file) = generate_dhclient_intf_files($intf); - my $cmd = "$dhcp_daemon -q -cf $intf_config_file -pf $intf_process_id_file -lf $intf_leases_file -r $intf 2> /dev/null"; - system ($cmd); + my $release_cmd = "$dhcp_daemon -q -cf $intf_config_file -pf $intf_process_id_file -lf $intf_leases_file -r $intf 2> /dev/null"; + system ($release_cmd); system ("rm -f $intf_config_file"); } |