summaryrefslogtreecommitdiffstats
path: root/lib/bfd.c
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2020-05-31 13:28:05 +0200
committerRafael Zalamena <rzalamena@opensourcerouting.org>2020-06-12 19:25:53 +0200
commit6a6b1036579bf2ed1e8c71957e4dce2e4b09ae2c (patch)
treeef8cc765912c36d4e3fc5f90dc40090cd83044c2 /lib/bfd.c
parentisisd: check interface pointer before accessing (diff)
downloadfrr-6a6b1036579bf2ed1e8c71957e4dce2e4b09ae2c.tar.xz
frr-6a6b1036579bf2ed1e8c71957e4dce2e4b09ae2c.zip
lib: permit BFD library users to pass NULL
Add the proper handling for cases where user forgets or doesn't have the pointer needed to call the library function. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'lib/bfd.c')
-rw-r--r--lib/bfd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/bfd.c b/lib/bfd.c
index 2d86acbbf..7c84648d9 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -158,9 +158,11 @@ void bfd_peer_sendmsg(struct zclient *zclient, struct bfd_info *bfd_info,
args.command = command;
args.set_flag = set_flag;
args.bfd_info = bfd_info;
- args.min_rx = bfd_info->required_min_rx;
- args.min_tx = bfd_info->desired_min_tx;
- args.detection_multiplier = bfd_info->detect_mult;
+ if (args.bfd_info) {
+ args.min_rx = bfd_info->required_min_rx;
+ args.min_tx = bfd_info->desired_min_tx;
+ args.detection_multiplier = bfd_info->detect_mult;
+ }
addrlen = family == AF_INET ? sizeof(struct in_addr)
: sizeof(struct in6_addr);
@@ -502,7 +504,7 @@ int zclient_bfd_command(struct zclient *zc, struct bfd_session_arg *args)
}
/* Write registration indicator into data structure. */
- if (args->set_flag) {
+ if (args->bfd_info && args->set_flag) {
if (args->command == ZEBRA_BFD_DEST_REGISTER)
SET_FLAG(args->bfd_info->flags, BFD_FLAG_BFD_REG);
else if (args->command == ZEBRA_BFD_DEST_DEREGISTER)