[pkg-ntp-maintainers] Bug#476193: ntpdc times out when the server monlist has over 600 clients

Josip Rodin joy at debbugs.entuzijast.net
Tue Apr 15 00:44:25 UTC 2008


Package: ntp
Tags: upstream

Hi,

I've been getting inexplicable errors from 'ntpdc -c monl <hostname>':

<hostname>: timed out with incomplete data

They didn't appear to make any sense, because tcpdump was showing that
traffic was flowing, and then the program just decided to give up.
Running with -d shows:

Received sequence numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, last frame not received

The numbers varied between 57 and 94.

After numerous repeats, ocasionally I would get the actual monlist,
and it contained <= 600 hosts.

Apparently the people at support.ntp.org have it documented:

http://support.ntp.org/bin/view/Support/MonitoringAndControllingNTP#Who_is_using_my_NTP_server

|  Please note that a maximum of 600 entries is supported with current
|  versions of ntpdc. The protocol (or better: the contents of the return
|  packets) used by ntpdc is not standardized, therefore it is recommended
|  to only use ntpdc with a matching ntpd, i.e. both should have the same
|  version number.
|
|  To get by this 600 entry limitation, many server operators run client
|  statistics scripts [...]

I went to look at the code, and it looks like ntpdc/ntpdc.c is printing the
contents of the haveseq array, whose size is MAXSEQ+1, which would be 128,
so that doesn't sound like. At the other end,
ntpd/ntp_request.c:mon_getlist_0() is sending over all of the mon_data
structures found in mon_mru_list, and after looking at that, I see the
culprit in ntpd/ntp_monitor.c:

/*
 * Limits on the number of structures allocated.  This limit is picked  
 * with the illicit knowlege that we can only return somewhat less
 * than 8K bytes in a mode 7 response packet, and that each structure
 * will require about 20 bytes of space in the response.
 *
 * ... I don't believe the above is true anymore ... jdg
 */
#ifndef MAXMONMEM 
#define MAXMONMEM       600     /* we allocate up to 600 structures */
#endif
[...]
int
ntp_monitor(
[...]
        if (mon_free == NULL && mon_total_mem >= MAXMONMEM) {
[...]

I can't help but think that there are better ways to handle this in
both ntpd and ntpdc. :)

Please fix this. TIA.

-- 
     2. That which causes joy or happiness.





More information about the pkg-ntp-maintainers mailing list