Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Tweak sanity checks



details:   https://anonhg.NetBSD.org/src/rev/8e29e3cd7ef8
branches:  trunk
changeset: 360304:8e29e3cd7ef8
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Mar 06 07:19:03 2018 +0000

description:
Tweak sanity checks

Scheduling a timer of static entries is wrong.

diffstat:

 sys/netinet/if_arp.c |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (40 lines):

diff -r 38aab22ff022 -r 8e29e3cd7ef8 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Tue Mar 06 06:04:21 2018 +0000
+++ b/sys/netinet/if_arp.c      Tue Mar 06 07:19:03 2018 +0000
@@ -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.
@@ -68,7 +68,7 @@
  */
 
 #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
 #include "opt_ddb.h"
@@ -315,11 +315,7 @@
        struct llentry *lle = arg;
        struct ifnet *ifp;
 
-       if (lle == NULL)
-               return;
-
-       if (lle->la_flags & LLE_STATIC)
-               return;
+       KASSERT((lle->la_flags & LLE_STATIC) == 0);
 
        LLE_WLOCK(lle);
        if (callout_pending(&lle->la_timer)) {
@@ -371,6 +367,8 @@
 {
 
        LLE_WLOCK_ASSERT(la);
+       KASSERT((la->la_flags & LLE_STATIC) == 0);
+
        LLE_ADDREF(la);
        callout_reset(&la->la_timer, hz * sec, arptimer, la);
 }



Home | Main Index | Thread Index | Old Index