Merge pull request #4155 from pguibert6WIND/bfd_increase_config

bfdd: avoid having bfd config inherited from operation context
This commit is contained in:
Russ White 2019-04-25 18:48:35 -04:00 committed by GitHub
commit a34fd5b9f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View File

@ -166,6 +166,7 @@ enum bfd_session_flags {
* expires
*/
BFD_SESS_FLAG_SHUTDOWN = 1 << 7, /* disable BGP peer function */
BFD_SESS_FLAG_CONFIG = 1 << 8, /* Session configured with bfd NB API */
};
#define BFD_SET_FLAG(field, flag) (field |= flag)

View File

@ -158,6 +158,12 @@ DEFUN_NOSH(
}
}
if (!BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_CONFIG)) {
if (bs->refcount)
vty_out(vty, "%% session peer is now configurable via bfd daemon.\n");
BFD_SET_FLAG(bs->flags, BFD_SESS_FLAG_CONFIG);
}
VTY_PUSH_CONTEXT(BFD_PEER_NODE, bs);
return CMD_SUCCESS;
@ -984,6 +990,9 @@ static void _bfdd_peer_write_config_iter(struct hash_bucket *hb, void *arg)
struct vty *vty = arg;
struct bfd_session *bs = hb->data;
if (!BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_CONFIG))
return;
_bfdd_peer_write_config(vty, bs);
}

View File

@ -431,6 +431,10 @@ static void bfdd_dest_deregister(struct stream *msg)
/* Unregister client peer notification. */
pcn = pcn_lookup(pc, bs);
pcn_free(pcn);
if (bs->refcount ||
BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_CONFIG))
return;
ptm_bfd_ses_del(&bpc);
}
/*