Date: Fri, 01 Oct 1999 14:10:13 -0600 From: Gary Ruwaldt <gsrmdr@lucent.com> To: freebsd-hackers@freeBSD.org Subject: radix.c, Hey is this a bug ? Message-ID: <37F51525.55BDEF23@lucent.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?37F51525.55BDEF23>