diff options
-rw-r--r-- | scripts/dns-forwarding/vyatta-dns-forwarding.pl | 30 | ||||
-rw-r--r-- | templates/service/dns/forwarding/dhcp/node.def | 3 |
2 files changed, 7 insertions, 26 deletions
diff --git a/scripts/dns-forwarding/vyatta-dns-forwarding.pl b/scripts/dns-forwarding/vyatta-dns-forwarding.pl index c2ef968a..902e91bc 100644 --- a/scripts/dns-forwarding/vyatta-dns-forwarding.pl +++ b/scripts/dns-forwarding/vyatta-dns-forwarding.pl @@ -37,12 +37,10 @@ my $dnsforwarding_conf = '/etc/dnsmasq.conf'; sub dnsforwarding_restart { system("$dnsforwarding_init restart >&/dev/null"); - print "Setting up DNS forwarding.\n"; } sub dnsforwarding_stop { system("$dnsforwarding_init stop >&/dev/null"); - print "Stopping DNS forwarding.\n"; } sub dnsforwarding_get_constants { @@ -164,13 +162,6 @@ sub check_system_nameserver { } -sub check_dhcp_nameserver { - - my $intf = shift; - my $cmd = `grep nameserver /etc/resolv.conf.dhclient-new-$intf|wc -l`; - return $cmd; -} - sub is_dhcp_enabled { my $intf = shift; @@ -205,14 +196,13 @@ sub check_dhcp_interface { my $interface = shift; if (!is_dhcp_enabled($interface)) { - print "$interface is not using DHCP to get an IP address\n"; + print "DNS forwarding error: $interface is not using DHCP to get an IP address\n"; return 0; } if (-e "/var/run/vyatta/dhclient/dhclient_release_$interface") { # dhcp released for the interface - print "DHCP lease for $interface has been released.\n"; - print "Renew lease for $interface before setting this parameter.\n"; + print "DNS forwarding error: DHCP lease for $interface has been released by user\n"; return 0; } @@ -224,26 +214,18 @@ sub check_dhcp_interface { # main # -my ($update_dnsforwarding, $stop_dnsforwarding, $system_nameserver, $dhcp_interface, $dhcp_interface_nameserver, $dhclient_script); +my ($update_dnsforwarding, $stop_dnsforwarding, $system_nameserver, $dhcp_interface, $dhclient_script); GetOptions("update-dnsforwarding!" => \$update_dnsforwarding, "stop-dnsforwarding!" => \$stop_dnsforwarding, "system-nameserver!" => \$system_nameserver, - "dhcp-interface-nameserver=s" => \$dhcp_interface_nameserver, "dhclient-script!" => \$dhclient_script, "dhcp-interface=s" => \$dhcp_interface); if (defined $system_nameserver) { my $system_nameserver_exists = check_system_nameserver(); if ($system_nameserver_exists < 1){ - print "Warning: No DNS servers set in system to forward queries.\n"; - } -} - -if (defined $dhcp_interface_nameserver) { - my $dhcp_interface_nameserver_exists = check_dhcp_nameserver($dhcp_interface_nameserver); - if ($dhcp_interface_nameserver_exists < 1){ - print "Warning: No DNS servers received from DHCP server for $dhcp_interface_nameserver.\n"; + print "DNS forwarding warning: No DNS servers set in system to forward queries\n"; } } @@ -265,9 +247,9 @@ if (defined $update_dnsforwarding) { if (!(defined $use_system_nameservers) && (@use_dhcp_nameservers == 0) && (@use_nameservers == 0)) { my $nameserver_exists = check_nameserver(); if ($nameserver_exists < 1){ - print "Warning: No DNS servers ('system set' or 'dhcp received') to forward queries.\n"; + print "DNS forwarding warning: No DNS servers ('system' or 'dhcp received') to forward queries.\n"; } - } + } my $called_from_dhclient_script = 0; if (defined $dhclient_script){ diff --git a/templates/service/dns/forwarding/dhcp/node.def b/templates/service/dns/forwarding/dhcp/node.def index c9167431..f56a51c2 100644 --- a/templates/service/dns/forwarding/dhcp/node.def +++ b/templates/service/dns/forwarding/dhcp/node.def @@ -1,8 +1,7 @@ multi: type: txt help: Set to forward DNS queries to nameservers received from DHCP server for specified interface -syntax:expression: exec "/opt/vyatta/sbin/vyatta-dns-forwarding.pl --dhcp-interface $VAR(@)" -commit:expression: exec "/opt/vyatta/sbin/vyatta-dns-forwarding.pl --dhcp-interface-nameserver $VAR(@)" +commit:expression: exec "/opt/vyatta/sbin/vyatta-dns-forwarding.pl --dhcp-interface $VAR(@)" allowed: local -a array ; array=( /var/lib/dhcp3/eth* /var/lib/dhcp3/br* ) ; |