🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.protocols.time.ntp
Article #812

xntp3 socket problem with UDP datagrams from INADDR_ANY.

#812
From: G. Vitillaro
Date: Tue, 29 Dec 1992 11:54
91 lines
4193 bytes
I had this problem with xntp3 (in xntpd) under AIX/370 1.2.1 (1400).
I'm interested to understand if I met a bug and
if there is any way to go over the problem.

I already posted this problem, but with no answer.
I will be really grateful for any answer that will help me
to understand the nature of this problem, as it may influence
the behaviour of other TCP/IP based packages (the same piece
of code is present in bind 4.8.3 for example).

Here it is the description of the problem:

==============================================================

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
Technical Details
Message-ID: <1992Dec29.115408.103086@ipgaix.unipg.it>
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!rpi!ghost.dsi.unimi.it!ipgaix!peppe

Show Full Headers
Complete Article Headers
Newsgroups: comp.protocols.time.ntp,comp.unix.aix,comp.protocols.tcp-ip
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!rpi!ghost.dsi.unimi.it!ipgaix!peppe
From: peppe@ipgaix.unipg.it (G. Vitillaro)
Subject: xntp3 socket problem with UDP datagrams from INADDR_ANY.
Message-ID: <1992Dec29.115408.103086@ipgaix.unipg.it>
Summary: xntp socket problem with UDP datagrams from INADDR_ANY
Keywords: xntp3,AIX/370,UDP,socket
Organization: Universita' di Perugia
Date: Tue, 29 Dec 1992 11:54:08 GMT
Lines: 91