summaryrefslogtreecommitdiffstats
path: root/bfdd
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-03-10 15:31:57 +0100
committerIgor Ryzhov <iryzhov@nfware.com>2021-03-16 20:14:57 +0100
commit4df3e31c3d09f83340e7c1a0d7645d0bdddcb68f (patch)
tree01b36a351e9a10d91d25d5dd802bb7f09a69108c /bfdd
parentMerge pull request #8260 from volta-networks/fix_isis_snmp_test (diff)
downloadfrr-4df3e31c3d09f83340e7c1a0d7645d0bdddcb68f.tar.xz
frr-4df3e31c3d09f83340e7c1a0d7645d0bdddcb68f.zip
bfdd: separate echo rx/tx timers
Currently there is a single interval for both RX and TX echo functions. This commit introduces separate RX and TX timers for echo packets. The main advantage is to be able to set the receive interval to zero when we don't want to receive echo packets from the remote system. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'bfdd')
-rw-r--r--bfdd/bfd.c35
-rw-r--r--bfdd/bfd.h14
-rw-r--r--bfdd/bfd_packet.c2
-rw-r--r--bfdd/bfdctl.h10
-rw-r--r--bfdd/bfdd_cli.c100
-rw-r--r--bfdd/bfdd_nb.c20
-rw-r--r--bfdd/bfdd_nb.h10
-rw-r--r--bfdd/bfdd_nb_config.c83
-rw-r--r--bfdd/bfdd_vty.c32
-rw-r--r--bfdd/bfddp_packet.h5
-rw-r--r--bfdd/config.c26
-rw-r--r--bfdd/dplane.c3
12 files changed, 290 insertions, 50 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c
index 3cbb3691e..aa30ca8ad 100644
--- a/bfdd/bfd.c
+++ b/bfdd/bfd.c
@@ -90,7 +90,8 @@ static void bfd_profile_set_default(struct bfd_profile *bp)
bp->echo_mode = false;
bp->passive = false;
bp->minimum_ttl = BFD_DEF_MHOP_TTL;
- bp->min_echo_rx = BFD_DEF_REQ_MIN_ECHO;
+ bp->min_echo_rx = BFD_DEF_REQ_MIN_ECHO_RX;
+ bp->min_echo_tx = BFD_DEF_DES_MIN_ECHO_TX;
bp->min_rx = BFD_DEFREQUIREDMINRX;
bp->min_tx = BFD_DEFDESIREDMINTX;
}
@@ -179,13 +180,19 @@ void bfd_session_apply(struct bfd_session *bs)
/* We can only apply echo options on single hop sessions. */
if (!CHECK_FLAG(bs->flags, BFD_SESS_FLAG_MH)) {
- /* Configure remote echo if it was default. */
- if (bs->peer_profile.min_echo_rx == BFD_DEF_REQ_MIN_ECHO)
- bs->timers.required_min_echo = bp->min_echo_rx;
+ /* Configure echo timers if they were default. */
+ if (bs->peer_profile.min_echo_rx == BFD_DEF_REQ_MIN_ECHO_RX)
+ bs->timers.required_min_echo_rx = bp->min_echo_rx;
else
- bs->timers.required_min_echo =
+ bs->timers.required_min_echo_rx =
bs->peer_profile.min_echo_rx;
+ if (bs->peer_profile.min_echo_tx == BFD_DEF_DES_MIN_ECHO_TX)
+ bs->timers.desired_min_echo_tx = bp->min_echo_tx;
+ else
+ bs->timers.desired_min_echo_tx =
+ bs->peer_profile.min_echo_tx;
+
/* Toggle echo if default value. */
if (bs->peer_profile.echo_mode == false)
bfd_set_echo(bs, bp->echo_mode);
@@ -700,7 +707,8 @@ struct bfd_session *bfd_session_new(void)
bs->timers.desired_min_tx = BFD_DEFDESIREDMINTX;
bs->timers.required_min_rx = BFD_DEFREQUIREDMINRX;
- bs->timers.required_min_echo = BFD_DEF_REQ_MIN_ECHO;
+ bs->timers.required_min_echo_rx = BFD_DEF_REQ_MIN_ECHO_RX;
+ bs->timers.desired_min_echo_tx = BFD_DEF_DES_MIN_ECHO_TX;
bs->detect_mult = BFD_DEFDETECTMULT;
bs->mh_ttl = BFD_DEF_MHOP_TTL;
bs->ses_state = PTM_BFD_DOWN;
@@ -769,9 +777,14 @@ static void _bfd_session_update(struct bfd_session *bs,
bs->peer_profile.detection_multiplier = bs->detect_mult;
}
- if (bpc->bpc_has_echointerval) {
- bs->timers.required_min_echo = bpc->bpc_echointerval * 1000;
- bs->peer_profile.min_echo_rx = bs->timers.required_min_echo;
+ if (bpc->bpc_has_echorecvinterval) {
+ bs->timers.required_min_echo_rx = bpc->bpc_echorecvinterval * 1000;
+ bs->peer_profile.min_echo_rx = bs->timers.required_min_echo_rx;
+ }
+
+ if (bpc->bpc_has_echotxinterval) {
+ bs->timers.desired_min_echo_tx = bpc->bpc_echotxinterval * 1000;
+ bs->peer_profile.min_echo_tx = bs->timers.desired_min_echo_tx;
}
if (bpc->bpc_has_label)
@@ -1189,10 +1202,10 @@ void bs_echo_timer_handler(struct bfd_session *bs)
* RFC 5880, Section 6.8.9.
*/
old_timer = bs->echo_xmt_TO;
- if (bs->remote_timers.required_min_echo > bs->timers.required_min_echo)
+ if (bs->remote_timers.required_min_echo > bs->timers.desired_min_echo_tx)
bs->echo_xmt_TO = bs->remote_timers.required_min_echo;
else
- bs->echo_xmt_TO = bs->timers.required_min_echo;
+ bs->echo_xmt_TO = bs->timers.desired_min_echo_tx;
if (CHECK_FLAG(bs->flags, BFD_SESS_FLAG_ECHO_ACTIVE) == 0
|| old_timer != bs->echo_xmt_TO)
diff --git a/bfdd/bfd.h b/bfdd/bfd.h
index 7c537b40d..503b5ca7d 100644
--- a/bfdd/bfd.h
+++ b/bfdd/bfd.h
@@ -215,6 +215,8 @@ struct bfd_profile {
/** Echo mode (only applies to single hop). */
bool echo_mode;
+ /** Desired echo transmission interval (in microseconds). */
+ uint32_t min_echo_tx;
/** Minimum required echo receive interval (in microseconds). */
uint32_t min_echo_rx;
@@ -228,6 +230,13 @@ TAILQ_HEAD(bfdproflist, bfd_profile);
/* bfd_session shortcut label forwarding. */
struct peer_label;
+struct bfd_config_timers {
+ uint32_t desired_min_tx;
+ uint32_t required_min_rx;
+ uint32_t desired_min_echo_tx;
+ uint32_t required_min_echo_rx;
+};
+
/*
* Session state information
*/
@@ -251,7 +260,7 @@ struct bfd_session {
struct bfd_profile peer_profile;
/* Timers */
- struct bfd_timers timers;
+ struct bfd_config_timers timers;
struct bfd_timers cur_timers;
uint64_t detect_TO;
struct thread *echo_recvtimer_ev;
@@ -332,7 +341,8 @@ TAILQ_HEAD(obslist, bfd_session_observer);
#define BFD_DEFDETECTMULT 3
#define BFD_DEFDESIREDMINTX (300 * 1000) /* microseconds. */
#define BFD_DEFREQUIREDMINRX (300 * 1000) /* microseconds. */
-#define BFD_DEF_REQ_MIN_ECHO (50 * 1000) /* microseconds. */
+#define BFD_DEF_DES_MIN_ECHO_TX (50 * 1000) /* microseconds. */
+#define BFD_DEF_REQ_MIN_ECHO_RX (50 * 1000) /* microseconds. */
#define BFD_DEF_SLOWTX (1000 * 1000) /* microseconds. */
/** Minimum multi hop TTL. */
#define BFD_DEF_MHOP_TTL 254
diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c
index 12bb52cf6..c871e2abe 100644
--- a/bfdd/bfd_packet.c
+++ b/bfdd/bfd_packet.c
@@ -267,7 +267,7 @@ void ptm_bfd_snd(struct bfd_session *bfd, int fbit)
cp.timers.required_min_rx =
htonl(bfd->cur_timers.required_min_rx);
}
- cp.timers.required_min_echo = htonl(bfd->timers.required_min_echo);
+ cp.timers.required_min_echo = htonl(bfd->timers.required_min_echo_rx);
if (_ptm_bfd_send(bfd, NULL, &cp, BFD_PKT_LEN) != 0)
return;
diff --git a/bfdd/bfdctl.h b/bfdd/bfdctl.h
index e1cff9a31..c4b2e8030 100644
--- a/bfdd/bfdctl.h
+++ b/bfdd/bfdctl.h
@@ -47,7 +47,8 @@ struct sockaddr_any {
#define BPC_DEF_DETECTMULTIPLIER 3
#define BPC_DEF_RECEIVEINTERVAL 300 /* milliseconds */
#define BPC_DEF_TRANSMITINTERVAL 300 /* milliseconds */
-#define BPC_DEF_ECHOINTERVAL 50 /* milliseconds */
+#define BPC_DEF_ECHORECEIVEINTERVAL 50 /* milliseconds */
+#define BPC_DEF_ECHOTRANSMITINTERVAL 50 /* milliseconds */
/* Peer status */
enum bfd_peer_status {
@@ -81,8 +82,11 @@ struct bfd_peer_cfg {
bool bpc_has_txinterval;
uint64_t bpc_txinterval;
- bool bpc_has_echointerval;
- uint64_t bpc_echointerval;
+ bool bpc_has_echorecvinterval;
+ uint64_t bpc_echorecvinterval;
+
+ bool bpc_has_echotxinterval;
+ uint64_t bpc_echotxinterval;
bool bpc_has_minimum_ttl;
uint8_t bpc_minimum_ttl;
diff --git a/bfdd/bfdd_cli.c b/bfdd/bfdd_cli.c
index 206f6c7d0..44e94eb89 100644
--- a/bfdd/bfdd_cli.c
+++ b/bfdd/bfdd_cli.c
@@ -451,8 +451,8 @@ void bfd_cli_show_echo(struct vty *vty, struct lyd_node *dnode,
DEFPY_YANG(
bfd_peer_echo_interval, bfd_peer_echo_interval_cmd,
"echo-interval (10-60000)$interval",
- "Configure peer echo interval\n"
- "Configure peer echo interval value in milliseconds\n")
+ "Configure peer echo intervals\n"
+ "Configure peer echo rx/tx intervals value in milliseconds\n")
{
char value[32];
@@ -464,21 +464,88 @@ DEFPY_YANG(
snprintf(value, sizeof(value), "%ld", interval * 1000);
nb_cli_enqueue_change(vty, "./desired-echo-transmission-interval",
NB_OP_MODIFY, value);
+ nb_cli_enqueue_change(vty, "./required-echo-receive-interval",
+ NB_OP_MODIFY, value);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+DEFPY_YANG(
+ bfd_peer_echo_transmit_interval, bfd_peer_echo_transmit_interval_cmd,
+ "echo transmit-interval (10-60000)$interval",
+ "Configure peer echo intervals\n"
+ "Configure desired transmit interval\n"
+ "Configure interval value in milliseconds\n")
+{
+ char value[32];
+
+ if (!bfd_cli_is_profile(vty) && !bfd_cli_is_single_hop(vty)) {
+ vty_out(vty, "%% Echo mode is only available for single hop sessions.\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ snprintf(value, sizeof(value), "%ld", interval * 1000);
+ nb_cli_enqueue_change(vty, "./desired-echo-transmission-interval",
+ NB_OP_MODIFY, value);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+void bfd_cli_show_desired_echo_transmission_interval(struct vty *vty,
+ struct lyd_node *dnode, bool show_defaults)
+{
+ uint32_t value;
+
+ if (show_defaults)
+ vty_out(vty, " echo transmit-interval %d\n",
+ BFD_DEF_DES_MIN_ECHO_TX);
+ else {
+ value = yang_dnode_get_uint32(dnode, NULL);
+ vty_out(vty, " echo transmit-interval %u\n", value / 1000);
+ }
+}
+
+DEFPY_YANG(
+ bfd_peer_echo_receive_interval, bfd_peer_echo_receive_interval_cmd,
+ "echo receive-interval <disabled$disabled|(10-60000)$interval>",
+ "Configure peer echo intervals\n"
+ "Configure required receive interval\n"
+ "Disable echo packets receive\n"
+ "Configure interval value in milliseconds\n")
+{
+ char value[32];
+
+ if (!bfd_cli_is_profile(vty) && !bfd_cli_is_single_hop(vty)) {
+ vty_out(vty, "%% Echo mode is only available for single hop sessions.\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ if (disabled)
+ snprintf(value, sizeof(value), "0");
+ else
+ snprintf(value, sizeof(value), "%ld", interval * 1000);
+
+ nb_cli_enqueue_change(vty, "./required-echo-receive-interval",
+ NB_OP_MODIFY, value);
return nb_cli_apply_changes(vty, NULL);
}
-void bfd_cli_show_echo_interval(struct vty *vty, struct lyd_node *dnode,
- bool show_defaults)
+void bfd_cli_show_required_echo_receive_interval(struct vty *vty,
+ struct lyd_node *dnode, bool show_defaults)
{
uint32_t value;
if (show_defaults)
- vty_out(vty, " echo-interval %d\n",
- BFD_DEF_REQ_MIN_ECHO);
+ vty_out(vty, " echo receive-interval %d\n",
+ BFD_DEF_REQ_MIN_ECHO_RX);
else {
value = yang_dnode_get_uint32(dnode, NULL);
- vty_out(vty, " echo-interval %u\n", value / 1000);
+ if (value)
+ vty_out(vty, " echo receive-interval %u\n",
+ value / 1000);
+ else
+ vty_out(vty, " echo receive-interval disabled\n");
}
}
@@ -575,6 +642,21 @@ ALIAS_YANG(bfd_peer_echo_interval, bfd_profile_echo_interval_cmd,
"Configure peer echo interval\n"
"Configure peer echo interval value in milliseconds\n")
+ALIAS_YANG(
+ bfd_peer_echo_transmit_interval, bfd_profile_echo_transmit_interval_cmd,
+ "echo transmit-interval (10-60000)$interval",
+ "Configure peer echo intervals\n"
+ "Configure desired transmit interval\n"
+ "Configure interval value in milliseconds\n")
+
+ALIAS_YANG(
+ bfd_peer_echo_receive_interval, bfd_profile_echo_receive_interval_cmd,
+ "echo receive-interval <disabled$disabled|(10-60000)$interval>",
+ "Configure peer echo intervals\n"
+ "Configure required receive interval\n"
+ "Disable echo packets receive\n"
+ "Configure interval value in milliseconds\n")
+
DEFPY_YANG(bfd_peer_profile, bfd_peer_profile_cmd,
"[no] profile BFDPROF$pname",
NO_STR
@@ -632,6 +714,8 @@ bfdd_cli_init(void)
install_element(BFD_PEER_NODE, &bfd_peer_tx_cmd);
install_element(BFD_PEER_NODE, &bfd_peer_echo_cmd);
install_element(BFD_PEER_NODE, &bfd_peer_echo_interval_cmd);
+ install_element(BFD_PEER_NODE, &bfd_peer_echo_transmit_interval_cmd);
+ install_element(BFD_PEER_NODE, &bfd_peer_echo_receive_interval_cmd);
install_element(BFD_PEER_NODE, &bfd_peer_profile_cmd);
install_element(BFD_PEER_NODE, &bfd_peer_passive_cmd);
install_element(BFD_PEER_NODE, &bfd_peer_minimum_ttl_cmd);
@@ -652,6 +736,8 @@ bfdd_cli_init(void)
install_element(BFD_PROFILE_NODE, &bfd_profile_shutdown_cmd);
install_element(BFD_PROFILE_NODE, &bfd_profile_echo_cmd);
install_element(BFD_PROFILE_NODE, &bfd_profile_echo_interval_cmd);
+ install_element(BFD_PROFILE_NODE, &bfd_profile_echo_transmit_interval_cmd);
+ install_element(BFD_PROFILE_NODE, &bfd_profile_echo_receive_interval_cmd);
install_element(BFD_PROFILE_NODE, &bfd_profile_passive_cmd);
install_element(BFD_PROFILE_NODE, &bfd_profile_minimum_ttl_cmd);
install_element(BFD_PROFILE_NODE, &no_bfd_profile_minimum_ttl_cmd);
diff --git a/bfdd/bfdd_nb.c b/bfdd/bfdd_nb.c
index 64ba3cf81..29a9b5f2d 100644
--- a/bfdd/bfdd_nb.c
+++ b/bfdd/bfdd_nb.c
@@ -103,8 +103,15 @@ const struct frr_yang_module_info frr_bfdd_info = {
.xpath = "/frr-bfdd:bfdd/bfd/profile/desired-echo-transmission-interval",
.cbs = {
.modify = bfdd_bfd_profile_desired_echo_transmission_interval_modify,
- .cli_show = bfd_cli_show_echo_interval,
- }
+ .cli_show = bfd_cli_show_desired_echo_transmission_interval,
+ }
+ },
+ {
+ .xpath = "/frr-bfdd:bfdd/bfd/profile/required-echo-receive-interval",
+ .cbs = {
+ .modify = bfdd_bfd_profile_required_echo_receive_interval_modify,
+ .cli_show = bfd_cli_show_required_echo_receive_interval,
+ }
},
{
.xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop",
@@ -179,7 +186,14 @@ const struct frr_yang_module_info frr_bfdd_info = {
.xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/desired-echo-transmission-interval",
.cbs = {
.modify = bfdd_bfd_sessions_single_hop_desired_echo_transmission_interval_modify,
- .cli_show = bfd_cli_show_echo_interval,
+ .cli_show = bfd_cli_show_desired_echo_transmission_interval,
+ }
+ },
+ {
+ .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/required-echo-receive-interval",
+ .cbs = {
+ .modify = bfdd_bfd_sessions_single_hop_required_echo_receive_interval_modify,
+ .cli_show = bfd_cli_show_required_echo_receive_interval,
}
},
{
diff --git a/bfdd/bfdd_nb.h b/bfdd/bfdd_nb.h
index fbd557b6b..874e98691 100644
--- a/bfdd/bfdd_nb.h
+++ b/bfdd/bfdd_nb.h
@@ -43,6 +43,8 @@ int bfdd_bfd_profile_minimum_ttl_destroy(struct nb_cb_destroy_args *args);
int bfdd_bfd_profile_echo_mode_modify(struct nb_cb_modify_args *args);
int bfdd_bfd_profile_desired_echo_transmission_interval_modify(
struct nb_cb_modify_args *args);
+int bfdd_bfd_profile_required_echo_receive_interval_modify(
+ struct nb_cb_modify_args *args);
int bfdd_bfd_sessions_single_hop_create(struct nb_cb_create_args *args);
int bfdd_bfd_sessions_single_hop_destroy(struct nb_cb_destroy_args *args);
const void *
@@ -71,6 +73,8 @@ int bfdd_bfd_sessions_single_hop_echo_mode_modify(
struct nb_cb_modify_args *args);
int bfdd_bfd_sessions_single_hop_desired_echo_transmission_interval_modify(
struct nb_cb_modify_args *args);
+int bfdd_bfd_sessions_single_hop_required_echo_receive_interval_modify(
+ struct nb_cb_modify_args *args);
struct yang_data *
bfdd_bfd_sessions_single_hop_stats_local_discriminator_get_elem(
struct nb_cb_get_elem_args *args);
@@ -209,8 +213,10 @@ void bfd_cli_show_shutdown(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
void bfd_cli_show_echo(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
-void bfd_cli_show_echo_interval(struct vty *vty, struct lyd_node *dnode,
- bool show_defaults);
+void bfd_cli_show_desired_echo_transmission_interval(
+ struct vty *vty, struct lyd_node *dnode, bool show_defaults);
+void bfd_cli_show_required_echo_receive_interval(
+ struct vty *vty, struct lyd_node *dnode, bool show_defaults);
void bfd_cli_show_profile(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
void bfd_cli_peer_profile_show(struct vty *vty, struct lyd_node *dnode,
diff --git a/bfdd/bfdd_nb_config.c b/bfdd/bfdd_nb_config.c
index c8dd5cc3f..26bce4f35 100644
--- a/bfdd/bfdd_nb_config.c
+++ b/bfdd/bfdd_nb_config.c
@@ -483,17 +483,57 @@ int bfdd_bfd_profile_echo_mode_modify(struct nb_cb_modify_args *args)
}
/*
- * XPath: /frr-bfdd:bfdd/bfd/profile/desired-echo-echo-transmission-interval
+ * XPath: /frr-bfdd:bfdd/bfd/profile/desired-echo-transmission-interval
*/
int bfdd_bfd_profile_desired_echo_transmission_interval_modify(
struct nb_cb_modify_args *args)
{
struct bfd_profile *bp;
+ uint32_t min_tx;
+
+ switch (args->event) {
+ case NB_EV_VALIDATE:
+ min_tx = yang_dnode_get_uint32(args->dnode, NULL);
+ if (min_tx < 10000 || min_tx > 60000000)
+ return NB_ERR_VALIDATION;
+ break;
+
+ case NB_EV_PREPARE:
+ /* NOTHING */
+ break;
+
+ case NB_EV_APPLY:
+ min_tx = yang_dnode_get_uint32(args->dnode, NULL);
+ bp = nb_running_get_entry(args->dnode, NULL, true);
+ if (bp->min_echo_tx == min_tx)
+ return NB_OK;
+
+ bp->min_echo_tx = min_tx;
+ bfd_profile_update(bp);
+ break;
+
+ case NB_EV_ABORT:
+ /* NOTHING */
+ break;
+ }
+
+ return NB_OK;
+}
+
+/*
+ * XPath: /frr-bfdd:bfdd/bfd/profile/required-echo-receive-interval
+ */
+int bfdd_bfd_profile_required_echo_receive_interval_modify(
+ struct nb_cb_modify_args *args)
+{
+ struct bfd_profile *bp;
uint32_t min_rx;
switch (args->event) {
case NB_EV_VALIDATE:
min_rx = yang_dnode_get_uint32(args->dnode, NULL);
+ if (min_rx == 0)
+ return NB_OK;
if (min_rx < 10000 || min_rx > 60000000)
return NB_ERR_VALIDATION;
break;
@@ -789,7 +829,46 @@ int bfdd_bfd_sessions_single_hop_desired_echo_transmission_interval_modify(
case NB_EV_APPLY:
bs = nb_running_get_entry(args->dnode, NULL, true);
- if (echo_interval == bs->timers.required_min_echo)
+ if (echo_interval == bs->timers.desired_min_echo_tx)
+ return NB_OK;
+
+ bs->peer_profile.min_echo_tx = echo_interval;
+ bfd_session_apply(bs);
+ break;
+
+ case NB_EV_ABORT:
+ /* NOTHING */
+ break;
+ }
+
+ return NB_OK;
+}
+
+/*
+ * XPath:
+ * /frr-bfdd:bfdd/bfd/sessions/single-hop/required-echo-receive-interval
+ */
+int bfdd_bfd_sessions_single_hop_required_echo_receive_interval_modify(
+ struct nb_cb_modify_args *args)
+{
+ uint32_t echo_interval = yang_dnode_get_uint32(args->dnode, NULL);
+ struct bfd_session *bs;
+
+ switch (args->event) {
+ case NB_EV_VALIDATE:
+ if (echo_interval == 0)
+ return NB_OK;
+ if (echo_interval < 10000 || echo_interval > 60000000)
+ return NB_ERR_VALIDATION;
+ break;
+
+ case NB_EV_PREPARE:
+ /* NOTHING */
+ break;
+
+ case NB_EV_APPLY:
+ bs = nb_running_get_entry(args->dnode, NULL, true);
+ if (echo_interval == bs->timers.required_min_echo_rx)
return NB_OK;
bs->peer_profile.min_echo_rx = echo_interval;
diff --git a/bfdd/bfdd_vty.c b/bfdd/bfdd_vty.c
index cb140f7b1..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);
@@ -844,7 +857,8 @@ static int bfd_configure_peer(struct bfd_peer_cfg *bpc, bool mhop,
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. */
diff --git a/bfdd/bfddp_packet.h b/bfdd/bfddp_packet.h
index 8865baef6..4ece94f57 100644
--- a/bfdd/bfddp_packet.h
+++ b/bfdd/bfddp_packet.h
@@ -163,6 +163,11 @@ struct bfddp_session {
*/
uint32_t min_rx;
/**
+ * Minimum desired echo transmission interval (in microseconds)
+ * without jitter.
+ */
+ uint32_t min_echo_tx;
+ /**
* Required minimum echo receive interval rate (in microseconds)
* without jitter.
*/
diff --git a/bfdd/config.c b/bfdd/config.c
index b71670f01..a97caf137 100644
--- a/bfdd/config.c
+++ b/bfdd/config.c
@@ -135,7 +135,8 @@ static int parse_list(struct json_object *jo, enum peer_list_type plt,
bpc.bpc_detectmultiplier = BFD_DEFDETECTMULT;
bpc.bpc_recvinterval = BFD_DEFREQUIREDMINRX;
bpc.bpc_txinterval = BFD_DEFDESIREDMINTX;
- bpc.bpc_echointerval = BFD_DEF_REQ_MIN_ECHO;
+ bpc.bpc_echorecvinterval = BFD_DEF_REQ_MIN_ECHO_RX;
+ bpc.bpc_echotxinterval = BFD_DEF_DES_MIN_ECHO_TX;
switch (plt) {
case PLT_IPV4:
@@ -250,11 +251,16 @@ static int parse_peer_config(struct json_object *jo, struct bfd_peer_cfg *bpc)
bpc->bpc_has_txinterval = true;
zlog_debug(" transmit-interval: %" PRIu64,
bpc->bpc_txinterval);
- } else if (strcmp(key, "echo-interval") == 0) {
- bpc->bpc_echointerval = json_object_get_int64(jo_val);
- bpc->bpc_has_echointerval = true;
- zlog_debug(" echo-interval: %" PRIu64,
- bpc->bpc_echointerval);
+ } else if (strcmp(key, "echo-receive-interval") == 0) {
+ bpc->bpc_echorecvinterval = json_object_get_int64(jo_val);
+ bpc->bpc_has_echorecvinterval = true;
+ zlog_debug(" echo-receive-interval: %" PRIu64,
+ bpc->bpc_echorecvinterval);
+ } else if (strcmp(key, "echo-transmit-interval") == 0) {
+ bpc->bpc_echotxinterval = json_object_get_int64(jo_val);
+ bpc->bpc_has_echotxinterval = true;
+ zlog_debug(" echo-transmit-interval: %" PRIu64,
+ bpc->bpc_echotxinterval);
} else if (strcmp(key, "create-only") == 0) {
bpc->bpc_createonly = json_object_get_boolean(jo_val);
zlog_debug(" create-only: %s",
@@ -463,8 +469,10 @@ char *config_notify_config(const char *op, struct bfd_session *bs)
bs->timers.required_min_rx / 1000);
json_object_int_add(resp, "transmit-interval",
bs->timers.desired_min_tx / 1000);
- json_object_int_add(resp, "echo-interval",
- bs->timers.required_min_echo / 1000);
+ json_object_int_add(resp, "echo-receive-interval",
+ bs->timers.required_min_echo_rx / 1000);
+ json_object_int_add(resp, "echo-transmit-interval",
+ bs->timers.desired_min_echo_tx / 1000);
json_object_int_add(resp, "remote-detect-multiplier",
bs->remote_detect_mult);
@@ -472,7 +480,7 @@ char *config_notify_config(const char *op, struct bfd_session *bs)
bs->remote_timers.required_min_rx / 1000);
json_object_int_add(resp, "remote-transmit-interval",
bs->remote_timers.desired_min_tx / 1000);
- json_object_int_add(resp, "remote-echo-interval",
+ json_object_int_add(resp, "remote-echo-receive-interval",
bs->remote_timers.required_min_echo / 1000);
if (CHECK_FLAG(bs->flags, BFD_SESS_FLAG_ECHO))
diff --git a/bfdd/dplane.c b/bfdd/dplane.c
index 66b79f3b1..9cb0b0ea8 100644
--- a/bfdd/dplane.c
+++ b/bfdd/dplane.c
@@ -765,7 +765,8 @@ static void _bfd_dplane_session_fill(const struct bfd_session *bs,
msg->data.session.lid = htonl(bs->discrs.my_discr);
msg->data.session.min_tx = htonl(bs->timers.desired_min_tx);
msg->data.session.min_rx = htonl(bs->timers.required_min_rx);
- msg->data.session.min_echo_rx = htonl(bs->timers.required_min_echo);
+ msg->data.session.min_echo_tx = htonl(bs->timers.desired_min_echo_tx);
+ msg->data.session.min_echo_rx = htonl(bs->timers.required_min_echo_rx);
}
static int _bfd_dplane_add_session(struct bfd_dplane_ctx *bdc,