diff options
author | radhika <radhika@cumulusnetworks.com> | 2016-05-09 05:11:18 +0200 |
---|---|---|
committer | radhika <radhika@cumulusnetworks.com> | 2016-05-09 05:11:18 +0200 |
commit | 567b877d7ff2c04ccf62bca75338cec7a560f184 (patch) | |
tree | 216b7fa0e0cb090fd081c5810b2be507acd0ff59 /zebra/zebra_ptm.c | |
parent | BGP: At exit, remove callbacks before invoking vrf_terminate() (diff) | |
download | frr-567b877d7ff2c04ccf62bca75338cec7a560f184.tar.xz frr-567b877d7ff2c04ccf62bca75338cec7a560f184.zip |
zebra - BFD client de-registration support
CM-10680
Issue: When BGP daemon is stopped, all the BGP BFD sessions are not getting deleted from PTM.
Root cause: BGP daemon stop causes BFD de-register message to be sent for every peer on which BFD is enabled. But, all the de-register messages from bgpd to zebra are not processed before the socket close. This results in some stale BGP BFD sessions.
Fix: Support for client de-register message has been added in PTM/BFD. Changes in Quagga to support BFD client de-registrations:
− The BFD clients de-registration is sent directly from zebra daemon when zebra client (bgpd, ospfd and ospf6d) socket close is detected.
− Introduced a BFD flag for the zebra clients to prevent BFD de-registration messages from being sent to zebra daemon when the client is shutting down. This reduces the BFD messaging.
CM-10540
Issue: Invalid ptm status “fail” instead of “n/a” being displayed for VRF interfaces.
Root cause: ptm status is not being initialized to “unknown” status when VRF interface is added or changed. The uninitialized value is ‘0’ which is the value for “fail”
Fix: Initialized the ptm status to the correct value.
Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Kanna Rajagopal <kanna@cumulusnetworks.com>
Ticket: CM-10680, CM-10540
Reviewed By: CCR-4653
Testing Done: PTM smoke, BGP smoke and ptmd_test.py:TestMultipleAddrsIntfOspfBgp
Diffstat (limited to 'zebra/zebra_ptm.c')
-rw-r--r-- | zebra/zebra_ptm.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index 731bd3562..bf6afb021 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -48,6 +48,7 @@ const char ZEBRA_PTM_GET_STATUS_CMD[] = "get-status"; const char ZEBRA_PTM_BFD_START_CMD[] = "start-bfd-sess"; const char ZEBRA_PTM_BFD_STOP_CMD[] = "stop-bfd-sess"; const char ZEBRA_PTM_BFD_CLIENT_REG_CMD[] = "reg-bfd-client"; +const char ZEBRA_PTM_BFD_CLIENT_DEREG_CMD[] = "dereg-bfd-client"; const char ZEBRA_PTM_CMD_STR[] = "cmd"; const char ZEBRA_PTM_CMD_STATUS_STR[] = "cmd_status"; @@ -1001,6 +1002,46 @@ zebra_ptm_bfd_client_register (struct zserv *client, int sock, u_short length) return 0; } +/* BFD client deregister */ +void +zebra_ptm_bfd_client_deregister (struct zserv *client) +{ + void *out_ctxt; + char tmp_buf[64]; + int data_len = ZEBRA_PTM_SEND_MAX_SOCKBUF; + + if (client->proto != ZEBRA_ROUTE_OSPF && client->proto != ZEBRA_ROUTE_BGP + && client->proto != ZEBRA_ROUTE_OSPF6) + return; + + if (IS_ZEBRA_DEBUG_EVENT) + zlog_debug("bfd_client_deregister msg for client %s", + zebra_route_string(client->proto)); + + if (ptm_cb.ptm_sock == -1) + { + ptm_cb.t_timer = thread_add_timer (zebrad.master, zebra_ptm_connect, + NULL, ptm_cb.reconnect_time); + return; + } + + ptm_lib_init_msg(ptm_hdl, 0, PTMLIB_MSG_TYPE_CMD, NULL, &out_ctxt); + + sprintf(tmp_buf, "%s", ZEBRA_PTM_BFD_CLIENT_DEREG_CMD); + ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_CMD_STR, tmp_buf); + + sprintf(tmp_buf, "%s", zebra_route_string(client->proto)); + ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_CLIENT_FIELD, + tmp_buf); + + ptm_lib_complete_msg(ptm_hdl, out_ctxt, ptm_cb.out_data, &data_len); + + if (IS_ZEBRA_DEBUG_SEND) + zlog_debug ("%s: Sent message (%d) %s", __func__, data_len, + ptm_cb.out_data); + zebra_ptm_send_message(ptm_cb.out_data, data_len); +} + int zebra_ptm_get_enable_state(void) { |