From owner-freebsd-hackers Fri Oct 1 13:10:45 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from ihemlsrv.firewall.lucent.com (ihemail1.lucent.com [192.11.222.161]) by hub.freebsd.org (Postfix) with ESMTP id 0D0D314D24 for ; Fri, 1 Oct 1999 13:10:31 -0700 (PDT) (envelope-from gsrmdr@lucent.com) Received: from ihemlsrv.firewall.lucent.com (localhost [127.0.0.1]) by ihemlsrv.firewall.lucent.com (Pro-8.9.3/8.9.3) with ESMTP id QAA25409 for ; Fri, 1 Oct 1999 16:10:29 -0400 (EDT) Received: from bighorn.dr.lucent.com (h135-9-1-59.lucent.com [135.9.1.59]) by ihemlsrv.firewall.lucent.com (Pro-8.9.3/8.9.3) with SMTP id QAA25377 for ; Fri, 1 Oct 1999 16:10:29 -0400 (EDT) Received: by bighorn.dr.lucent.com (SMI-8.6/EMS-1.5 sol2) id OAA05112; Fri, 1 Oct 1999 14:10:26 -0600 Received: from drgpaxon by bighorn.dr.lucent.com (SMI-8.6/EMS-1.5 sol2) id OAA05090; Fri, 1 Oct 1999 14:10:23 -0600 Received: from lucent.com by drgpaxon (8.8.8+Sun/EMS-L SunOS) id OAA04749; Fri, 1 Oct 1999 14:10:22 -0600 (MDT) Message-ID: <37F51525.55BDEF23@lucent.com> Date: Fri, 01 Oct 1999 14:10:13 -0600 From: Gary Ruwaldt X-Mailer: Mozilla 4.08 [en] (WinNT; U) MIME-Version: 1.0 To: freebsd-hackers@freeBSD.org Subject: radix.c, Hey is this a bug ? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hey is this a bug ? I downloaded the code for radix.c and radix.h and was trying to get a tree that looks like the one in TCP/IP Illustrated V.2 page 563 A.K.A "the book". I set up a test program to put the same data into the tree, page 560 and noticed a couple of differences. This is a copy of the data I placed in the tree: struct myStuff MyStuff [MaxEntries] = { "127.0.0.0", 0xff000000, "127.0.0.1", 0xffffffff, "128.32.33.5", 0xffffffff, "140.252.13.32", 0xffffffe0, "140.252.13.33", 0xffffffff, "140.252.13.34", 0xffffffff, "140.252.13.35", 0xffffffff, "140.252.13.65", 0xffffffff, "224.0.0.0", 0xff000000, "224.0.0.1", 0xffffffff, "0.0.0.0", 0x00000000, }; For the first entry 127.0.0.0 with a subnet mask of 0xff 000000 the radix node entry's mask pointer pointed to the one's entry i.e. radix node in the mask tree. This caused a problem with the search i.e. rn_matchaddr of 127.0.0.0, because the length of the key was taken from this mask entry as 0xff. I have modified the code to get the tree to look like the one in "the book" but I have eliminated the benifit of removing trailing zeros. A couple of questions; 1. Can someone explain how the removal of trailing zeros is suppose to work.? 2. Is this a real bug or pilot error. If pilot error what did I do wrong? If it is a real bug the explaintion for question one (1) might help me implement a solution, ya think? My next step is to turn this code into a C++ class, has anyone already done this? Yea, I look around on the WWW, although maybe not in the right sites. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message