summaryrefslogtreecommitdiffstats
path: root/lib/bfd.c
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2020-10-04 23:02:24 +0200
committerRafael Zalamena <rzalamena@opensourcerouting.org>2020-11-08 16:06:32 +0100
commit4b983eef2cb5c7306a8303f002d0e053ebeabdca (patch)
tree83a4873c51fc08c08040696165cba802a94cfd00 /lib/bfd.c
parentMerge pull request #7486 from ton31337/fix/bgp_debug_keepalives_docstring (diff)
downloadfrr-4b983eef2cb5c7306a8303f002d0e053ebeabdca.tar.xz
frr-4b983eef2cb5c7306a8303f002d0e053ebeabdca.zip
bfdd,lib: simplify integration protocol
Let the integration protocol always send the full configuration instead of saving a few bytes. It will also allow protocols to specify source address for IPv4 single hop connections and interface for multi hop configuration. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'lib/bfd.c')
-rw-r--r--lib/bfd.c43
1 files changed, 33 insertions, 10 deletions
diff --git a/lib/bfd.c b/lib/bfd.c
index d1a0ec671..088bcc431 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -468,6 +468,39 @@ int zclient_bfd_command(struct zclient *zc, struct bfd_session_arg *args)
: sizeof(struct in6_addr);
stream_put(s, &args->dst, addrlen);
+ /*
+ * For more BFD integration protocol details, see function
+ * `_ptm_msg_read` in `bfdd/ptm_adapter.c`.
+ */
+#if HAVE_BFDD > 0
+ /* Session timers. */
+ stream_putl(s, args->min_rx);
+ stream_putl(s, args->min_tx);
+ stream_putc(s, args->detection_multiplier);
+
+ /* Is multi hop? */
+ stream_putc(s, args->mhop != 0);
+
+ /* Source address. */
+ stream_putw(s, args->family);
+ stream_put(s, &args->src, addrlen);
+
+ /* Send the expected TTL. */
+ stream_putc(s, args->ttl);
+
+ /* Send interface name if any. */
+ stream_putc(s, args->ifnamelen);
+ if (args->ifnamelen)
+ stream_put(s, args->ifname, args->ifnamelen);
+
+ /* Send the C bit indicator. */
+ stream_putc(s, args->cbit);
+
+ /* Send profile name if any. */
+ stream_putc(s, args->profilelen);
+ if (args->profilelen)
+ stream_put(s, args->profile, args->profilelen);
+#else /* PTM BFD */
/* Encode timers if this is a registration message. */
if (args->command != ZEBRA_BFD_DEST_DEREGISTER) {
stream_putl(s, args->min_rx);
@@ -500,16 +533,6 @@ int zclient_bfd_command(struct zclient *zc, struct bfd_session_arg *args)
if (args->ifnamelen)
stream_put(s, args->ifname, args->ifnamelen);
}
-
- /* Send the C bit indicator. */
- stream_putc(s, args->cbit);
-
- /* `ptm-bfd` doesn't support profiles yet. */
-#if HAVE_BFDD > 0
- /* Send profile name if any. */
- stream_putc(s, args->profilelen);
- if (args->profilelen)
- stream_put(s, args->profile, args->profilelen);
#endif /* HAVE_BFDD */
/* Finish the message by writing the size. */