summaryrefslogtreecommitdiffstats
path: root/bfdd/ptm_adapter.c
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@users.noreply.github.com>2019-10-29 16:12:27 +0100
committerGitHub <noreply@github.com>2019-10-29 16:12:27 +0100
commit37cdb6e91dd8410bb884c15a818a37775e9cd135 (patch)
treea3dfd4ab29c70ddb3e2713d7b723a71bcc4115da /bfdd/ptm_adapter.c
parentMerge pull request #5240 from donaldsharp/zebra_nhg_sa (diff)
parentbfdd: Handling local and remote admin-down (diff)
downloadfrr-37cdb6e91dd8410bb884c15a818a37775e9cd135.tar.xz
frr-37cdb6e91dd8410bb884c15a818a37775e9cd135.zip
Merge pull request #5197 from SumitAgarwal123/BFD_ADMIN_DOWN
bfdd: Handling local and remote admin-down
Diffstat (limited to 'bfdd/ptm_adapter.c')
-rw-r--r--bfdd/ptm_adapter.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/bfdd/ptm_adapter.c b/bfdd/ptm_adapter.c
index df48bc2af..dcca70b79 100644
--- a/bfdd/ptm_adapter.c
+++ b/bfdd/ptm_adapter.c
@@ -153,7 +153,7 @@ static int _ptm_msg_address(struct stream *msg, int family, const void *addr)
return 0;
}
-int ptm_bfd_notify(struct bfd_session *bs)
+int ptm_bfd_notify(struct bfd_session *bs, uint8_t notify_state)
{
struct stream *msg;
@@ -204,12 +204,15 @@ int ptm_bfd_notify(struct bfd_session *bs)
_ptm_msg_address(msg, bs->key.family, &bs->key.peer);
/* BFD status */
- switch (bs->ses_state) {
+ switch (notify_state) {
case PTM_BFD_UP:
stream_putl(msg, BFD_STATUS_UP);
break;
case PTM_BFD_ADM_DOWN:
+ stream_putl(msg, BFD_STATUS_ADMIN_DOWN);
+ break;
+
case PTM_BFD_DOWN:
case PTM_BFD_INIT:
stream_putl(msg, BFD_STATUS_DOWN);
@@ -432,7 +435,7 @@ static void bfdd_dest_register(struct stream *msg, vrf_id_t vrf_id)
return;
}
- ptm_bfd_notify(bs);
+ ptm_bfd_notify(bs, bs->ses_state);
}
static void bfdd_dest_deregister(struct stream *msg, vrf_id_t vrf_id)
@@ -461,6 +464,10 @@ static void bfdd_dest_deregister(struct stream *msg, vrf_id_t vrf_id)
if (bs->refcount ||
BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_CONFIG))
return;
+
+ bs->ses_state = PTM_BFD_ADM_DOWN;
+ ptm_bfd_snd(bs, 0);
+
ptm_bfd_sess_del(&bpc);
}