Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Jun 1997 10:25:50 -0500
From:      Bob Willcox <bob@luke.pmr.com>
To:        bugs list <freebsd-bugs@freebsd.org>
Subject:   Minor timed bug with patch
Message-ID:  <19970619102550.20418@luke.pmr.com>

next in thread | raw e-mail | index | archive | help
I discovered a bug in timed's handling of network addresses (-n and -i flags)
where it forgets to convert the network address to network format when comparing
it to one that is.  I suspect that this bug exists in all versions (I know it is in
2.1.7.1, 2.2.2, and current).  Here is a patch to fix it:


Index: usr.sbin/timed/timed/timed.c
===================================================================
RCS file: /usr/cvs/FreeBSD/src/usr.sbin/timed/timed/timed.c,v
retrieving revision 1.2
diff -u -r1.2 timed.c
--- timed.c	1995/05/15 09:56:49	1.2
+++ timed.c	1997/06/19 04:45:34
@@ -452,7 +452,7 @@
 		ntp->dest_addr.sin_port = port;
 
 		for (nt = nets; nt; nt = nt->next) {
-			if (ntp->net.s_addr == nt->net)
+			if (ntp->net.s_addr == htonl(nt->net))
 				break;
 		}
 		if (nflag && !nt || iflag && nt)


-- 
Bob Willcox	       Deliberation, n.: The act of examining one's bread to determine
bob@luke.pmr.com       which side it is buttered on.
Austin, TX                -- Ambrose Bierce, "The Devil's Dictionary"



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