From owner-freebsd-bugs Sat Jan 3 15:12:39 1998 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id PAA10269 for bugs-outgoing; Sat, 3 Jan 1998 15:12:39 -0800 (PST) (envelope-from owner-freebsd-bugs) Received: from manta.mojozone.org (root@dffl0-5.gate.net [199.227.254.68]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id PAA10262 for ; Sat, 3 Jan 1998 15:12:24 -0800 (PST) (envelope-from traister@manta.mojozone.org) Received: from localhost (traister@localhost) by manta.mojozone.org (8.8.7/8.8.7) with SMTP id SAA01020; Sat, 3 Jan 1998 18:12:10 -0500 (EST) Date: Sat, 3 Jan 1998 18:12:00 -0500 (EST) From: Joe Traister To: Steve Price cc: freebsd-bugs@hub.freebsd.org Subject: Re: bin/5419: timed rejects valid networks with -n In-Reply-To: <199801031950.LAA29350@hub.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk -----BEGIN PGP SIGNED MESSAGE----- On Sat, 3 Jan 1998, Steve Price wrote: > I am no timed(8) expert. In fact, I have never used it. Just from > looking at the code it appears that if the above fix is appropriate > then it should also be supplemented with the following patch. I'm > just guessing here, so don't shoot me if I'm wrong. :) > > Steve > > @@ -420,7 +420,7 @@ > ntp->dest_addr.sin_port = port; > > for (nt = nets; nt; nt = nt->next) { > - if (ntp->net.s_addr == htonl(nt->net)) > + if (ntp->net.s_addr == nt->net) > break; > } > if ((nflag && !nt) || (iflag && nt)) Unfortunately, this will not work. The nt->net element gets set by either getnetbyname(3) or inet_network(3). getnetbyname(3) returns its data in host byte order while all other routines that return network addresses (including inet_network(3)) return network addresses in network byte order. Since the code only tests equality of the addresses and doesn't depend on the byte order used, it is sufficient to make sure that only one byte order is used to store the addresses. Otherwise the htonl() and ntohl() macros would need to be used all over the code. - -- Joe Traister | He had that rare weird electricity about him -- that traister@gate.net | extremely wild and heavy presence that you only see in CyberGate SysAdmin | a person who has abandoned all hope of ever behaving finger for PGP key | "normally." -- Hunter S. Thompson -----BEGIN PGP SIGNATURE----- Version: 2.6.3 Charset: noconv iQCVAwUBNK7FyCLR+wTS7lx1AQFw/AQAiN2Pd7QSrW9Cn+x/7iL9lgwR96QsHHN8 ZhoRu9U0yiJZZQuDjmVOYoJaVgG9erfGFe6c7UQemCWgG9Ef95yJH+ArwkiWRUQp n1QwnkSGOobLpDnw/Jbv6o+oebzaXu0Nadn8SBC2npTtmMrWVBVZBqjsCnOBsIMU ZmfOWfNbBbA= =bUfS -----END PGP SIGNATURE-----