summaryrefslogtreecommitdiff
path: root/scripts/lib
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/Makefile.in14
-rw-r--r--scripts/lib/NTP/Util.pm19
2 files changed, 27 insertions, 6 deletions
diff --git a/scripts/lib/Makefile.in b/scripts/lib/Makefile.in
index 1afcf7d..2b0f097 100644
--- a/scripts/lib/Makefile.in
+++ b/scripts/lib/Makefile.in
@@ -39,8 +39,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
$(top_srcdir)/sntp/libopts/m4/stdnoreturn.m4 \
- $(top_srcdir)/sntp/libevent/m4/openldap-thread-check.m4 \
- $(top_srcdir)/sntp/libevent/m4/openldap.m4 \
+ $(top_srcdir)/sntp/m4/ax_c99_struct_init.m4 \
$(top_srcdir)/sntp/m4/define_dir.m4 \
$(top_srcdir)/sntp/m4/hms_search_lib.m4 \
$(top_srcdir)/sntp/m4/libtool.m4 \
@@ -51,6 +50,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
$(top_srcdir)/sntp/m4/ntp_cacheversion.m4 \
$(top_srcdir)/sntp/m4/ntp_compiler.m4 \
$(top_srcdir)/sntp/m4/ntp_crosscompile.m4 \
+ $(top_srcdir)/sntp/m4/ntp_crypto_rand.m4 \
$(top_srcdir)/sntp/m4/ntp_debug.m4 \
$(top_srcdir)/sntp/m4/ntp_dir_sep.m4 \
$(top_srcdir)/sntp/m4/ntp_facilitynames.m4 \
@@ -68,6 +68,8 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
$(top_srcdir)/sntp/m4/ntp_sntp.m4 \
$(top_srcdir)/sntp/m4/ntp_ver_suffix.m4 \
$(top_srcdir)/sntp/m4/ntp_vpathhack.m4 \
+ $(top_srcdir)/sntp/m4/openldap-thread-check.m4 \
+ $(top_srcdir)/sntp/m4/openldap.m4 \
$(top_srcdir)/sntp/m4/os_cflags.m4 \
$(top_srcdir)/sntp/m4/snprintf.m4 \
$(top_srcdir)/sntp/m4/version.m4 $(top_srcdir)/configure.ac
@@ -131,6 +133,7 @@ CHUTEST = @CHUTEST@
CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
CXX = @CXX@
CXXCPP = @CXXCPP@
@@ -165,7 +168,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
LDADD_NLIST = @LDADD_NLIST@
LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
@@ -304,6 +309,11 @@ TIMETRIM_DL = @TIMETRIM_DL@
TIMETRIM_DS = @TIMETRIM_DS@
TIMETRIM_MS = @TIMETRIM_MS@
TIMETRIM_NI = @TIMETRIM_NI@
+UPDATE_LEAP_DB = @UPDATE_LEAP_DB@
+UPDATE_LEAP_DL = @UPDATE_LEAP_DL@
+UPDATE_LEAP_DS = @UPDATE_LEAP_DS@
+UPDATE_LEAP_MS = @UPDATE_LEAP_MS@
+UPDATE_LEAP_NI = @UPDATE_LEAP_NI@
VERSION = @VERSION@
VER_SUFFIX = @VER_SUFFIX@
YACC = @YACC@
diff --git a/scripts/lib/NTP/Util.pm b/scripts/lib/NTP/Util.pm
index 66f2453..cd2f9e5 100644
--- a/scripts/lib/NTP/Util.pm
+++ b/scripts/lib/NTP/Util.pm
@@ -93,18 +93,27 @@ sub do_dns {
sub ntp_peers {
my ($host) = @_;
- my $cmd = "$ntpq_path -np $host |";
+ $host ||= '';
+ my $cmd = "$ntpq_path -npw $host |";
open my $fh, $cmd or croak "Could not start ntpq: $!";
<$fh> for 1 .. 2;
- my @columns = qw(remote refid st t when poll reach delay offset jitter);
+ my @columns = qw(tally host refid st t when poll reach delay offset jitter);
my @peers;
while (<$fh>) {
- if (/(?:[\w\.\*-]+\s*){10}/) {
+ if (/^([ x+#*o-])((?:[\w.*:-]+\s+){10}|([\w.*:-]+\s+))$/) {
my $col = 0;
- push @peers, { map {; $columns[ $col++ ] => $_ } split /(?<=.)\s+/ };
+ my @line = ($1, split /\s+/, $2);
+ if( @line == 2 ) {
+ defined ($_ = <$fh>) or last;
+ s/^\s+//;
+ push @line, split /\s+/;
+ }
+ my $r = { map {; $columns[ $col++ ] => $_ } @line };
+ $r->{remote} = $r->{tally} . $r->{host};
+ push @peers, $r;
}
else {
#TODO return error (but not needed anywhere now)
@@ -135,3 +144,5 @@ sub ntp_sntp_line {
close $fh or croak "running sntp failed: $! (exit status $?)";
return ($offset, $stratum);
}
+
+1;