Bug 2805 - timed -n and -i switches are not working
timed -n and -i switches are not working
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: timed (Show other bugs)
6.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jay Turner
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-05-13 18:49 EDT by francis
Modified: 2015-01-07 18:37 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-05-14 11:31:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description francis 1999-05-13 18:49:44 EDT
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 11:31:59 EDT
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.