Bug 2805

Summary: timed -n and -i switches are not working
Product: [Retired] Red Hat Linux Reporter: francis
Component: timedAssignee: Jay Turner <jturner>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: srevivo
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-05-14 15:31:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description francis 1999-05-13 22:49:44 UTC
where I run

timed -n test-net

to force timed to only bind to a specific network I get the
following error

timed: no network usable

Since my /etc/networks file has the correct infos in it. I
dig into the source code... The problem was nail down to the
following lines of the timed source code

timed.c line 393

                nt->net = htonl(nt->net);

This seems to do nothing (nt->net doesn't change),
which suprised me since I'm on a little endian architecture
(i686).

So I wrote the following test program :

#include <netdb.h>
#include <stdio.h>
#include <netinet/in.h>

int
main ( int argc, char *argv[])
{
        struct netent *net;
        unsigned long haddr,naddr;

        if ( argc != 2 ) {
                fprintf( stderr, "usage: test <net>\n" );
                exit(2);
        }

        net = getnetbyname( argv[1] );
        if ( !net) {
                fprintf( stderr, "no such network: %s\n",
argv[1] );
                exit(1);
        }

        haddr = net->n_net;
        naddr = htonl(haddr);

        printf( "Network in host byte order: %lu\n", haddr);
        printf( "Network in network byte order: %lu\n",
naddr);

        exit(0);
}

Which when is compiled either as gcc  -O2 -o test test.c or
gcc -o test test.c gives the same uncomprehensible result.
(/etc/networks contains)

192.168.250.0   test-net

$ ./test test-net
Network in host byte order: 4294967295
Network in network byte order: 4294967295

Comment 1 Jeff Johnson 1999-05-14 15:31:59 UTC
With the /etc/networks line
	jbj-net	198.178.231
your test program produced (I like hex output)
	porkchop:~ 1028 bash$ ./n jbj-net
	Network in host byte order: c6b2e7
	Network in network byte order: e7b2c600
correctly on a i686 little-endian machine.

Please reopen this bug with better info regarding timed. I'd
suggest that you look seriously at xntp3 rather than timed
if you are interested in distributing a reference time reliably.