From 66e373aec05c7f3353adbc36115b930b9b2ebf8c Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 4 Apr 2016 12:44:46 -0400 Subject: [PATCH] bgpd: Another hash_get crash fix Basically when modifying the peer->su, we must *always* release the hash and then re-install it, else we will cause crashes when we go to look up data that is not going to be there. Ticket: CM-10212 Signed-off-by: Donald Sharp Reviewed-by: Don Slice Reviewed-by: Daniel Walton --- bgpd/bgp_network.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 61986f561b..4cdeaeb7d5 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -32,6 +32,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "linklist.h" #include "network.h" #include "queue.h" +#include "hash.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_open.h" @@ -410,6 +411,8 @@ bgp_accept (struct thread *thread) peer = peer_create (&su, peer1->conf_if, peer1->bgp, peer1->local_as, peer1->as, peer1->as_type, 0, 0, NULL); peer->su = su; + hash_release(peer->bgp->peerhash, peer); + hash_get(peer->bgp->peerhash, peer, hash_alloc_intern); peer_xfer_config(peer, peer1); UNSET_FLAG (peer->flags, PEER_FLAG_CONFIG_NODE); -- 2.39.5