diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rwxr-xr-x | scripts/system/vyatta_update_ntp.pl | 115 | ||||
-rwxr-xr-x | scripts/system/vyatta_update_resolv.pl | 15 | ||||
-rwxr-xr-x | scripts/vyatta-system-nameservers | 10 | ||||
-rw-r--r-- | templates/system/ntp/allow-clients/address/node.def | 6 | ||||
-rw-r--r-- | templates/system/ntp/allow-clients/node.def | 1 | ||||
-rw-r--r-- | templates/system/ntp/node.def | 16 | ||||
-rw-r--r-- | templates/system/ntp/server/node.def | 3 | ||||
-rw-r--r-- | templates/system/ntp/server/node.tag/dynamic/node.def | 2 | ||||
-rw-r--r-- | templates/system/ntp/server/node.tag/noselect/node.def | 1 | ||||
-rw-r--r-- | templates/system/ntp/server/node.tag/preempt/node.def | 1 | ||||
-rw-r--r-- | templates/system/ntp/server/node.tag/prefer/node.def | 1 |
12 files changed, 0 insertions, 172 deletions
diff --git a/Makefile.am b/Makefile.am index 77088eaa..cfddd656 100644 --- a/Makefile.am +++ b/Makefile.am @@ -54,7 +54,6 @@ sbin_SCRIPTS += scripts/system/vyatta_update_resolv.pl sbin_SCRIPTS += scripts/system/vyatta_update_sysctl.pl sbin_SCRIPTS += scripts/system/vyatta_update_syslog.pl sbin_SCRIPTS += scripts/system/vyatta_update_console.pl -sbin_SCRIPTS += scripts/system/vyatta_update_ntp.pl sbin_SCRIPTS += scripts/system/irq-affinity.pl sbin_SCRIPTS += scripts/snmp/vyatta-snmp.pl sbin_SCRIPTS += scripts/snmp/vyatta-snmp-v3.pl diff --git a/scripts/system/vyatta_update_ntp.pl b/scripts/system/vyatta_update_ntp.pl deleted file mode 100755 index 78a617bc..00000000 --- a/scripts/system/vyatta_update_ntp.pl +++ /dev/null @@ -1,115 +0,0 @@ -#! /usr/bin/perl - -# **** License **** -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# This code was originally developed by Vyatta, Inc. -# Portions created by Vyatta are Copyright (C) 2007 Vyatta, Inc. -# All Rights Reserved. -# -# **** End License **** - -# Filter ntp.conf - remove old servers and add current ones - -use strict; -use lib "/opt/vyatta/share/perl5"; -use Vyatta::Config; -use NetAddr::IP; -use Getopt::Long; - -my $dhclient_script = 0; - -GetOptions("dhclient-script=i" => \$dhclient_script, -); - -sub ntp_format { - my ($cidr_or_host) = @_; - my $ip = NetAddr::IP->new($cidr_or_host); - if (defined($ip)) { - my $address = $ip->addr(); - my $mask = $ip->mask(); - - if ( - ($ip->version() == 6 && $ip->masklen() == 128) - || ($ip->version() == 4 && $ip->masklen() == 32) - ) { - return "$address"; - } else { - return "$address mask $mask"; - } - } else { - return undef; - } -} - -my @ntp; -if (-e '/etc/ntp.conf') { - open (my $file, '<', '/etc/ntp.conf') - or die("$0: Error! Unable to open '/etc/ntp.conf' for input: $!\n"); - @ntp = <$file>; - close ($file); -} - -open (my $output, '>', '/etc/ntp.conf') - or die("$0: Error! Unable to open '/etc/ntp.conf' for output: $!\n"); - -my $cfg = new Vyatta::Config; -$cfg->setLevel("system ntp"); - -foreach my $line (@ntp) { - if ($line =~ /^# VyOS CLI configuration options/) { - print $output $line; - print $output "\n"; - last; - } else { - print $output $line; - } -} - -my @servers; -my @clients; - -if ($dhclient_script == 1) { - @servers = $cfg->listOrigNodes("server"); - @clients = $cfg->returnOrigValues("allow-clients address"); -} else { - @servers = $cfg->listNodes("server"); - @clients = $cfg->returnValues("allow-clients address"); -} - -if (scalar(@servers) > 0) { - print $output "# Servers\n\n"; - foreach my $server (@servers) { - my $server_addr = ntp_format($server); - if (defined($server_addr)) { - print $output "server $server_addr iburst"; - for my $property (qw(dynamic noselect preempt prefer)) { - if ($dhclient_script == 1) { - print $output " $property" if ($cfg->existsOrig("server $server $property")); - } else { - print $output " $property" if ($cfg->exists("server $server $property")); - } - } - print $output "\nrestrict $server_addr nomodify notrap nopeer noquery\n"; - } - } - print $output "\n"; -} - -if (scalar(@clients) > 0) { - print $output "# Clients\n\n"; - foreach my $client (@clients) { - my $address = ntp_format($client); - print $output "restrict $address nomodify notrap nopeer\n"; - } - print $output "\n"; -} - -exit 0; diff --git a/scripts/system/vyatta_update_resolv.pl b/scripts/system/vyatta_update_resolv.pl index 51617fce..de09a760 100755 --- a/scripts/system/vyatta_update_resolv.pl +++ b/scripts/system/vyatta_update_resolv.pl @@ -30,7 +30,6 @@ use Vyatta::Config; my $dhclient_script = 0; my $config_mode = 0; -my $ntp_config = 0; GetOptions("dhclient-script=i" => \$dhclient_script, "config-mode=i" => \$config_mode, @@ -45,7 +44,6 @@ my $disable_dhcp_nameservers = undef; if ($config_mode == 1) { $disable_dhcp_nameservers = $vc->exists('disable-dhcp-nameservers'); - $ntp_config = $vc->exists('ntp server'); } else { $disable_dhcp_nameservers = $vc->existsOrig('disable-dhcp-nameservers'); } @@ -53,7 +51,6 @@ if ($config_mode == 1) { if ($dhclient_script == 1) { @search_domains = $vc->returnOrigValues('domain-search domain'); $domain_name = $vc->returnOrigValue('domain-name'); - $ntp_config = $vc->existsOrig('ntp server'); } else { @search_domains = $vc->returnValues('domain-search domain'); $domain_name = $vc->returnValue('domain-name'); @@ -132,7 +129,6 @@ if ($domain_name && length($domain_name) > 0) { if (($dhclient_script == 1) || ($config_mode == 1)) { my @current_dhcp_nameservers; - my $restart_ntp = 0; # code below to add new name-servers received from dhcp client, but only if disable-dhcp-nameservers # hasn't been enabled. @@ -168,7 +164,6 @@ if (($dhclient_script == 1) || ($config_mode == 1)) { or die "$! error trying to overwrite"; print $rf "#nameserver written by vyatta_update_resolv.pl (dhcp)\nnameserver\t$ns\n"; close $rf; - $restart_ntp = 1; } } } @@ -206,7 +201,6 @@ if (($dhclient_script == 1) || ($config_mode == 1)) { $cmd = "sed -i -n '/nameserver\t$dhcpnameserver/".'{n;x;d;};x;1d;p;${x;p;}'."' /etc/resolv.conf"; } system($cmd); - $restart_ntp = 1; } } else { for my $dhcpnameserver (@dhcp_nameservers_in_resolvconf) { @@ -225,18 +219,9 @@ if (($dhclient_script == 1) || ($config_mode == 1)) { $cmd = "sed -i -n '/nameserver\t$dhcpnameserver/".'{n;x;d;};x;1d;p;${x;p;}'."' /etc/resolv.conf"; } system($cmd); - $restart_ntp = 1; } } } - if ($restart_ntp == 1) { - # this corresponds to what is done in name-server/node.def as a fix for bug 1300 - if ($ntp_config == 1) { - system("sudo /opt/vyatta/sbin/vyatta_update_ntp.pl --dhclient-script $dhclient_script"); - my $cmd_ntp_restart = "if [ -f /etc/ntp.conf ] && grep -q '^server' /etc/ntp.conf; then /usr/sbin/invoke-rc.d ntp restart >&/dev/null; fi &"; - system($cmd_ntp_restart); - } - } } # The following will re-write '/etc/resolv.conf' line by line, diff --git a/scripts/vyatta-system-nameservers b/scripts/vyatta-system-nameservers index 99019fd1..9c688e80 100755 --- a/scripts/vyatta-system-nameservers +++ b/scripts/vyatta-system-nameservers @@ -36,14 +36,6 @@ restart_dnsmasq () { fi } -restart_ntp () { - # restart ntp if ntp is configured - if [ -f /etc/ntp.conf ] && grep -q "^server" /etc/ntp.conf; then - sudo /opt/vyatta/sbin/vyatta_update_ntp.pl - /usr/sbin/invoke-rc.d ntp restart >&/dev/null - fi -} - update_system_nameservers () { nameserver=$1 touch /etc/resolv.conf @@ -70,7 +62,6 @@ update_system_nameservers () { mv -f /etc/resolv_tmp.conf /etc/resolv.conf fi restart_dnsmasq - restart_ntp } delete_system_nameserver () { @@ -79,7 +70,6 @@ delete_system_nameserver () { # remove specified nameserver sed -i "/$nameserver$/d" /etc/resolv.conf restart_dnsmasq - restart_ntp } # diff --git a/templates/system/ntp/allow-clients/address/node.def b/templates/system/ntp/allow-clients/address/node.def deleted file mode 100644 index a48a2b5a..00000000 --- a/templates/system/ntp/allow-clients/address/node.def +++ /dev/null @@ -1,6 +0,0 @@ -multi: -type: ipv4net,ipv6net -help: IP address - -val_help: ipv4net; IP address and prefix length -val_help: ipv6net; IPv6 address and prefix length diff --git a/templates/system/ntp/allow-clients/node.def b/templates/system/ntp/allow-clients/node.def deleted file mode 100644 index 8228130e..00000000 --- a/templates/system/ntp/allow-clients/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Network Time Protocol (NTP) server options diff --git a/templates/system/ntp/node.def b/templates/system/ntp/node.def deleted file mode 100644 index 38e67e05..00000000 --- a/templates/system/ntp/node.def +++ /dev/null @@ -1,16 +0,0 @@ -priority: 400 -help: Network Time Protocol (NTP) configuration - -end: - sudo /opt/vyatta/sbin/vyatta_update_ntp.pl - if grep -q '^server' /etc/ntp.conf - then - if pgrep -f -u ntp /usr/sbin/ntpd > /dev/null - then - sudo /usr/sbin/invoke-rc.d ntp force-reload - else - sudo /usr/sbin/invoke-rc.d ntp start - fi - else - sudo /usr/sbin/invoke-rc.d ntp stop - fi diff --git a/templates/system/ntp/server/node.def b/templates/system/ntp/server/node.def deleted file mode 100644 index 383bd992..00000000 --- a/templates/system/ntp/server/node.def +++ /dev/null @@ -1,3 +0,0 @@ -tag: -type: txt -help: Network Time Protocol (NTP) server diff --git a/templates/system/ntp/server/node.tag/dynamic/node.def b/templates/system/ntp/server/node.tag/dynamic/node.def deleted file mode 100644 index 2d68de16..00000000 --- a/templates/system/ntp/server/node.tag/dynamic/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Allow server to be configured even if not reachable - diff --git a/templates/system/ntp/server/node.tag/noselect/node.def b/templates/system/ntp/server/node.tag/noselect/node.def deleted file mode 100644 index e2e061b5..00000000 --- a/templates/system/ntp/server/node.tag/noselect/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Marks the server as unused diff --git a/templates/system/ntp/server/node.tag/preempt/node.def b/templates/system/ntp/server/node.tag/preempt/node.def deleted file mode 100644 index ca89efa1..00000000 --- a/templates/system/ntp/server/node.tag/preempt/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Specifies the association as preemptable rather than the default persistent diff --git a/templates/system/ntp/server/node.tag/prefer/node.def b/templates/system/ntp/server/node.tag/prefer/node.def deleted file mode 100644 index 4855fd41..00000000 --- a/templates/system/ntp/server/node.tag/prefer/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Marks the server as preferred |