From c592ee3537cc62a56fb3dd55ab85d540cf65c645 Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 26 Jul 2022 17:12:40 +0000 Subject: [PATCH] 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@ --- usr.sbin/bgpd/kroute.c | 11 ++++------- 1 file 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 @@ -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; } } -- 2.20.1