From: peppe@ipgaix.unipg.it (G. Vitillaro)
Subject: xntp3 under AIX/370 1.2.1 (Update Level 1400)
Summary: xntp3 hangs under AIX/370 1.2.1
Keywords: xntp3, AIX/370, hang
Organization: Universita' di Perugia
Date: Tue, 22 Dec 1992 12:05:01 GMT

Sorry to invade this groups again on a problem that maybe is
very particular, but I would really need some help from someone
more skilled than me on xntp.

I did some little debugging on xntpd. The problem is that xntpd
seems to hang (no answer to ntqp or xntpdc queries).

Well the xntpd was not really hanging: was just dropping all
the packet coming to him.

The core of the problem seems to be in <ntp_io.c>.

The source define a "wildcard" interface defined that way:

        /*
         * create pseudo-interface with wildcard address
         */
        inter_list[0].sin.sin_family = AF_INET;
        inter_list[0].sin.sin_port = port;
        inter_list[0].sin.sin_addr.s_addr = INADDR_ANY;
        (void) strncpy(inter_list[0].name, "wildcard",
             sizeof(inter_list[0].name));
        inter_list[0].mask.sin_addr.s_addr = htonl(~0);
        inter_list[0].received = 0;
        inter_list[0].sent = 0;
        inter_list[0].notsent = 0;
        inter_list[0].flags = INT_BROADCAST;

This interface (quoted also as any_interface in some subroutine) is
used I think to send packets to a non local network. The problem is
that one time that a just one packet is sent to this interface (that
have address 0.0.0.0) all the packet come from this interface.
But in ntp_io.c (function input_handler) this piece of code:

                                if (i == 0 || free_recvbufs == 0) {
                                        char buf[RX_BUFF_SIZE];

                                        (void) read(fd, buf, sizeof buf);
                                        if (i == 0)
                                                packets_ignored++;
                                        else
                                                packets_dropped++;
                                        continue;
                                }

will drop all the packet coming from the interface 0 [note if (i==0] that
is just the wildcard interface.

If I change the line:
                                if (i == 0 || free_recvbufs == 0) {
to
                                if (free_recvbufs == 0) {

in the above code the xntpd start to work (apparently correctly), although
the <peers> command in xntpdc report 0.0.0.0 for local (I don't know
if this is correct).

Just to finish, if (using the original code) I don't list any peer
the xntpd answer to the local query, I think because no packets was
sent to the interfcae with INADDR_ANY [0.0.0.0] address.

Well (sorry to have bothered the group at this point) my question are:

1) Any idea why all the packet are coming from the wildcard interface?

2) The code I hacked may work without problems?

3) Better ideas in the way to hack this code?

I learned a lot about the use of signals and ASYNC IO (that is supported
by AIX/370 at the end) under UNIX debugging xntpd: my compliment to the
authors, it is a wonderful peace of code.

Best Regards   Peppe

-- 
Giuseppe Vitillaro - IBM SEMEA      |  E-Mail : peppe@ipgaix.unipg.it 
University of Perugia Italy         |  06100 Perugia  Phone:+39.75.585-2200
---------------------------------------------------------------------------
All comments/opinions are mine and don't represent those of IBM
Newsgroups: comp.protocols.time.ntp