From owner-svn-src-head@FreeBSD.ORG Thu May 1 15:04:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 598AB3EC; Thu, 1 May 2014 15:04:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46E4E15AD; Thu, 1 May 2014 15:04:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s41F4XQv099721; Thu, 1 May 2014 15:04:33 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s41F4X0J099720; Thu, 1 May 2014 15:04:33 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201405011504.s41F4X0J099720@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Thu, 1 May 2014 15:04:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265196 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 May 2014 15:04:33 -0000 Author: melifaro Date: Thu May 1 15:04:32 2014 New Revision: 265196 URL: http://svnweb.freebsd.org/changeset/base/265196 Log: Fix rnh_walktree_from() function (patch from kern/174959). Require valid netmask to be passed since host route is always a leaf. PR: kern/174959 Submitted by: Keith Sklower MFC after: 2 weeks Modified: head/sys/net/radix.c Modified: head/sys/net/radix.c ============================================================================== --- head/sys/net/radix.c Thu May 1 15:03:26 2014 (r265195) +++ head/sys/net/radix.c Thu May 1 15:04:32 2014 (r265196) @@ -971,6 +971,8 @@ rn_walktree_from(struct radix_node_head int stopping = 0; int lastb; + KASSERT(m != NULL, ("%s: mask needs to be specified", __func__)); + /* * rn_search_m is sort-of-open-coded here. We cannot use the * function because we need to keep track of the last node seen. @@ -994,11 +996,11 @@ rn_walktree_from(struct radix_node_head /* * Two cases: either we stepped off the end of our mask, * in which case last == rn, or we reached a leaf, in which - * case we want to start from the last node we looked at. - * Either way, last is the node we want to start from. + * case we want to start from the leaf. */ - rn = last; - lastb = rn->rn_bit; + if (rn->rn_bit >= 0) + rn = last; + lastb = last->rn_bit; /* printf("rn %p, lastb %d\n", rn, lastb);*/