summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/VyattaConfig.pm5
-rwxr-xr-xscripts/VyattaConfigLoad.pm1
-rw-r--r--scripts/vyatta-interfaces.pl27
3 files changed, 27 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..5424b64 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);
@@ -240,10 +254,13 @@ sub run_dhclient {
sub stop_dhclient {
my $intf = shift;
+ my $new_resolv_conf = "/etc/resolv.conf.dhclient-new-$intf";
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);
+ my $update_resolv_conf_cmd = "rm -f $new_resolv_conf; echo \" \" > $new_resolv_conf; /opt/vyatta/sbin/vyatta_update_resolv.pl --dhclient-script 1";
+ system($update_resolv_conf_cmd);
system ("rm -f $intf_config_file");
}