Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Jan 1998 09:52:52 -0500 (EST)
From:      Joe Traister <traister@mojozone.org>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/5419: timed rejects valid networks with -n
Message-ID:  <199801031452.JAA00444@manta.mojozone.org>
Resent-Message-ID: <199801031500.HAA14481@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         5419
>Category:       bin
>Synopsis:       timed rejects valid networks with -n
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan  3 07:00:01 PST 1998
>Last-Modified:
>Originator:     Joe Traister
>Organization:
None
>Release:        FreeBSD 2.2.2-RELEASE i386
>Environment:

	FreeBSD-2.2.2 through FreeBSD-current

>Description:

	When given -n followed by a network name or number, timed exits with
	"timed: no network usable".  This is due to the fact that
	getnetbyname(3) returns a struct with network numbers in host byte
	order, rather than network byte order.  This is correct behavior for
	getnetbyname(3) according to its man page.

>How-To-Repeat:

	timed -n <network>

	where <network> is a valid, directly-connected network address.

>Fix:

--- timed.c.dist	Fri Jan  2 22:14:01 1998
+++ timed.c	Fri Jan  2 22:14:25 1998
@@ -364,7 +364,7 @@
 				nentp = getnetbyaddr(nt->net, AF_INET);
 		}
 		if (nentp != 0) {
-			nt->net = nentp->n_net;
+			nt->net = htonl(nentp->n_net);
 		} else if (nt->net == INADDR_NONE) {
 			fprintf(stderr, "timed: unknown net %s\n", nt->name);
 			exit(1);

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801031452.JAA00444>