rtcache_clear_rtentry: use LIST_FOREACH_SAFE as the element gets

removed from the list.
This commit is contained in:
hannken 2016-07-13 09:56:20 +00:00
parent 9c5f636bf3
commit da7d165fe0
1 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: route.c,v 1.170 2016/07/11 07:37:00 ozaki-r Exp $ */ /* $NetBSD: route.c,v 1.171 2016/07/13 09:56:20 hannken Exp $ */
/*- /*-
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@ -96,7 +96,7 @@
#endif #endif
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.170 2016/07/11 07:37:00 ozaki-r Exp $"); __KERNEL_RCSID(0, "$NetBSD: route.c,v 1.171 2016/07/13 09:56:20 hannken Exp $");
#include <sys/param.h> #include <sys/param.h>
#ifdef RTFLUSH_DEBUG #ifdef RTFLUSH_DEBUG
@ -1410,12 +1410,12 @@ static void
rtcache_clear_rtentry(int family, struct rtentry *rt) rtcache_clear_rtentry(int family, struct rtentry *rt)
{ {
struct domain *dom; struct domain *dom;
struct route *ro; struct route *ro, *nro;
if ((dom = pffinddomain(family)) == NULL) if ((dom = pffinddomain(family)) == NULL)
return; return;
LIST_FOREACH(ro, &dom->dom_rtcache, ro_rtcache_next) { LIST_FOREACH_SAFE(ro, &dom->dom_rtcache, ro_rtcache_next, nro) {
if (ro->_ro_rt == rt) if (ro->_ro_rt == rt)
rtcache_clear(ro); rtcache_clear(ro);
} }