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 /scripts/vyatta-interfaces.pl | |
parent | 5203e1fafc937098a514164db30857e32283c000 (diff) | |
parent | 86c4b36e8d2e610a5d0286a6c2c9b95314c1e80f (diff) | |
download | vyatta-cfg-4d30cb1f1ca2a551ca9a594a0a49a018910e1fca.tar.gz vyatta-cfg-4d30cb1f1ca2a551ca9a594a0a49a018910e1fca.zip |
Merge branch 'hollywood'
Diffstat (limited to 'scripts/vyatta-interfaces.pl')
-rw-r--r-- | scripts/vyatta-interfaces.pl | 24 |
1 files changed, 19 insertions, 5 deletions
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"); } |