X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=bfdd%2Fbfdd_vty.c;h=a03fb9f216534a32d13f91cadd133fbf15b07127;hb=3bb513c399c2e7c8dd597b7399dd7c0f064842d0;hp=a3f1638e5f6f78d7cca255e4947792d4851b7aaa;hpb=4fe5bc8c6282b58cbd9206146bb38e983f815de8;p=mirror_frr.git diff --git a/bfdd/bfdd_vty.c b/bfdd/bfdd_vty.c index a3f1638e5..a03fb9f21 100644 --- a/bfdd/bfdd_vty.c +++ b/bfdd/bfdd_vty.c @@ -158,8 +158,16 @@ static void _display_peer(struct vty *vty, struct bfd_session *bs) bs->timers.required_min_rx / 1000); vty_out(vty, "\t\t\tTransmission interval: %ums\n", bs->timers.desired_min_tx / 1000); - vty_out(vty, "\t\t\tEcho transmission interval: %ums\n", - bs->timers.required_min_echo / 1000); + if (bs->timers.required_min_echo_rx != 0) + vty_out(vty, "\t\t\tEcho receive interval: %ums\n", + bs->timers.required_min_echo_rx / 1000); + else + vty_out(vty, "\t\t\tEcho receive interval: disabled\n"); + if (CHECK_FLAG(bs->flags, BFD_SESS_FLAG_ECHO)) + vty_out(vty, "\t\t\tEcho transmission interval: %ums\n", + bs->timers.desired_min_echo_tx / 1000); + else + vty_out(vty, "\t\t\tEcho transmission interval: disabled\n"); vty_out(vty, "\t\tRemote timers:\n"); vty_out(vty, "\t\t\tDetect-multiplier: %u\n", @@ -168,8 +176,11 @@ static void _display_peer(struct vty *vty, struct bfd_session *bs) bs->remote_timers.required_min_rx / 1000); vty_out(vty, "\t\t\tTransmission interval: %ums\n", bs->remote_timers.desired_min_tx / 1000); - vty_out(vty, "\t\t\tEcho transmission interval: %ums\n", - bs->remote_timers.required_min_echo / 1000); + if (bs->remote_timers.required_min_echo != 0) + vty_out(vty, "\t\t\tEcho receive interval: %ums\n", + bs->remote_timers.required_min_echo / 1000); + else + vty_out(vty, "\t\t\tEcho receive interval: disabled\n"); vty_out(vty, "\n"); } @@ -245,11 +256,13 @@ static struct json_object *__display_peer_json(struct bfd_session *bs) bs->timers.required_min_rx / 1000); json_object_int_add(jo, "transmit-interval", bs->timers.desired_min_tx / 1000); + json_object_int_add(jo, "echo-receive-interval", + bs->timers.required_min_echo_rx / 1000); if (CHECK_FLAG(bs->flags, BFD_SESS_FLAG_ECHO)) - json_object_int_add(jo, "echo-interval", - bs->timers.required_min_echo / 1000); + json_object_int_add(jo, "echo-transmit-interval", + bs->timers.desired_min_echo_tx / 1000); else - json_object_int_add(jo, "echo-interval", 0); + json_object_int_add(jo, "echo-transmit-interval", 0); json_object_int_add(jo, "detect-multiplier", bs->detect_mult); @@ -257,7 +270,7 @@ static struct json_object *__display_peer_json(struct bfd_session *bs) bs->remote_timers.required_min_rx / 1000); json_object_int_add(jo, "remote-transmit-interval", bs->remote_timers.desired_min_tx / 1000); - json_object_int_add(jo, "remote-echo-interval", + json_object_int_add(jo, "remote-echo-receive-interval", bs->remote_timers.required_min_echo / 1000); json_object_int_add(jo, "remote-detect-multiplier", bs->remote_detect_mult); @@ -348,6 +361,11 @@ static void _display_peer_counter(struct vty *vty, struct bfd_session *bs) { _display_peer_header(vty, bs); + /* Ask data plane for updated counters. */ + if (bfd_dplane_update_session_counters(bs) == -1) + zlog_debug("%s: failed to update BFD session counters (%s)", + __func__, bs_to_string(bs)); + vty_out(vty, "\t\tControl packet input: %" PRIu64 " packets\n", bs->stats.rx_ctrl_pkt); vty_out(vty, "\t\tControl packet output: %" PRIu64 " packets\n", @@ -369,6 +387,11 @@ static struct json_object *__display_peer_counters_json(struct bfd_session *bs) { struct json_object *jo = _peer_json_header(bs); + /* Ask data plane for updated counters. */ + if (bfd_dplane_update_session_counters(bs) == -1) + zlog_debug("%s: failed to update BFD session counters (%s)", + __func__, bs_to_string(bs)); + json_object_int_add(jo, "control-packet-input", bs->stats.rx_ctrl_pkt); json_object_int_add(jo, "control-packet-output", bs->stats.tx_ctrl_pkt); json_object_int_add(jo, "echo-packet-input", bs->stats.rx_echo_pkt); @@ -447,7 +470,7 @@ static void _display_peers_counter(struct vty *vty, char *vrfname, bool use_json jo = json_object_new_array(); bvt.jo = jo; - bfd_id_iterate(_display_peer_counter_json_iter, jo); + bfd_id_iterate(_display_peer_counter_json_iter, &bvt); vty_out(vty, "%s\n", json_object_to_json_string_ext(jo, 0)); json_object_free(jo); @@ -748,6 +771,28 @@ DEFPY(bfd_show_peers_brief, bfd_show_peers_brief_cmd, return CMD_SUCCESS; } +DEFPY(show_bfd_distributed, show_bfd_distributed_cmd, + "show bfd distributed", + SHOW_STR + "Bidirection Forwarding Detection\n" + "Show BFD data plane (distributed BFD) statistics\n") +{ + bfd_dplane_show_counters(vty); + return CMD_SUCCESS; +} + +DEFPY( + bfd_debug_distributed, bfd_debug_distributed_cmd, + "[no] debug bfd distributed", + NO_STR + DEBUG_STR + "Bidirection Forwarding Detection\n" + "BFD data plane (distributed BFD) debugging\n") +{ + bglobal.debug_dplane = !no; + return CMD_SUCCESS; +} + DEFPY( bfd_debug_peer, bfd_debug_peer_cmd, "[no] debug bfd peer", @@ -808,11 +853,12 @@ static int bfd_configure_peer(struct bfd_peer_cfg *bpc, bool mhop, memset(bpc, 0, sizeof(*bpc)); /* Defaults */ - bpc->bpc_shutdown = true; + bpc->bpc_shutdown = false; bpc->bpc_detectmultiplier = BPC_DEF_DETECTMULTIPLIER; bpc->bpc_recvinterval = BPC_DEF_RECEIVEINTERVAL; bpc->bpc_txinterval = BPC_DEF_TRANSMITINTERVAL; - bpc->bpc_echointerval = BPC_DEF_ECHOINTERVAL; + bpc->bpc_echorecvinterval = BPC_DEF_ECHORECEIVEINTERVAL; + bpc->bpc_echotxinterval = BPC_DEF_ECHOTRANSMITINTERVAL; bpc->bpc_lastevent = monotime(NULL); /* Safety check: when no error buf is provided len must be zero. */ @@ -888,6 +934,8 @@ DEFUN_NOSH(show_debugging_bfd, "BFD daemon\n") { vty_out(vty, "BFD debugging status:\n"); + if (bglobal.debug_dplane) + vty_out(vty, " Distributed BFD debugging is on.\n"); if (bglobal.debug_peer_event) vty_out(vty, " Peer events debugging is on.\n"); if (bglobal.debug_zebra) @@ -919,6 +967,11 @@ static int bfdd_write_config(struct vty *vty) struct lyd_node *dnode; int written = 0; + if (bglobal.debug_dplane) { + vty_out(vty, "debug bfd distributed\n"); + written = 1; + } + if (bglobal.debug_peer_event) { vty_out(vty, "debug bfd peer\n"); written = 1; @@ -951,12 +1004,15 @@ void bfdd_vty_init(void) install_element(ENABLE_NODE, &bfd_show_peers_cmd); install_element(ENABLE_NODE, &bfd_show_peer_cmd); install_element(ENABLE_NODE, &bfd_show_peers_brief_cmd); + install_element(ENABLE_NODE, &show_bfd_distributed_cmd); install_element(ENABLE_NODE, &show_debugging_bfd_cmd); + install_element(ENABLE_NODE, &bfd_debug_distributed_cmd); install_element(ENABLE_NODE, &bfd_debug_peer_cmd); install_element(ENABLE_NODE, &bfd_debug_zebra_cmd); install_element(ENABLE_NODE, &bfd_debug_network_cmd); + install_element(CONFIG_NODE, &bfd_debug_distributed_cmd); install_element(CONFIG_NODE, &bfd_debug_peer_cmd); install_element(CONFIG_NODE, &bfd_debug_zebra_cmd); install_element(CONFIG_NODE, &bfd_debug_network_cmd);