Simplify logic a bit by moving a block. nbr_stop_itimer() does not use
authorclaudio <claudio@openbsd.org>
Fri, 9 Feb 2018 02:14:03 +0000 (02:14 +0000)
committerclaudio <claudio@openbsd.org>
Fri, 9 Feb 2018 02:14:03 +0000 (02:14 +0000)
the dr or bdr fields so clear them first.

usr.sbin/ospfd/neighbor.c

index cb85fde..587dfd1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: neighbor.c,v 1.47 2015/11/22 13:09:10 claudio Exp $ */
+/*     $OpenBSD: neighbor.c,v 1.48 2018/02/09 02:14:03 claudio Exp $ */
 
 /*
  * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -597,18 +597,16 @@ nbr_act_delete(struct nbr *nbr)
 {
        struct timeval  tv;
 
-       if (nbr == nbr->iface->self) {
-               nbr->dr.s_addr = 0;
-               nbr->bdr.s_addr = 0;
+       /* clear dr and bdr */
+       nbr->dr.s_addr = 0;
+       nbr->bdr.s_addr = 0;
+
+       if (nbr == nbr->iface->self)
                return (0);
-       }
 
        /* stop timers */
        nbr_stop_itimer(nbr);
 
-       /* clear dr and bdr */
-       nbr->dr.s_addr = 0;
-       nbr->bdr.s_addr = 0;
        /* XXX reset crypt_seq_num will allow replay attacks. */
        nbr->crypt_seq_num = 0;