summaryrefslogtreecommitdiffstats
path: root/bfdd
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2018-07-11 20:55:12 +0200
committerRafael Zalamena <rzalamena@opensourcerouting.org>2018-08-08 23:25:08 +0200
commit971532e2e73089be449586240fabe5d42ebf7c4b (patch)
tree1656488c11b1b218ea76fa75121856780a1f783b /bfdd
parentbfdd: show single hop local-address (diff)
downloadfrr-971532e2e73089be449586240fabe5d42ebf7c4b.tar.xz
frr-971532e2e73089be449586240fabe5d42ebf7c4b.zip
bfdd: send replay request on zebra connection
This will make `bfdd` synchronize with its client when zebra dies or bfdd is restarted. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'bfdd')
-rw-r--r--bfdd/ptm_adapter.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/bfdd/ptm_adapter.c b/bfdd/ptm_adapter.c
index 5e79be91f..28e332626 100644
--- a/bfdd/ptm_adapter.c
+++ b/bfdd/ptm_adapter.c
@@ -180,6 +180,9 @@ int ptm_bfd_notify(struct bfd_session *bs)
/* TODO: VRF handling */
zclient_create_header(msg, ZEBRA_BFD_DEST_REPLAY, VRF_DEFAULT);
+ /* This header will be handled by `zebra_ptm.c`. */
+ stream_putl(msg, ZEBRA_INTERFACE_BFD_DEST_UPDATE);
+
/* NOTE: Interface is a shortcut to avoid comparing source address. */
stream_putl(msg, bs->ifindex);
@@ -515,6 +518,22 @@ stream_failure:
return -1;
}
+static void bfdd_zebra_connected(struct zclient *zc)
+{
+ struct stream *msg = zc->obuf;
+
+ /*
+ * The replay is an empty message just to trigger client daemons
+ * configuration replay.
+ */
+ stream_reset(msg);
+ zclient_create_header(msg, ZEBRA_BFD_DEST_REPLAY, VRF_DEFAULT);
+ stream_putl(msg, ZEBRA_BFD_DEST_REPLAY);
+ stream_putw_at(msg, 0, stream_get_endp(msg));
+
+ zclient_send_message(zclient);
+}
+
void bfdd_zclient_init(struct zebra_privs_t *bfdd_priv)
{
zclient = zclient_new_notify(master, &zclient_options_default);
@@ -527,6 +546,9 @@ void bfdd_zclient_init(struct zebra_privs_t *bfdd_priv)
* avoid having to create too many handlers.
*/
zclient->bfd_dest_replay = bfdd_replay;
+
+ /* Send replay request on zebra connect. */
+ zclient->zebra_connected = bfdd_zebra_connected;
}
void bfdd_zclient_stop(void)