From owner-freebsd-bugs Thu May 30 16:10:23 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 478CC37B409 for ; Thu, 30 May 2002 16:10:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g4UNA2X63515; Thu, 30 May 2002 16:10:02 -0700 (PDT) (envelope-from gnats) Received: from mail.wrs.com (unknown-1-11.windriver.com [147.11.1.11]) by hub.freebsd.org (Postfix) with ESMTP id A00C037B403 for ; Thu, 30 May 2002 16:02:07 -0700 (PDT) Received: from heavygear (heavygear [147.11.38.42]) by mail.wrs.com (8.9.3/8.9.1) with SMTP id QAA00507 for ; Thu, 30 May 2002 16:00:56 -0700 (PDT) Message-Id: Date: Thu, 30 May 2002 16:01:36 -0700 From: "Qing Li" To: Subject: kern/38752: rn_walktree_from not halting at the right node Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 38752 >Category: kern >Synopsis: rn_walktree_from not halting at the right node >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu May 30 16:10:02 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Qing Li >Release: FreeBSD 4.6-PRERELEASE i386 >Organization: >Environment: System: FreeBSD a.b.c 4.6-PRERELEASE FreeBSD 4.6-PRERELEASE #0: Wed May 15 16:17:16 GMT 2002 root@:/usr/obj/usr/src/sys/GENERIC i386 CPU: Pentium II/Pentium II Xeon/Celeron (265.37-MHz 686-class CPU) Origin = "GenuineIntel" Id = 0x634 Stepping = 4 Features=0x80f9ff real memory = 167772160 (163840K bytes) avail memory = 158183424 (154476K bytes) >Description: The code in "rn_walktree_from" that checks if we backed up too far did not stop at the right node. while (!stopping) { /* printf("node %p (%d)\n", rn, rn->rn_bit); */ base = rn; /* If at right child go back up, otherwise, go right */ while (rn->rn_parent->rn_right == rn && !(rn->rn_flags & RNF_ROOT)) { rn = rn->rn_parent; /* if went up beyond last, stop */ if (rn->rn_bit < lastb) { ^^^^^^^^^^^^^^^^^^^^^^^ ||||||||||||||||||||||| stopping = 1; /* printf("up too far\n"); */ } } /* Find the next *leaf* since next node might vanish, too */ for (rn = rn->rn_parent->rn_right; rn->rn_bit >= 0;) rn = rn->rn_left; The IF statement will be true after the complete traversal of the right branch of its parent, due to the "rn = rn->rn_parent->rn_right" assignment in the following FOR loop. One additional problem is the insertion of the default route will traverse the entire tree. >How-To-Repeat: Problem 1, Construct the routing tree to shape as the following: ROOT [o] | | [o] ____|_______ | | | (lastb) [o]------------[o] | | | | | | [o]-----{LF} {LF}------{LF} | | | {LF}------{LF} Problem 2, enable IPv6, and after system initialization, add a default route as in route add -net -inet6 default -inet6 fe80::2c0:4fff:fe8d:63b9%xl0 -netmask -inet6 default >Fix: *** radix.c Tue Apr 30 14:09:48 2002 --- radix.c.new Thu May 30 14:22:44 2002 *************** *** 942,952 **** rn = rn->rn_parent; /* if went up beyond last, stop */ ! if (rn->rn_bit < lastb) { stopping = 1; /* printf("up too far\n"); */ } } /* Find the next *leaf* since next node might vanish, too */ for (rn = rn->rn_parent->rn_right; rn->rn_bit >= 0;) --- 942,955 ---- rn = rn->rn_parent; /* if went up beyond last, stop */ ! if (rn->rn_bit <= lastb) { stopping = 1; /* printf("up too far\n"); */ } } + + if (rn->rn_parent->rn_flags & RNF_ROOT) + stopping = 1; /* Find the next *leaf* since next node might vanish, too */ for (rn = rn->rn_parent->rn_right; rn->rn_bit >= 0;) >Release-Note: >Audit-Trail: >Unformatted: SEND-PR: -*- send-pr -*- SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as SEND-PR: will all comments (text enclosed in `<' and `>'). SEND-PR: SEND-PR: Please consult the following URL if you are not sure how to SEND-PR: fill out a problem report: SEND-PR: http://www.freebsd.org/doc/en/articles/problem-reports/article.html SEND-PR: SEND-PR: Note that the Synopsis field is mandatory. SEND-PR: SEND-PR: Please note that (unless you state otherwise) if your report SEND-PR: includes a patch then it will be taken under the same license as SEND-PR: the one on the file(s) you want to change. SEND-PR: SEND-PR: BE ADVISED THAT FREEBSD PROBLEM REPORTS ARE PUBLIC INFORMATION AND SEND-PR: WILL BE PUBLISHED AS-IS ON THE PROJECT'S MAILING LISTS AND WEB SITES. SEND-PR: DO NOT SUBMIT ANY INFORMATION YOU DO NOT WANT MADE PUBLIC. SEND-PR: SEND-PR: For sensitive security issues, consider contacting the FreeBSD SEND-PR: security officer team (security-officer@freebsd.org) directly. SEND-PR: SEND-PR: Choose from the following categories: SEND-PR: SEND-PR: advocacy alpha bin conf docs gnu SEND-PR: i386 kern misc ports sparc SEND-PR: To: FreeBSD-gnats-submit@freebsd.org From: Qing.Li@windriver.com Reply-To: Qing.Li@windriver.com Cc: X-send-pr-version: 3.113 X-GNATS-Notify: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message