Bug 2805 - timed -n and -i switches are not working
Summary: timed -n and -i switches are not working
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: timed
Version: 6.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jay Turner
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-05-13 22:49 UTC by francis
Modified: 2015-01-07 23:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1999-05-14 15:31:21 UTC
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.