diff options
Diffstat (limited to 'bgpd/rfapi/vnc_zebra.c')
| -rw-r--r-- | bgpd/rfapi/vnc_zebra.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c index 5c71df238f..07be7833b6 100644 --- a/bgpd/rfapi/vnc_zebra.c +++ b/bgpd/rfapi/vnc_zebra.c @@ -183,22 +183,32 @@ static void vnc_redistribute_add(struct prefix *p, u_int32_t metric, vncHD1VR.peer->status = Established; /* keep bgp core happy */ bgp_sync_delete(vncHD1VR.peer); /* don't need these */ - if (vncHD1VR.peer->ibuf) { - stream_free(vncHD1VR.peer - ->ibuf); /* don't need it */ + + /* + * since this peer is not on the I/O thread, this lock + * is not strictly necessary, but serves as a reminder + * to those who may meddle... + */ + pthread_mutex_lock(&vncHD1VR.peer->io_mtx); + { + // we don't need any I/O related facilities + if (vncHD1VR.peer->ibuf) + stream_fifo_free(vncHD1VR.peer->ibuf); + if (vncHD1VR.peer->obuf) + stream_fifo_free(vncHD1VR.peer->obuf); + + if (vncHD1VR.peer->ibuf_work) + stream_free(vncHD1VR.peer->ibuf_work); + if (vncHD1VR.peer->obuf_work) + stream_free(vncHD1VR.peer->obuf_work); + vncHD1VR.peer->ibuf = NULL; - } - if (vncHD1VR.peer->obuf) { - stream_fifo_free( - vncHD1VR.peer - ->obuf); /* don't need it */ vncHD1VR.peer->obuf = NULL; + vncHD1VR.peer->obuf_work = NULL; + vncHD1VR.peer->ibuf_work = NULL; } - if (vncHD1VR.peer->work) { - stream_free(vncHD1VR.peer - ->work); /* don't need it */ - vncHD1VR.peer->work = NULL; - } + pthread_mutex_unlock(&vncHD1VR.peer->io_mtx); + /* base code assumes have valid host pointer */ vncHD1VR.peer->host = XSTRDUP(MTYPE_BGP_PEER_HOST, ".zebra."); |
