From: Tashana Mehta-Wilson Date: Tue, 29 Sep 2020 00:47:53 +0000 (+1300) Subject: bfdd: Make new multihop peer if local-address is unique X-Git-Tag: frr-7.5~11^2~10 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=7ba98c498b5672c46a96892fd03549ae40c7cdea;p=matthieu%2Ffrr.git bfdd: Make new multihop peer if local-address is unique Previously if there were two multihop peers created that had the same peer address but different local addresses then the second peer to be created would be merged with the first one and niether would be able to be deleted. This was due to an issue in the function bfd_key_lookup(). When the second peer was created its key would be sent into the lookup function and would reach the last section, even though it shouldn't have. A check has been placed around the section so that it will not be entered if a peer is multihop. Signed-off-by: Tashana Mehta-Wilson --- diff --git a/bfdd/bfd.c b/bfdd/bfd.c index 4877abd573..d3b4045c3e 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -1745,18 +1745,19 @@ struct bfd_session *bfd_key_lookup(struct bfd_key key) * input has no iface nor local-address, but a context may * exist */ - ctx.result = NULL; - ctx.given = &bs; - hash_walk(bfd_key_hash, - &bfd_key_lookup_ignore_partial_walker, - &ctx); - /* change key */ - if (ctx.result) { - bsp = ctx.result; - if (bglobal.debug_peer_event) - zlog_debug( - " peer %s found, but ifp and/or loc-addr params ignored", - peer_buf); + if (!bs.key.mhop) { + ctx.result = NULL; + ctx.given = &bs; + hash_walk(bfd_key_hash, &bfd_key_lookup_ignore_partial_walker, + &ctx); + /* change key */ + if (ctx.result) { + bsp = ctx.result; + if (bglobal.debug_peer_event) + zlog_debug( + " peer %s found, but ifp and/or loc-addr params ignored", + peer_buf); + } } return bsp; }