]> git.puffer.fish Git - mirror/frr.git/commit
bgpd: fix crash on daemon exit
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Thu, 21 May 2020 19:02:44 +0000 (16:02 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Fri, 29 May 2020 20:48:14 +0000 (17:48 -0300)
commit95a99382cbeb756344c02aef44f862abee53c3b8
treeb1818ee18200846361b474df2edeabda3442499e
parent68286f96197c7d1775eb75acc6713b05e57a95d7
bgpd: fix crash on daemon exit

Don't attempt to send BFD daemon a message to remove the peer
registration on daemon exit, otherwise we'll access a dangling
interface pointer and we'll crash.

This crash was not previosly possible because the function that built
the message was passing the interface pointer but not using it due to
the exit condition.

In `lib/bfd.c`:

```
void bfd_peer_sendmsg(struct zclient *zclient, struct bfd_info *bfd_info,
      int family, void *dst_ip, void *src_ip, char *if_name,
      int ttl, int multihop, int cbit, int command,
      int set_flag, vrf_id_t vrf_id)
{
struct bfd_session_arg args = {};
size_t addrlen;

/* Individual reg/dereg messages are suppressed during shutdown. */
if (CHECK_FLAG(bfd_gbl.flags, BFD_GBL_FLAG_IN_SHUTDOWN)) {
if (bfd_debug)
zlog_debug(
"%s: Suppressing BFD peer reg/dereg messages",
__func__);
return;
}
```

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
bgpd/bgp_bfd.c