Never return the root node itself from rn_match(); return NULL instead.

This caused a panic in rtfreee() called with a root node from the
routing socket code (when processing a RTM_GET message looking for
the default route while there is none).

Since no existing code seems to have any use getting the root node
from rn_match(), it seems cleaner never to return it rather than
check for this condition at the caller's.

PR:		kern/12265
This commit is contained in:
Pierre Beyssac 1999-06-25 13:43:30 +00:00
parent d430c0c167
commit cce2eb6a97
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=48215

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)radix.c 8.4 (Berkeley) 11/2/94
* $Id: radix.c,v 1.16 1999/04/26 09:05:31 peter Exp $
* $Id: radix.c,v 1.17 1999/04/29 03:22:16 luoqi Exp $
*/
/*
@ -260,8 +260,11 @@ rn_match(v_arg, head)
/*
* This extra grot is in case we are explicitly asked
* to look up the default. Ugh!
*
* Never return the root node itself, it seems to cause a
* lot of confusion.
*/
if ((t->rn_flags & RNF_ROOT) && t->rn_dupedkey)
if (t->rn_flags & RNF_ROOT)
t = t->rn_dupedkey;
return t;
on1: