Tweak sanity checks

Scheduling a timer of static entries is wrong.
This commit is contained in:
ozaki-r 2018-03-06 07:19:03 +00:00
parent 6a3be784bd
commit e3a4d36d02
1 changed files with 5 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_arp.c,v 1.268 2018/03/01 14:40:57 roy Exp $ */ /* $NetBSD: if_arp.c,v 1.269 2018/03/06 07:19:03 ozaki-r Exp $ */
/* /*
* Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.268 2018/03/01 14:40:57 roy Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.269 2018/03/06 07:19:03 ozaki-r Exp $");
#ifdef _KERNEL_OPT #ifdef _KERNEL_OPT
#include "opt_ddb.h" #include "opt_ddb.h"
@ -315,11 +315,7 @@ arptimer(void *arg)
struct llentry *lle = arg; struct llentry *lle = arg;
struct ifnet *ifp; struct ifnet *ifp;
if (lle == NULL) KASSERT((lle->la_flags & LLE_STATIC) == 0);
return;
if (lle->la_flags & LLE_STATIC)
return;
LLE_WLOCK(lle); LLE_WLOCK(lle);
if (callout_pending(&lle->la_timer)) { if (callout_pending(&lle->la_timer)) {
@ -371,6 +367,8 @@ arp_settimer(struct llentry *la, int sec)
{ {
LLE_WLOCK_ASSERT(la); LLE_WLOCK_ASSERT(la);
KASSERT((la->la_flags & LLE_STATIC) == 0);
LLE_ADDREF(la); LLE_ADDREF(la);
callout_reset(&la->la_timer, hz * sec, arptimer, la); callout_reset(&la->la_timer, hz * sec, arptimer, la);
} }