summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/ntpq
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2004-07-20 15:01:56 +0000
committerroberto <roberto@FreeBSD.org>2004-07-20 15:01:56 +0000
commit118e757284cbb8fc4f43a713e892b41504b50a5f (patch)
tree528d12dda44ebdc3ffcc38050f159ac553a69c17 /contrib/ntp/ntpq
parenta85d9ae25e8e8696677bc30feb6eaf7fc150e529 (diff)
downloadFreeBSD-src-118e757284cbb8fc4f43a713e892b41504b50a5f.zip
FreeBSD-src-118e757284cbb8fc4f43a713e892b41504b50a5f.tar.gz
Virgin import of ntpd 4.2.0
Diffstat (limited to 'contrib/ntp/ntpq')
-rw-r--r--contrib/ntp/ntpq/Makefile.am4
-rw-r--r--contrib/ntp/ntpq/Makefile.in279
-rw-r--r--contrib/ntp/ntpq/ntpq.c401
-rw-r--r--contrib/ntp/ntpq/ntpq.h7
-rw-r--r--contrib/ntp/ntpq/ntpq_ops.c233
5 files changed, 603 insertions, 321 deletions
diff --git a/contrib/ntp/ntpq/Makefile.am b/contrib/ntp/ntpq/Makefile.am
index 918df9c..0bd05fc 100644
--- a/contrib/ntp/ntpq/Makefile.am
+++ b/contrib/ntp/ntpq/Makefile.am
@@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = ../util/ansi2knr
bin_PROGRAMS = ntpq
INCLUDES = -I$(top_srcdir)/include
# LDADD might need RESLIB and ADJLIB
-LDADD = version.o ../libntp/libntp.a @LIBRSAREF@
+ntpq_LDADD = version.o ../libntp/libntp.a @READLINE_LIBS@
DISTCLEANFILES = .version version.c
noinst_HEADERS = ntpq.h
#EXTRA_DIST = ntpq.mak
@@ -16,6 +16,6 @@ $(PROGRAMS): $(LDADD)
../libntp/libntp.a:
cd ../libntp && $(MAKE)
-version.o: $(ntpq_OBJECTS) ../libntp/libntp.a @LIBRSAREF@ Makefile
+version.o: $(ntpq_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/version
env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntpq
$(COMPILE) -c version.c
diff --git a/contrib/ntp/ntpq/Makefile.in b/contrib/ntp/ntpq/Makefile.in
index 8391249..7ddf4d3 100644
--- a/contrib/ntp/ntpq/Makefile.in
+++ b/contrib/ntp/ntpq/Makefile.in
@@ -1,6 +1,7 @@
-# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+# Makefile.in generated by automake 1.7.7 from Makefile.am.
+# @configure_input@
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -13,82 +14,79 @@
@SET_MAKE@
-#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
-
-SHELL = @SHELL@
-
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
-transform = @program_transform_name@
+transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_alias = @build_alias@
build_triplet = @build@
-host_alias = @host_alias@
host_triplet = @host@
-target_alias = @target_alias@
target_triplet = @target@
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
-AUTOKEY = @AUTOKEY@
+ARLIB_DIR = @ARLIB_DIR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
+CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHUTEST = @CHUTEST@
CLKTEST = @CLKTEST@
CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
DCFD = @DCFD@
+DEFS = @DEFS@
DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
EF_LIBS = @EF_LIBS@
EF_PROGS = @EF_PROGS@
+EGREP = @EGREP@
EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LCRYPTO = @LCRYPTO@
LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
LIBPARSE = @LIBPARSE@
-LIBRSAREF = @LIBRSAREF@
+LIBS = @LIBS@
LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
MAKE_ADJTIMED = @MAKE_ADJTIMED@
MAKE_CHECK_Y2K = @MAKE_CHECK_Y2K@
+MAKE_LIBNTPSIM = @MAKE_LIBNTPSIM@
MAKE_LIBPARSE = @MAKE_LIBPARSE@
MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@
-MAKE_LIBRSAREF = @MAKE_LIBRSAREF@
+MAKE_NTPDSIM = @MAKE_NTPDSIM@
MAKE_NTPTIME = @MAKE_NTPTIME@
-MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@
+MAKE_NTP_KEYGEN = @MAKE_NTP_KEYGEN@
MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@
+MAKE_SNTP = @MAKE_SNTP@
MAKE_TICKADJ = @MAKE_TICKADJ@
MAKE_TIMETRIM = @MAKE_TIMETRIM@
OBJEXT = @OBJEXT@
@@ -96,26 +94,70 @@ OPENSSL = @OPENSSL@
OPENSSL_INC = @OPENSSL_INC@
OPENSSL_LIB = @OPENSSL_LIB@
PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_PERL = @PATH_PERL@
+PATH_SEPARATOR = @PATH_SEPARATOR@
PATH_SH = @PATH_SH@
PROPDELAY = @PROPDELAY@
RANLIB = @RANLIB@
-RSADIR = @RSADIR@
-RSAOBJS = @RSAOBJS@
-RSAREF = @RSAREF@
-RSASRCS = @RSASRCS@
+READLINE_LIBS = @READLINE_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
TESTDCF = @TESTDCF@
U = @U@
VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
+am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
AUTOMAKE_OPTIONS = ../util/ansi2knr
bin_PROGRAMS = ntpq
INCLUDES = -I$(top_srcdir)/include
# LDADD might need RESLIB and ADJLIB
-LDADD = version.o ../libntp/libntp.a @LIBRSAREF@
+ntpq_LDADD = version.o ../libntp/libntp.a @READLINE_LIBS@
DISTCLEANFILES = .version version.c
noinst_HEADERS = ntpq.h
#EXTRA_DIST = ntpq.mak
@@ -123,6 +165,7 @@ ETAGS_ARGS = Makefile.am
ntpq_SOURCES = ntpq.c ntpq_ops.c
subdir = ntpq
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -131,17 +174,13 @@ PROGRAMS = $(bin_PROGRAMS)
am_ntpq_OBJECTS = ntpq$U.$(OBJEXT) ntpq_ops$U.$(OBJEXT)
ntpq_OBJECTS = $(am_ntpq_OBJECTS)
-ntpq_LDADD = $(LDADD)
ntpq_DEPENDENCIES = version.o ../libntp/libntp.a
ntpq_LDFLAGS =
-DEFS = @DEFS@
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/depcomp
-@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/ntpq$U.Po $(DEPDIR)/ntpq_ops$U.Po
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ntpq$U.Po ./$(DEPDIR)/ntpq_ops$U.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
@@ -149,7 +188,8 @@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(ntpq_SOURCES)
HEADERS = $(noinst_HEADERS)
-DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in
+DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.in \
+ Makefile.am
SOURCES = $(ntpq_SOURCES)
all: all-am
@@ -160,9 +200,8 @@ $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu ntpq/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) && \
- CONFIG_HEADERS= CONFIG_LINKS= \
- CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@@ -170,16 +209,16 @@ install-binPROGRAMS: $(bin_PROGRAMS)
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
- f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \
- echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \
- $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
- f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
rm -f $(DESTDIR)$(bindir)/$$f; \
done
@@ -201,80 +240,118 @@ ANSI2KNR = ../util/ansi2knr
cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
mostlyclean-kr:
- -rm -f *_.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ntpq$U.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ntpq_ops$U.Po@am__quote@
+ -test "$U" = "" || rm -f *_.c
-distclean-depend:
- -rm -rf $(DEPDIR)
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntpq$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntpq_ops$U.Po@am__quote@
.c.o:
-@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@ fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
-@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- $(COMPILE) -c `cygpath -w $<`
-CCDEPMODE = @CCDEPMODE@
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@ fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
ntpq_.c: ntpq.c $(ANSI2KNR)
- $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpq.c; then echo $(srcdir)/ntpq.c; else echo ntpq.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntpq_.c || rm -f ntpq_.c
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpq.c; then echo $(srcdir)/ntpq.c; else echo ntpq.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
ntpq_ops_.c: ntpq_ops.c $(ANSI2KNR)
- $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpq_ops.c; then echo $(srcdir)/ntpq_ops.c; else echo ntpq_ops.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntpq_ops_.c || rm -f ntpq_ops_.c
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpq_ops.c; then echo $(srcdir)/ntpq_ops.c; else echo ntpq_ops.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
ntpq_.$(OBJEXT) ntpq_ops_.$(OBJEXT) : $(ANSI2KNR)
uninstall-info-am:
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
- mkid -fID $$unique $(LISP)
+ mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
- || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
GTAGS:
- here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
-
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
- @for file in $(DISTFILES); do \
- if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
- $(mkinstalldirs) "$(distdir)/$$dir"; \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
fi; \
if test -d $$d/$$file; then \
- cp -pR $$d/$$file $(distdir) \
- || exit 1; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
@@ -287,7 +364,6 @@ all-am: Makefile $(PROGRAMS) $(HEADERS)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
-
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@@ -299,6 +375,7 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
@@ -306,7 +383,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+ -rm -f $(CONFIG_CLEAN_FILES)
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@@ -317,9 +394,11 @@ clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-depend \
- distclean-generic distclean-tags
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
dvi: dvi-am
@@ -340,6 +419,8 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -347,18 +428,26 @@ mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
-.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \
- clean-generic distclean distclean-compile distclean-depend \
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am info \
info-am install install-am install-binPROGRAMS install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-kr tags uninstall uninstall-am \
- uninstall-binPROGRAMS uninstall-info-am
+ mostlyclean-generic mostlyclean-kr pdf pdf-am ps ps-am tags \
+ uninstall uninstall-am uninstall-binPROGRAMS uninstall-info-am
$(PROGRAMS): $(LDADD)
@@ -366,7 +455,7 @@ $(PROGRAMS): $(LDADD)
../libntp/libntp.a:
cd ../libntp && $(MAKE)
-version.o: $(ntpq_OBJECTS) ../libntp/libntp.a @LIBRSAREF@ Makefile
+version.o: $(ntpq_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/version
env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntpq
$(COMPILE) -c version.c
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/contrib/ntp/ntpq/ntpq.c b/contrib/ntp/ntpq/ntpq.c
index 34404b2..bc12725 100644
--- a/contrib/ntp/ntpq/ntpq.c
+++ b/contrib/ntp/ntpq/ntpq.c
@@ -10,10 +10,16 @@
#include "ntp_io.h"
#include "ntp_select.h"
#include "ntp_stdlib.h"
+/* Don't include ISC's version of IPv6 variables and structures */
+#define ISC_IPV6_H 1
+#include "isc/net.h"
+#include "isc/result.h"
#include <ctype.h>
#include <signal.h>
#include <setjmp.h>
+#include <sys/types.h>
+#include <sys/time.h>
#include <netdb.h>
#ifdef SYS_WINNT
# include <io.h>
@@ -21,10 +27,10 @@
#define closesocket close
#endif /* SYS_WINNT */
-#ifdef HAVE_LIBREADLINE
+#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT)
# include <readline/readline.h>
# include <readline/history.h>
-#endif /* HAVE_LIBREADLINE */
+#endif /* HAVE_LIBREADLINE || HAVE_LIBEDIT */
#ifdef SYS_VXWORKS
/* vxWorks needs mode flag -casey*/
@@ -43,12 +49,11 @@ const char *prompt = "ntpq> "; /* prompt to ask him about */
/*
* Keyid used for authenticated requests. Obtained on the fly.
*/
-u_long info_auth_keyid = NTP_MAXKEY;
+u_long info_auth_keyid = 0;
/*
- * Type of key md5 or des
+ * Type of key md5
*/
-#define KEY_TYPE_DES 3
#define KEY_TYPE_MD5 4
static int info_auth_keytype = KEY_TYPE_MD5; /* MD5 */
@@ -166,7 +171,6 @@ struct ctl_var peer_var[] = {
{ CP_FILTERROR, AR, "filtdisp" }, /* 34 */
{ CP_FLASH, FX, "flash" }, /* 35 */
{ CP_TTL, UI, "ttl" }, /* 36 */
- { CP_TTLMAX, UI, "ttlmax" }, /* 37 */
/*
* These are duplicate entries so that we can
* process deviant version of the ntp protocol.
@@ -292,8 +296,8 @@ struct xcmd builtins[] = {
{ "delay", auth_delay, { OPT|INT, NO, NO, NO },
{ "msec", "", "", "" },
"set the delay added to encryption time stamps" },
- { "host", host, { OPT|STR, NO, NO, NO },
- { "hostname", "", "", "" },
+ { "host", host, { OPT|STR, OPT|STR, NO, NO },
+ { "-4|-6", "hostname", "", "" },
"specify the host whose NTP server we talk to" },
{ "poll", ntp_poll, { OPT|UINT, OPT|STR, NO, NO },
{ "n", "verbose", "", "" },
@@ -345,7 +349,7 @@ struct xcmd builtins[] = {
#define DEFTIMEOUT (5) /* 5 second time out */
#define DEFSTIMEOUT (2) /* 2 second time out after first */
#define DEFDELAY 0x51EB852 /* 20 milliseconds, l_fp fraction */
-#define DEFHOST "127.0.0.1" /* default host name */
+#define DEFHOST "localhost" /* default host name */
#define LENHOSTNAME 256 /* host name is 256 characters long */
#define MAXCMDS 100 /* maximum commands on cmd line */
#define MAXHOSTS 200 /* maximum hosts on cmd line */
@@ -365,13 +369,14 @@ char currenthost[LENHOSTNAME]; /* current host name */
struct sockaddr_in hostaddr = { 0 }; /* host address */
int showhostnames = 1; /* show host names by default */
-int sockfd; /* fd socket is opened on */
+int ai_fam_templ; /* address family */
+int ai_fam_default; /* default address family */
+SOCKET sockfd; /* fd socket is opened on */
int havehost = 0; /* set to 1 when host open */
+int s_port = 0;
struct servent *server_entry = NULL; /* server entry for ntp */
#ifdef SYS_WINNT
-WORD wVersionRequested;
-WSADATA wsaData;
DWORD NumberOfBytesWritten;
HANDLE TimerThreadHandle = NULL; /* 1998/06/03 - Used in ntplib/machines.c */
@@ -496,9 +501,29 @@ ntpqmain(
delay_time.l_ui = 0;
delay_time.l_uf = DEFDELAY;
+#ifdef SYS_WINNT
+ if (!Win32InitSockets())
+ {
+ fprintf(stderr, "No useable winsock.dll:");
+ exit(1);
+ }
+#endif /* SYS_WINNT */
+
+ /* Check to see if we have IPv6. Otherwise force the -4 flag */
+ if (isc_net_probeipv6() != ISC_R_SUCCESS) {
+ ai_fam_default = AF_INET;
+ }
+
progname = argv[0];
- while ((c = ntp_getopt(argc, argv, "c:dinp")) != EOF)
+ ai_fam_templ = ai_fam_default;
+ while ((c = ntp_getopt(argc, argv, "46c:dinp")) != EOF)
switch (c) {
+ case '4':
+ ai_fam_templ = AF_INET;
+ break;
+ case '6':
+ ai_fam_templ = AF_INET6;
+ break;
case 'c':
ADDCMD(ntp_optarg);
break;
@@ -520,7 +545,7 @@ ntpqmain(
}
if (errflg) {
(void) fprintf(stderr,
- "usage: %s [-dinp] [-c cmd] host ...\n",
+ "usage: %s [-46dinp] [-c cmd] host ...\n",
progname);
exit(2);
}
@@ -541,14 +566,6 @@ ntpqmain(
(void) signal_no_reset(SIGINT, abortcmd);
#endif /* SYS_WINNT */
-#ifdef SYS_WINNT
- wVersionRequested = MAKEWORD(1,1);
- if (WSAStartup(wVersionRequested, &wsaData)) {
- fprintf(stderr, "No useable winsock.dll");
- exit(1);
- }
-#endif /* SYS_WINNT */
-
if (numcmds == 0) {
(void) openhost(chosts[0]);
getcmds();
@@ -577,29 +594,69 @@ openhost(
const char *hname
)
{
- u_int32 netnum;
char temphost[LENHOSTNAME];
+ int a_info, i;
+ struct addrinfo hints, *ai = NULL;
+ register const char *cp;
+ char name[LENHOSTNAME];
+ char service[5];
- if (server_entry == NULL) {
- server_entry = getservbyname("ntp", "udp");
- if (server_entry == NULL) {
-#ifdef VMS /* UCX getservbyname() doesn't work [yet], but we do know better */
- server_entry = (struct servent *)
- malloc(sizeof(struct servent));
- server_entry->s_port = htons(NTP_PORT);
-#else
- (void) fprintf(stderr, "%s: ntp/udp: unknown service\n",
- progname);
- exit(1);
-#endif /* VMS & UCX */
- }
- if (debug > 2)
- printf("Got ntp/udp service entry\n");
+ /*
+ * We need to get by the [] if they were entered
+ */
+
+ cp = hname;
+
+ if(*cp == '[') {
+ cp++;
+ for(i = 0; *cp != ']'; cp++, i++)
+ name[i] = *cp;
+ name[i] = '\0';
+ hname = name;
+ }
+
+ /*
+ * First try to resolve it as an ip address and if that fails,
+ * do a fullblown (dns) lookup. That way we only use the dns
+ * when it is needed and work around some implementations that
+ * will return an "IPv4-mapped IPv6 address" address if you
+ * give it an IPv4 address to lookup.
+ */
+ strcpy(service, "ntp");
+ memset((char *)&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = ai_fam_templ;
+ hints.ai_protocol = IPPROTO_UDP;
+ hints.ai_socktype = SOCK_DGRAM;
+ hints.ai_flags = AI_NUMERICHOST;
+
+ a_info = getaddrinfo(hname, service, &hints, &ai);
+ if (a_info == EAI_NONAME || a_info == EAI_NODATA) {
+ hints.ai_flags = AI_CANONNAME;
+#ifdef AI_ADDRCONFIG
+ hints.ai_flags |= AI_ADDRCONFIG;
+#endif
+ a_info = getaddrinfo(hname, service, &hints, &ai);
+ }
+ /* Some older implementations don't like AI_ADDRCONFIG. */
+ if (a_info == EAI_BADFLAGS) {
+ hints.ai_flags = AI_CANONNAME;
+ a_info = getaddrinfo(hname, service, &hints, &ai);
+ }
+ if (a_info != 0) {
+ (void) fprintf(stderr, "%s\n", gai_strerror(a_info));
+ return 0;
+ }
+
+ if (ai->ai_canonname == NULL) {
+ strncpy(temphost, stoa((struct sockaddr_storage *)ai->ai_addr),
+ LENHOSTNAME);
+ temphost[LENHOSTNAME-1] = '\0';
+
+ } else {
+ strncpy(temphost, ai->ai_canonname, LENHOSTNAME);
+ temphost[LENHOSTNAME-1] = '\0';
}
- if (!getnetnum(hname, &netnum, temphost))
- return 0;
-
if (debug > 2)
printf("Opening host %s\n", temphost);
@@ -611,13 +668,17 @@ openhost(
}
(void) strcpy(currenthost, temphost);
- hostaddr.sin_family = AF_INET;
-#ifndef SYS_VXWORKS
- hostaddr.sin_port = server_entry->s_port;
-#else
- hostaddr.sin_port = htons(SERVER_PORT_NUM);
-#endif
- hostaddr.sin_addr.s_addr = netnum;
+ /* port maps to the same location in both families */
+ s_port = ((struct sockaddr_in6 *)ai->ai_addr)->sin6_port;
+#ifdef SYS_VXWORKS
+ ((struct sockaddr_in6 *)&hostaddr)->sin6_port = htons(SERVER_PORT_NUM);
+ if (ai->ai_family == AF_INET)
+ *(struct sockaddr_in *)&hostaddr=
+ *((struct sockaddr_in *)ai->ai_addr);
+ else
+ *(struct sockaddr_in6 *)&hostaddr=
+ *((struct sockaddr_in6 *)ai->ai_addr);
+#endif /* SYS_VXWORKS */
#ifdef SYS_WINNT
{
@@ -629,18 +690,12 @@ openhost(
exit(1);
}
}
+#endif /* SYS_WINNT */
-
- sockfd = socket(AF_INET, SOCK_DGRAM, 0);
+ sockfd = socket(ai->ai_family, SOCK_DGRAM, 0);
if (sockfd == INVALID_SOCKET) {
error("socket", "", "");
- exit(-1);
}
-#else
- sockfd = socket(AF_INET, SOCK_DGRAM, 0);
- if (sockfd == -1)
- error("socket", "", "");
-#endif /* SYS_WINNT */
#ifdef NEED_RCVBUF_SLOP
@@ -653,10 +708,16 @@ openhost(
# endif
#endif
+#ifdef SYS_VXWORKS
if (connect(sockfd, (struct sockaddr *)&hostaddr,
sizeof(hostaddr)) == -1)
+#else
+ if (connect(sockfd, (struct sockaddr *)ai->ai_addr,
+ ai->ai_addrlen) == -1)
+#endif /* SYS_VXWORKS */
error("connect", "", "");
-
+ if (a_info == 0)
+ freeaddrinfo(ai);
havehost = 1;
return 1;
}
@@ -1069,7 +1130,7 @@ sendrequest(
* Fill in the packet
*/
qpkt.li_vn_mode = PKT_LI_VN_MODE(0, pktversion, MODE_CONTROL);
- qpkt.r_m_e_op = (u_char)opcode & CTL_OP_MASK;
+ qpkt.r_m_e_op = (u_char)(opcode & CTL_OP_MASK);
qpkt.sequence = htons(sequence);
qpkt.status = 0;
qpkt.associd = htons((u_short)associd);
@@ -1115,23 +1176,22 @@ sendrequest(
* Get the keyid and the password if we don't have one.
*/
if (info_auth_keyid == 0) {
- maclen = getkeyid("Keyid: ");
- if (maclen == 0) {
+ int u_keyid = getkeyid("Keyid: ");
+ if (u_keyid == 0 || u_keyid > NTP_MAXKEY) {
(void) fprintf(stderr,
"Invalid key identifier\n");
return 1;
}
+ info_auth_keyid = u_keyid;
}
if (!authistrusted(info_auth_keyid)) {
- pass = getpass((info_auth_keytype == KEY_TYPE_DES)
- ? "DES Password: " : "MD5 Password: ");
+ pass = getpass("MD5 Password: ");
if (*pass == '\0') {
(void) fprintf(stderr,
"Invalid password\n");
return (1);
}
}
- info_auth_keyid = maclen;
authusekey(info_auth_keyid, info_auth_keytype, (const u_char *)pass);
authtrust(info_auth_keyid, 1);
@@ -1264,7 +1324,7 @@ doquery(
static void
getcmds(void)
{
-#ifdef HAVE_LIBREADLINE
+#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT)
char *line;
for (;;) {
@@ -1273,7 +1333,7 @@ getcmds(void)
docmd(line);
free(line);
}
-#else /* not HAVE_LIBREADLINE */
+#else /* not (HAVE_LIBREADLINE || HAVE_LIBEDIT) */
char line[MAXLINE];
for (;;) {
@@ -1290,10 +1350,10 @@ getcmds(void)
docmd(line);
}
-#endif /* not HAVE_LIBREADLINE */
+#endif /* not (HAVE_LIBREADLINE || HAVE_LIBEDIT) */
}
-
+#ifndef SYS_WINNT /* Under NT cannot handle SIGINT, WIN32 spawns a handler */
/*
* abortcmd - catch interrupts and abort the current command
*/
@@ -1308,7 +1368,7 @@ abortcmd(
(void) fflush(stderr);
if (jump) longjmp(interrupt_buf, 1);
}
-
+#endif /* SYS_WINNT */
/*
* docmd - decode the command line and execute a command
@@ -1521,7 +1581,7 @@ getarg(
argp->string = str;
break;
case ADD:
- if (!getnetnum(str, &(argp->netnum), (char *)0)) {
+ if (!getnetnum(str, &(argp->netnum), (char *)0, 0)) {
return 0;
}
break;
@@ -1538,10 +1598,14 @@ getarg(
return 0;
}
if (isneg > numassoc) {
- (void) fprintf(stderr,
- "***Association for `%s' unknown (max &%d)\n",
- str, numassoc);
- return 0;
+ if (numassoc == 0) {
+ (void) fprintf(stderr,
+ "***Association for `%s' unknown (max &%d)\n",
+ str, numassoc);
+ return 0;
+ } else {
+ isneg = numassoc;
+ }
}
argp->uval = assoc_cache[isneg-1].assid;
break;
@@ -1573,6 +1637,17 @@ getarg(
argp->ival = -argp->ival;
}
break;
+ case IP_VERSION:
+ if (!strcmp("-6", str))
+ argp->ival = 6 ;
+ else if (!strcmp("-4", str))
+ argp->ival = 4 ;
+ else {
+ (void) fprintf(stderr,
+ "***Version must be either 4 or 6\n");
+ return 0;
+ }
+ break;
}
return 1;
@@ -1586,25 +1661,37 @@ getarg(
int
getnetnum(
const char *hname,
- u_int32 *num,
- char *fullhost
+ struct sockaddr_storage *num,
+ char *fullhost,
+ int af
)
{
- struct hostent *hp;
-
+ int err;
+ int sockaddr_len;
+ struct addrinfo hints, *ai = NULL;
+
+ sockaddr_len = (af == AF_INET)
+ ? sizeof(struct sockaddr_in)
+ : sizeof(struct sockaddr_in6);
+ memset((char *)&hints, 0, sizeof(struct addrinfo));
+ hints.ai_flags = AI_CANONNAME;
+#ifdef AI_ADDRCONFIG
+ hints.ai_flags |= AI_ADDRCONFIG;
+#endif
+
+ /* decodenetnum works with addresses only */
if (decodenetnum(hname, num)) {
if (fullhost != 0) {
- (void) sprintf(fullhost, "%lu.%lu.%lu.%lu",
- (u_long)((htonl(*num) >> 24) & 0xff),
- (u_long)((htonl(*num) >> 16) & 0xff),
- (u_long)((htonl(*num) >> 8) & 0xff),
- (u_long)(htonl(*num) & 0xff));
+ getnameinfo((struct sockaddr *)num, sockaddr_len,
+ fullhost, sizeof(fullhost), NULL, 0,
+ NI_NUMERICHOST);
+
}
return 1;
- } else if ((hp = gethostbyname(hname)) != 0) {
- memmove((char *)num, hp->h_addr, sizeof(u_int32));
- if (fullhost != 0)
- (void) strcpy(fullhost, hp->h_name);
+ } else if ((err = getaddrinfo(hname, "ntp", &hints, &ai)) == 0) {
+ memmove((char *)num, ai->ai_addr, ai->ai_addrlen);
+ if (ai->ai_canonname != 0)
+ (void) strcpy(fullhost, ai->ai_canonname);
return 1;
} else {
(void) fprintf(stderr, "***Can't find host %s\n", hname);
@@ -1619,14 +1706,14 @@ getnetnum(
*/
char *
nntohost(
- u_int32 netnum
+ struct sockaddr_storage *netnum
)
{
if (!showhostnames)
- return numtoa(netnum);
- if ((ntohl(netnum) & REFCLOCK_MASK) == REFCLOCK_ADDR)
- return refnumtoa(netnum);
- return numtohost(netnum);
+ return stoa(netnum);
+ if ((netnum->ss_family == AF_INET) && ISREFCLOCKADR(netnum))
+ return refnumtoa(netnum);
+ return socktohost(netnum);
}
@@ -1671,10 +1758,10 @@ rtdatetolfp(
return 0;
}
- cal.monthday = *cp++ - '0'; /* ascii dependent */
+ cal.monthday = (u_char) (*cp++ - '0'); /* ascii dependent */
if (isdigit((int)*cp)) {
- cal.monthday = (cal.monthday << 3) + (cal.monthday << 1);
- cal.monthday += *cp++ - '0';
+ cal.monthday = (u_char)((cal.monthday << 3) + (cal.monthday << 1));
+ cal.monthday = (u_char)(cal.monthday + *cp++ - '0');
}
if (*cp++ != '-')
@@ -1689,25 +1776,25 @@ rtdatetolfp(
break;
if (i == 12)
return 0;
- cal.month = i + 1;
+ cal.month = (u_char)(i + 1);
if (*cp++ != '-')
return 0;
if (!isdigit((int)*cp))
return 0;
- cal.year = *cp++ - '0';
+ cal.year = (u_short)(*cp++ - '0');
if (isdigit((int)*cp)) {
- cal.year = (cal.year << 3) + (cal.year << 1);
- cal.year += *cp++ - '0';
+ cal.year = (u_short)((cal.year << 3) + (cal.year << 1));
+ cal.year = (u_short)(*cp++ - '0');
}
if (isdigit((int)*cp)) {
- cal.year = (cal.year << 3) + (cal.year << 1);
- cal.year += *cp++ - '0';
+ cal.year = (u_short)((cal.year << 3) + (cal.year << 1));
+ cal.year = (u_short)(cal.year + *cp++ - '0');
}
if (isdigit((int)*cp)) {
- cal.year = (cal.year << 3) + (cal.year << 1);
- cal.year += *cp++ - '0';
+ cal.year = (u_short)((cal.year << 3) + (cal.year << 1));
+ cal.year = (u_short)(cal.year + *cp++ - '0');
}
/*
@@ -1720,26 +1807,26 @@ rtdatetolfp(
if (*cp++ != ' ' || !isdigit((int)*cp))
return 0;
- cal.hour = *cp++ - '0';
+ cal.hour = (u_char)(*cp++ - '0');
if (isdigit((int)*cp)) {
- cal.hour = (cal.hour << 3) + (cal.hour << 1);
- cal.hour += *cp++ - '0';
+ cal.hour = (u_char)((cal.hour << 3) + (cal.hour << 1));
+ cal.hour = (u_char)(cal.hour + *cp++ - '0');
}
if (*cp++ != ':' || !isdigit((int)*cp))
return 0;
- cal.minute = *cp++ - '0';
+ cal.minute = (u_char)(*cp++ - '0');
if (isdigit((int)*cp)) {
- cal.minute = (cal.minute << 3) + (cal.minute << 1);
- cal.minute += *cp++ - '0';
+ cal.minute = (u_char)((cal.minute << 3) + (cal.minute << 1));
+ cal.minute = (u_char)(cal.minute + *cp++ - '0');
}
if (*cp++ != ':' || !isdigit((int)*cp))
return 0;
- cal.second = *cp++ - '0';
+ cal.second = (u_char)(*cp++ - '0');
if (isdigit((int)*cp)) {
- cal.second = (cal.second << 3) + (cal.second << 1);
- cal.second += *cp++ - '0';
+ cal.second = (u_char)((cal.second << 3) + (cal.second << 1));
+ cal.second = (u_char)(cal.second + *cp++ - '0');
}
/*
@@ -1828,8 +1915,8 @@ decodeint(
{
if (*str == '0') {
if (*(str+1) == 'x' || *(str+1) == 'X')
- return hextoint(str+2, (u_long *)&val);
- return octtoint(str, (u_long *)&val);
+ return hextoint(str+2, (void *)&val);
+ return octtoint(str, (void *)&val);
}
return atoint(str, val);
}
@@ -1975,8 +2062,8 @@ helpsort(
const void *t2
)
{
- const char **name1 = (const char **)t1;
- const char **name2 = (const char **)t2;
+ char const * const * name1 = (char const * const *)t1;
+ char const * const * name2 = (char const * const *)t2;
return strcmp(*name1, *name2);
}
@@ -2079,12 +2166,34 @@ host(
FILE *fp
)
{
+ int i;
+
if (pcmd->nargs == 0) {
if (havehost)
(void) fprintf(fp, "current host is %s\n", currenthost);
else
(void) fprintf(fp, "no current host\n");
- } else if (openhost(pcmd->argval[0].string)) {
+ return;
+ }
+
+ i = 0;
+ ai_fam_templ = ai_fam_default;
+ if (pcmd->nargs == 2) {
+ if (!strcmp("-4", pcmd->argval[i].string))
+ ai_fam_templ = AF_INET;
+ else if (!strcmp("-6", pcmd->argval[i].string))
+ ai_fam_templ = AF_INET6;
+ else {
+ if (havehost)
+ (void) fprintf(fp,
+ "current host remains %s\n", currenthost);
+ else
+ (void) fprintf(fp, "still no current host\n");
+ return;
+ }
+ i = 1;
+ }
+ if (openhost(pcmd->argval[i].string)) {
(void) fprintf(fp, "current host set to %s\n", currenthost);
numassoc = 0;
} else {
@@ -2121,11 +2230,14 @@ keyid(
)
{
if (pcmd->nargs == 0) {
- if (info_auth_keyid > NTP_MAXKEY)
+ if (info_auth_keyid == 0)
(void) fprintf(fp, "no keyid defined\n");
else
(void) fprintf(fp, "keyid is %lu\n", (u_long)info_auth_keyid);
} else {
+ /* allow zero so that keyid can be cleared. */
+ if(pcmd->argval[0].uval > NTP_MAXKEY)
+ (void) fprintf(fp, "Invalid key identifier\n");
info_auth_keyid = pcmd->argval[0].uval;
}
}
@@ -2141,7 +2253,7 @@ keytype(
{
if (pcmd->nargs == 0)
fprintf(fp, "keytype is %s\n",
- (info_auth_keytype == KEY_TYPE_MD5) ? "MD5" : "DES");
+ (info_auth_keytype == KEY_TYPE_MD5) ? "MD5" : "???");
else
switch (*(pcmd->argval[0].string)) {
case 'm':
@@ -2149,13 +2261,8 @@ keytype(
info_auth_keytype = KEY_TYPE_MD5;
break;
- case 'd':
- case 'D':
- info_auth_keytype = KEY_TYPE_DES;
- break;
-
default:
- fprintf(fp, "keytype must be 'md5' or 'des'\n");
+ fprintf(fp, "keytype must be 'md5'\n");
}
}
@@ -2173,21 +2280,21 @@ passwd(
{
char *pass;
- if (info_auth_keyid > NTP_MAXKEY) {
- info_auth_keyid = getkeyid("Keyid: ");
- if (info_auth_keyid > NTP_MAXKEY) {
- (void)fprintf(fp, "Keyid must be defined\n");
+ if (info_auth_keyid == 0) {
+ int u_keyid = getkeyid("Keyid: ");
+ if (u_keyid == 0 || u_keyid > NTP_MAXKEY) {
+ (void)fprintf(fp, "Invalid key identifier\n");
return;
}
+ info_auth_keyid = u_keyid;
}
- pass = getpass((info_auth_keytype == KEY_TYPE_DES)
- ? "DES Password: "
- : "MD5 Password: "
- );
+ pass = getpass("MD5 Password: ");
if (*pass == '\0')
(void) fprintf(fp, "Password unchanged\n");
- else
+ else {
authusekey(info_auth_keyid, info_auth_keytype, (u_char *)pass);
+ authtrust(info_auth_keyid, 1);
+ }
}
@@ -2412,7 +2519,7 @@ getkeyid(
fprintf(stderr, "%s", keyprompt); fflush(stderr);
for (p=pbuf; (c = getc(fi))!='\n' && c!=EOF;) {
if (p < &pbuf[18])
- *p++ = c;
+ *p++ = (char)c;
}
*p = '\0';
if (fi != stdin)
@@ -2460,7 +2567,7 @@ atoascii(
if (c < ' ') {
*ocp++ = '^';
- *ocp++ = c + '@';
+ *ocp++ = (u_char)(c + '@');
} else if (c == 0177) {
*ocp++ = '^';
*ocp++ = '?';
@@ -2885,12 +2992,12 @@ cookedprint(
register int varid;
char *name;
char *value;
- int output_raw;
+ char output_raw;
int fmt;
struct ctl_var *varlist;
l_fp lfp;
long ival;
- u_int32 hval;
+ struct sockaddr_storage hval;
u_long uval;
l_fp lfparr[8];
int narr;
@@ -2969,10 +3076,11 @@ cookedprint(
case NA:
if (!decodenetnum(value, &hval))
output_raw = '?';
- else if (fmt == HA)
- output(fp, name, nntohost(hval));
- else
- output(fp, name, numtoa(hval));
+ else if (fmt == HA){
+ output(fp, name, nntohost(&hval));
+ } else {
+ output(fp, name, stoa(&hval));
+ }
break;
case ST:
@@ -2980,9 +3088,14 @@ cookedprint(
break;
case RF:
- if (decodenetnum(value, &hval))
- output(fp, name, nntohost(hval));
- else if ((int)strlen(value) <= 4)
+ if (decodenetnum(value, &hval)) {
+ if ((hval.ss_family == AF_INET) &&
+ ISREFCLOCKADR(&hval))
+ output(fp, name,
+ refnumtoa(&hval));
+ else
+ output(fp, name, stoa(&hval));
+ } else if ((int)strlen(value) <= 4)
output(fp, name, value);
else
output_raw = '?';
diff --git a/contrib/ntp/ntpq/ntpq.h b/contrib/ntp/ntpq/ntpq.h
index 8739cd4..1bb1028 100644
--- a/contrib/ntp/ntpq/ntpq.h
+++ b/contrib/ntp/ntpq/ntpq.h
@@ -22,6 +22,7 @@
#define UINT 0x2 /* unsigned integer */
#define INT 0x3 /* signed integer */
#define ADD 0x4 /* IP network address */
+#define IP_VERSION 0x5 /* IP address family */
/*
* Arguments are returned in a union
@@ -30,7 +31,7 @@ typedef union {
char *string;
long ival;
u_long uval;
- u_int32 netnum;
+ struct sockaddr_storage netnum;
} arg_v;
/*
@@ -76,10 +77,10 @@ struct ctl_var {
};
extern void asciize P((int, char *, FILE *));
-extern int getnetnum P((const char *, u_int32 *, char *));
+extern int getnetnum P((const char *, struct sockaddr_storage *, char *, int));
extern void sortassoc P((void));
extern int doquery P((int, int, int, int, char *, u_short *, int *, char **));
-extern char * nntohost P((u_int32));
+extern char * nntohost P((struct sockaddr_storage *));
extern int decodets P((char *, l_fp *));
extern int decodeuint P((char *, u_long *));
extern int nextvar P((int *, char **, char **, char **));
diff --git a/contrib/ntp/ntpq/ntpq_ops.c b/contrib/ntp/ntpq/ntpq_ops.c
index c907503..c493631 100644
--- a/contrib/ntp/ntpq/ntpq_ops.c
+++ b/contrib/ntp/ntpq/ntpq_ops.c
@@ -1,15 +1,16 @@
/*
- * ntpdc_ops.c - subroutines which are called to perform operations by ntpdc
+ * ntpq_ops.c - subroutines which are called to perform operations by ntpq
*/
#include <stdio.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <netdb.h>
#include "ntpq.h"
#include "ntp_stdlib.h"
-#include <ctype.h>
-#include <netdb.h>
-
extern char * chosts[];
extern char currenthost[];
extern int numhosts;
@@ -55,12 +56,12 @@ static void radiostatus P((struct parse *, FILE *));
static void pstatus P((struct parse *, FILE *));
static long when P((l_fp *, l_fp *, l_fp *));
static char * prettyinterval P((char *, long));
-static int doprintpeers P((struct varlist *, int, int, int, char *, FILE *));
-static int dogetpeers P((struct varlist *, int, FILE *));
-static void dopeers P((int, FILE *));
+static int doprintpeers P((struct varlist *, int, int, int, char *, FILE *, int));
+static int dogetpeers P((struct varlist *, int, FILE *, int));
+static void dopeers P((int, FILE *, int));
static void peers P((struct parse *, FILE *));
static void lpeers P((struct parse *, FILE *));
-static void doopeers P((int, FILE *));
+static void doopeers P((int, FILE *, int));
static void opeers P((struct parse *, FILE *));
static void lopeers P((struct parse *, FILE *));
@@ -138,20 +139,20 @@ struct xcmd opcmds[] = {
{ "pstatus", pstatus, { UINT, NO, NO, NO },
{ "assocID", "", "", "" },
"print status information returned for a peer" },
- { "peers", peers, { NO, NO, NO, NO },
- { "", "", "", "" },
- "obtain and print a list of the server's peers" },
- { "lpeers", lpeers, { NO, NO, NO, NO },
- { "", "", "", "" },
- "obtain and print a list of all peers and clients" },
- { "opeers", opeers, { NO, NO, NO, NO },
- { "", "", "", "" },
- "print peer list the old way, with dstadr shown rather than refid" },
- { "lopeers", lopeers, { NO, NO, NO, NO },
- { "", "", "", "" },
- "obtain and print a list of all peers and clients showing dstadr" },
+ { "peers", peers, { OPT|IP_VERSION, NO, NO, NO },
+ { "-4|-6", "", "", "" },
+ "obtain and print a list of the server's peers [IP version]" },
+ { "lpeers", lpeers, { OPT|IP_VERSION, NO, NO, NO },
+ { "-4|-6", "", "", "" },
+ "obtain and print a list of all peers and clients [IP version]" },
+ { "opeers", opeers, { OPT|IP_VERSION, NO, NO, NO },
+ { "-4|-6", "", "", "" },
+ "print peer list the old way, with dstadr shown rather than refid [IP version]" },
+ { "lopeers", lopeers, { OPT|IP_VERSION, NO, NO, NO },
+ { "-4|-6", "", "", "" },
+ "obtain and print a list of all peers and clients showing dstadr [IP version]" },
{ 0, 0, { NO, NO, NO, NO },
- { "", "", "", "" }, "" }
+ { "-4|-6", "", "", "" }, "" }
};
@@ -864,7 +865,7 @@ dogetassoc(
u_short rstatus;
res = doquery(CTL_OP_READSTAT, 0, 0, 0, (char *)0, &rstatus,
- &dsize, (char **)&datap);
+ &dsize, (void *)&datap);
if (res != 0)
return 0;
@@ -931,7 +932,7 @@ printassoc(
(void) fprintf(fp,
"===========================================================\n");
for (i = 0; i < numassoc; i++) {
- statval = CTL_PEER_STATVAL(assoc_cache[i].status);
+ statval = (u_char) CTL_PEER_STATVAL(assoc_cache[i].status);
if (!showall && !(statval & (CTL_PST_CONFIG|CTL_PST_REACH)))
continue;
event = CTL_PEER_EVENT(assoc_cache[i].status);
@@ -1231,6 +1232,38 @@ prettyinterval(
return buf;
}
+static char
+decodeaddrtype(
+ struct sockaddr_storage *sock
+ )
+{
+ char ch = '-';
+ u_int32 dummy;
+ struct sockaddr_in6 *sin6;
+
+ switch(sock->ss_family) {
+ case AF_INET:
+ dummy = ((struct sockaddr_in *)sock)->sin_addr.s_addr;
+ dummy = ntohl(dummy);
+ ch = (char)(((dummy&0xf0000000)==0xe0000000) ? 'm' :
+ ((dummy&0x000000ff)==0x000000ff) ? 'b' :
+ ((dummy&0xffffffff)==0x7f000001) ? 'l' :
+ ((dummy&0xffffffe0)==0x00000000) ? '-' :
+ 'u');
+ break;
+ case AF_INET6:
+ sin6 = (struct sockaddr_in6 *)sock;
+ if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
+ ch = 'm';
+ else
+ ch = 'u';
+ break;
+ default:
+ ch = '-';
+ break;
+ }
+ return ch;
+}
/*
* A list of variables required by the peers command
@@ -1295,22 +1328,23 @@ doprintpeers(
int rstatus,
int datalen,
char *data,
- FILE *fp
+ FILE *fp,
+ int af
)
{
char *name;
- char *value;
+ char *value = NULL;
int i;
int c;
- u_int32 srcadr;
- u_int32 dstadr;
- u_long srcport;
- const char *dstadr_refid = "0.0.0.0";
- u_long stratum;
- long ppoll;
- long hpoll;
- u_long reach;
+ struct sockaddr_storage srcadr;
+ struct sockaddr_storage dstadr;
+ u_long srcport = 0;
+ char *dstadr_refid = "0.0.0.0";
+ u_long stratum = 0;
+ long ppoll = 0;
+ long hpoll = 0;
+ u_long reach = 0;
l_fp estoffset;
l_fp estdelay;
l_fp estjitter;
@@ -1323,12 +1357,22 @@ doprintpeers(
char type = '?';
char refid_string[10];
char whenbuf[8], pollbuf[8];
+ char clock_name[LENHOSTNAME];
memset((char *)havevar, 0, sizeof(havevar));
get_systime(&ts);
+
+ memset((char *)&srcadr, 0, sizeof(struct sockaddr_storage));
+ memset((char *)&dstadr, 0, sizeof(struct sockaddr_storage));
+
+ /* Initialize by zeroing out estimate variables */
+ memset((char *)&estoffset, 0, sizeof(l_fp));
+ memset((char *)&estdelay, 0, sizeof(l_fp));
+ memset((char *)&estjitter, 0, sizeof(l_fp));
+ memset((char *)&estdisp, 0, sizeof(l_fp));
while (nextvar(&datalen, &data, &name, &value)) {
- u_int32 dummy;
+ struct sockaddr_storage dum_store;
i = findvar(name, peer_var);
if (i == 0)
@@ -1339,18 +1383,12 @@ doprintpeers(
havevar[HAVE_SRCADR] = 1;
break;
case CP_DSTADR:
- if (decodenetnum(value, &dummy)) {
- dummy = ntohl(dummy);
- type = ((dummy&0xf0000000)==0xe0000000) ? 'm' :
- ((dummy&0x000000ff)==0x000000ff) ? 'b' :
- ((dummy&0xffffffff)==0x7f000001) ? 'l' :
- ((dummy&0xffffffe0)==0x00000000) ? '-' :
- 'u';
- }
+ if (decodenetnum(value, &dum_store))
+ type = decodeaddrtype(&dum_store);
if (pvl == opeervarlist) {
if (decodenetnum(value, &dstadr)) {
havevar[HAVE_DSTADR] = 1;
- dstadr_refid = numtoa(dstadr);
+ dstadr_refid = stoa(&dstadr);
}
}
break;
@@ -1360,10 +1398,15 @@ doprintpeers(
if (*value == '\0') {
dstadr_refid = "0.0.0.0";
} else if (decodenetnum(value, &dstadr)) {
- if (dstadr == 0)
+ if (SOCKNUL(&dstadr))
dstadr_refid = "0.0.0.0";
+ else if ((dstadr.ss_family == AF_INET)
+ && ISREFCLOCKADR(&dstadr))
+ dstadr_refid =
+ refnumtoa(&dstadr);
else
- dstadr_refid = nntohost(dstadr);
+ dstadr_refid =
+ stoa(&dstadr);
} else if ((int)strlen(value) <= 4) {
refid_string[0] = '.';
(void) strcpy(&refid_string[1], value);
@@ -1449,15 +1492,21 @@ doprintpeers(
c = flash2[CTL_PEER_STATVAL(rstatus) & 0x3];
if (numhosts > 1)
(void) fprintf(fp, "%-*s ", maxhostlen, currenthost);
- (void) fprintf(fp,
- "%c%-15.15s %-15.15s %2ld %c %4.4s %4.4s %3lo %7.7s %8.7s %7.7s\n",
- c, nntohost(srcadr), dstadr_refid, stratum, type,
- prettyinterval(whenbuf, when(&ts, &rec, &reftime)),
- prettyinterval(pollbuf, (int)poll_sec), reach,
- lfptoms(&estdelay, 3), lfptoms(&estoffset, 3),
- havevar[HAVE_JITTER] ? lfptoms(&estjitter, 3) :
- lfptoms(&estdisp, 3));
- return (1);
+ if (af == 0 || srcadr.ss_family == af){
+ strcpy(clock_name, nntohost(&srcadr));
+
+ (void) fprintf(fp,
+ "%c%-15.15s %-15.15s %2ld %c %4.4s %4.4s %3lo %7.7s %8.7s %7.7s\n",
+ c, clock_name, dstadr_refid, stratum, type,
+ prettyinterval(whenbuf, when(&ts, &rec, &reftime)),
+ prettyinterval(pollbuf, (int)poll_sec), reach,
+ lfptoms(&estdelay, 3), lfptoms(&estoffset, 3),
+ havevar[HAVE_JITTER] ? lfptoms(&estjitter, 3) :
+ lfptoms(&estdisp, 3));
+ return (1);
+ }
+ else
+ return(1);
}
#undef HAVE_SRCADR
@@ -1485,7 +1534,8 @@ static int
dogetpeers(
struct varlist *pvl,
int associd,
- FILE *fp
+ FILE *fp,
+ int af
)
{
char *datap;
@@ -1514,8 +1564,7 @@ dogetpeers(
return 0;
}
-
- return doprintpeers(pvl, associd, (int)rstatus, dsize, datap, fp);
+ return doprintpeers(pvl, associd, (int)rstatus, dsize, datap, fp, af);
}
@@ -1525,27 +1574,26 @@ dogetpeers(
static void
dopeers(
int showall,
- FILE *fp
+ FILE *fp,
+ int af
)
{
register int i;
char fullname[LENHOSTNAME];
- u_int32 netnum;
+ struct sockaddr_storage netnum;
if (!dogetassoc(fp))
return;
- maxhostlen = 0;
- if (numhosts > 1) {
- for (i = 0; i < numhosts; ++i)
- { if(getnetnum(chosts[i],&netnum,fullname))
+ for (i = 0; i < numhosts; ++i) {
+ if (getnetnum(chosts[i], &netnum, fullname, af))
if ((int)strlen(fullname) > maxhostlen)
- maxhostlen = strlen(fullname);
- }
- (void) fprintf(fp, "%-*.*s ", maxhostlen, maxhostlen, "host");
+ maxhostlen = strlen(fullname);
}
- fprintf(fp,
- " remote refid st t when poll reach delay offset jitter\n");
+ if (numhosts > 1)
+ (void) fprintf(fp, "%-*.*s ", maxhostlen, maxhostlen, "host");
+ (void) fprintf(fp,
+ " remote refid st t when poll reach delay offset jitter\n");
if (numhosts > 1)
for (i = 0; i <= maxhostlen; ++i)
(void) fprintf(fp, "=");
@@ -1557,7 +1605,7 @@ dopeers(
!(CTL_PEER_STATVAL(assoc_cache[i].status)
& (CTL_PST_CONFIG|CTL_PST_REACH)))
continue;
- if (!dogetpeers(peervarlist, (int)assoc_cache[i].assid, fp)) {
+ if (!dogetpeers(peervarlist, (int)assoc_cache[i].assid, fp, af)) {
return;
}
}
@@ -1575,7 +1623,15 @@ peers(
FILE *fp
)
{
- dopeers(0, fp);
+ int af = 0;
+
+ if (pcmd->nargs == 1) {
+ if (pcmd->argval->ival == 6)
+ af = AF_INET6;
+ else
+ af = AF_INET;
+ }
+ dopeers(0, fp, af);
}
@@ -1589,7 +1645,15 @@ lpeers(
FILE *fp
)
{
- dopeers(1, fp);
+ int af = 0;
+
+ if (pcmd->nargs == 1) {
+ if (pcmd->argval->ival == 6)
+ af = AF_INET6;
+ else
+ af = AF_INET;
+ }
+ dopeers(1, fp, af);
}
@@ -1599,7 +1663,8 @@ lpeers(
static void
doopeers(
int showall,
- FILE *fp
+ FILE *fp,
+ int af
)
{
register int i;
@@ -1610,8 +1675,6 @@ doopeers(
(void) fprintf(fp,
" remote local st t when poll reach delay offset disp\n");
(void) fprintf(fp,
- " (s) (s) (ms) (ms) (ms)\n");
- (void) fprintf(fp,
"==============================================================================\n");
for (i = 0; i < numassoc; i++) {
@@ -1619,7 +1682,7 @@ doopeers(
!(CTL_PEER_STATVAL(assoc_cache[i].status)
& (CTL_PST_CONFIG|CTL_PST_REACH)))
continue;
- if (!dogetpeers(opeervarlist, (int)assoc_cache[i].assid, fp)) {
+ if (!dogetpeers(opeervarlist, (int)assoc_cache[i].assid, fp, af)) {
return;
}
}
@@ -1637,7 +1700,15 @@ opeers(
FILE *fp
)
{
- doopeers(0, fp);
+ int af = 0;
+
+ if (pcmd->nargs == 1) {
+ if (pcmd->argval->ival == 6)
+ af = AF_INET6;
+ else
+ af = AF_INET;
+ }
+ doopeers(0, fp, af);
}
@@ -1651,5 +1722,13 @@ lopeers(
FILE *fp
)
{
- doopeers(1, fp);
+ int af = 0;
+
+ if (pcmd->nargs == 1) {
+ if (pcmd->argval->ival == 6)
+ af = AF_INET6;
+ else
+ af = AF_INET;
+ }
+ doopeers(1, fp, af);
}
OpenPOWER on IntegriCloud