From 59dad8137ef0466d15240b49ece8710b31e4784f Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Wed, 10 Mar 2021 22:11:19 +0300 Subject: [PATCH] bfdd: make sessions administratively up by default Current behavior is inconsistent. When the session is created by another daemon, it is up by default. When we later configure peer in bfdd, the session is still up, but the NB layer thinks that it is down. More than that, even when the session is created in bfdd using peer command, it is created in DOWN state, not ADM_DOWN. And it actually starts sending and receiving packets. The sessions is marked with SHUTDOWN flag only when we try to reconfigure some parameter. This behavior is also very unexpected. Fixes #7780. Signed-off-by: Igor Ryzhov --- bfdd/bfd.c | 4 ++-- bfdd/bfdd_cli.c | 2 +- bfdd/bfdd_vty.c | 2 +- bfdd/ptm_adapter.c | 3 --- yang/frr-bfdd.yang | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/bfdd/bfd.c b/bfdd/bfd.c index 499e54603f..3cbb3691ec 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -85,7 +85,7 @@ struct bfd_profile *bfd_profile_lookup(const char *name) static void bfd_profile_set_default(struct bfd_profile *bp) { - bp->admin_shutdown = true; + bp->admin_shutdown = false; bp->detection_multiplier = BFD_DEFDETECTMULT; bp->echo_mode = false; bp->passive = false; @@ -206,7 +206,7 @@ void bfd_session_apply(struct bfd_session *bs) bfd_set_passive_mode(bs, bs->peer_profile.passive); /* Toggle 'no shutdown' if default value. */ - if (bs->peer_profile.admin_shutdown) + if (bs->peer_profile.admin_shutdown == false) bfd_set_shutdown(bs, bp->admin_shutdown); else bfd_set_shutdown(bs, bs->peer_profile.admin_shutdown); diff --git a/bfdd/bfdd_cli.c b/bfdd/bfdd_cli.c index 5072c76aac..206f6c7d0c 100644 --- a/bfdd/bfdd_cli.c +++ b/bfdd/bfdd_cli.c @@ -274,7 +274,7 @@ void bfd_cli_show_shutdown(struct vty *vty, struct lyd_node *dnode, bool show_defaults) { if (show_defaults) - vty_out(vty, " shutdown\n"); + vty_out(vty, " no shutdown\n"); else vty_out(vty, " %sshutdown\n", yang_dnode_get_bool(dnode, NULL) ? "" : "no "); diff --git a/bfdd/bfdd_vty.c b/bfdd/bfdd_vty.c index 53e23cf6c2..cb140f7b18 100644 --- a/bfdd/bfdd_vty.c +++ b/bfdd/bfdd_vty.c @@ -840,7 +840,7 @@ 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; diff --git a/bfdd/ptm_adapter.c b/bfdd/ptm_adapter.c index 0c70600f20..4135e5fb49 100644 --- a/bfdd/ptm_adapter.c +++ b/bfdd/ptm_adapter.c @@ -492,9 +492,6 @@ static void bfdd_dest_register(struct stream *msg, vrf_id_t vrf_id) "ptm-add-dest: failed to create BFD session"); return; } - - /* Protocol created peers are 'no shutdown' by default. */ - bs->peer_profile.admin_shutdown = false; } else { /* * BFD session was already created, we are just updating the diff --git a/yang/frr-bfdd.yang b/yang/frr-bfdd.yang index 5b434162d0..0f090a1b72 100644 --- a/yang/frr-bfdd.yang +++ b/yang/frr-bfdd.yang @@ -185,7 +185,7 @@ module frr-bfdd { leaf administrative-down { type boolean; - default true; + default false; description "Disables or enables the session administratively"; } -- 2.39.5