Bug 32129

Summary: ntpdc -c does not work as advertised
Product: Base System Reporter: setantae <setantae>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.4-STABLE   
Hardware: Any   
OS: Any   

Description setantae 2001-11-20 11:30:00 UTC
Not sure if this is a documentation bug or a software bug.

The manpage for ntpdc states :

SYNOPSIS
     ntpdc [-ilnps] [-c command] [host ...]

     -c command
             The command argument is interpreted as an interactive format com-
             mand and is added to the list of commands to be executed on the
             specified host(s).  Multiple -c options may be given.

which indicates that all commands specified should default to the host
given on the command line.
This does not happen, since the host is not passed to the command to
be executed unless quotes are used.

Fix: 

The above _is_ a workaround.
However, the documentation suggests that the first method attempted should
work.

Ceri
How-To-Repeat: 
root@rhadamanth setantae# ntpdc -c showpeer ntp2b.mcc.ac.uk
usage: showpeer peer_address [ peer2_addr ] [ peer3_addr ] [ peer4_addr ]
root@rhadamanth setantae# ntpdc -c "showpeer ntp2b.mcc.ac.uk"
remote 130.88.200.98, local 62.254.251.122
hmode client, pmode unspec, stratum 2, precision -26
leap 00, refid [129.132.2.21], rootdistance 0.02753, rootdispersion 0.02296
ppoll 6, hpoll 6, keyid 0, version 4, association 8676
valid 0, reach 001, unreach 1, flash 0x0000, boffset 0.00400, ttl/mode 0
timer 0s, flags config, bclient
reference time:      bfa4b80b.3691d9b1  Tue, Nov 20 2001 11:07:55.213
originate timestamp: bfa4bb35.13702602  Tue, Nov 20 2001 11:21:25.075
receive timestamp:   bfa4bb35.1581f106  Tue, Nov 20 2001 11:21:25.084
transmit timestamp:  bfa4bb35.03d230b9  Tue, Nov 20 2001 11:21:25.014
filter delay:  0.06892  0.00000  0.00000  0.00000
               0.00000  0.00000  0.00000  0.00000
filter offset: 0.026381 0.000000 0.000000 0.000000
               0.000000 0.000000 0.000000 0.000000
filter order:  0        1        2        3
               4        5        6        7
offset 0.026381, delay 0.06892, error bound 2.81735, filter error 0.02467
root@rhadamanth setantae#
Comment 1 Garrett A. Wollman 2001-11-20 23:51:15 UTC
<<On Tue, 20 Nov 2001 11:28:36 +0000, Ceri <setantae@submonkey.net> said:

>      -c command
>              The command argument is interpreted as an interactive format com-
>              mand and is added to the list of commands to be executed on the
>              specified host(s).  Multiple -c options may be given.

> which indicates that all commands specified should default to the host
> given on the command line.

Yes, but that doesn't mean what you think it means.

> root@rhadamanth setantae# ntpdc -c "showpeer ntp2b.mcc.ac.uk"
> remote 130.88.200.98, local 62.254.251.122

This is a query for information *about* ntp2b.mcc.ac.uk from your
machine, pc3-card3-0-cust122.cdf.cable.ntl.com.

The host on the command line is the host to query.  Compare the output
of:

	ntpdc -c peers ntp2b.mcc.ac.uk

and:

	ntpdc -c "peers ntp2b.mcc.ac.uk"

When you said:

> root@rhadamanth setantae# ntpdc -c showpeer ntp2b.mcc.ac.uk

ntpdc correctly interepreted that as a request to query
ntp2b.mcc.ac.uk for some information, but then determined that the
command you gave it (`showpeer') was not properly formed.

-GAWollman
Comment 2 Garrett Wollman freebsd_committer freebsd_triage 2001-11-20 23:51:42 UTC
State Changed
From-To: open->closed

Pilot error.