summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2022-07-26 17:12:41 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2022-07-26 17:12:41 +0000
commit00263ead681be7b7ea4275e9e16701c9b7106067 (patch)
tree3c1f24ac9a53bd666a5771a8f4ad9be199f69e13 /usr.sbin/bgpd
parentd06ce5794cab9fcd28add2424fb97a767d1db546 (diff)
No need to check RB_REMOVE() return value if kif is not NULL.
Therefor check that in the IFAN_DEPARTURE case the interface was found before calling kif_remove. Idea and OK tb@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/kroute.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index e808c7d89b9..a8c01a560ae 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.281 2022/07/26 16:36:33 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.282 2022/07/26 17:12:40 claudio Exp $ */
/*
* Copyright (c) 2022 Claudio Jeker <claudio@openbsd.org>
@@ -2060,11 +2060,7 @@ kif_remove(struct kif_node *kif)
if ((kt = ktable_get(kif->k.rdomain)) != NULL)
knexthop_track(kt, kif->k.ifindex);
- if (RB_REMOVE(kif_tree, &kit, kif) == NULL) {
- log_warnx("RB_REMOVE(kif_tree, &kit, kif)");
- return (-1);
- }
-
+ RB_REMOVE(kif_tree, &kit, kif);
free(kif);
return (0);
}
@@ -2549,7 +2545,8 @@ if_announce(void *msg)
break;
case IFAN_DEPARTURE:
kif = kif_find(ifan->ifan_index);
- kif_remove(kif);
+ if (kif != NULL)
+ kif_remove(kif);
break;
}
}