svn commit: r265196 - head/sys/net

Alexander V. Chernikov melifaro at FreeBSD.org
Thu May 1 15:04:33 UTC 2014


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);*/
 


More information about the svn-src-head mailing list