Skip to content
Permalink
Browse files

Merge pull request #2856 from opensourcerouting/bfd-work

bfdd: bug fixes and improvements
  • Loading branch information...
donaldsharp committed Aug 16, 2018
2 parents ad03f5e + 3bcd76c commit 018928cbaa0f302a6b81af1507b0a049b265348c
Showing with 341 additions and 67 deletions.
  1. +6 −2 bfdd/bfd.c
  2. +3 −0 bfdd/bfd.h
  3. +6 −12 bfdd/bfd_packet.c
  4. +201 −34 bfdd/bfdd_vty.c
  5. +3 −3 bfdd/control.c
  6. +16 −15 bfdd/ptm_adapter.c
  7. +104 −1 doc/user/bfd.rst
  8. +2 −0 zebra/zebra_ptm.c
@@ -185,10 +185,12 @@ void ptm_bfd_ses_up(struct bfd_session *bfd)

control_notify(bfd);

if (old_state != bfd->ses_state)
if (old_state != bfd->ses_state) {
bfd->stats.session_up++;
log_info("state-change: [%s] %s -> %s", bs_to_string(bfd),
state_list[old_state].str,
state_list[bfd->ses_state].str);
}
}

void ptm_bfd_ses_dn(struct bfd_session *bfd, uint8_t diag)
@@ -212,11 +214,13 @@ void ptm_bfd_ses_dn(struct bfd_session *bfd, uint8_t diag)
if (BFD_CHECK_FLAG(bfd->flags, BFD_SESS_FLAG_ECHO_ACTIVE))
ptm_bfd_echo_stop(bfd, 0);

if (old_state != bfd->ses_state)
if (old_state != bfd->ses_state) {
bfd->stats.session_down++;
log_info("state-change: [%s] %s -> %s reason:%s",
bs_to_string(bfd), state_list[old_state].str,
state_list[bfd->ses_state].str,
get_diag_str(bfd->local_diag));
}
}

static int ptm_bfd_get_vrf_name(char *port_name, char *vrf_name)
@@ -186,6 +186,9 @@ struct bfd_session_stats {
uint64_t tx_ctrl_pkt;
uint64_t rx_echo_pkt;
uint64_t tx_echo_pkt;
uint64_t session_up;
uint64_t session_down;
uint64_t znotification;
};

struct bfd_session_vxlan_info {
@@ -718,12 +718,6 @@ static ssize_t bfd_recv_ipv4(int sd, bool is_mhop, char *port, size_t portlen,
msghdr.msg_control = cmsgbuf;
msghdr.msg_controllen = sizeof(cmsgbuf);

/* Sanitize input/output. */
memset(port, 0, portlen);
memset(vrfname, 0, vrfnamelen);
memset(local, 0, sizeof(*local));
memset(peer, 0, sizeof(*peer));

mlen = recvmsg(sd, &msghdr, MSG_DONTWAIT);
if (mlen == -1) {
if (errno != EAGAIN)
@@ -843,12 +837,6 @@ ssize_t bfd_recv_ipv6(int sd, bool is_mhop, char *port, size_t portlen,
msghdr6.msg_control = cmsgbuf6;
msghdr6.msg_controllen = sizeof(cmsgbuf6);

/* Sanitize input/output. */
memset(port, 0, portlen);
memset(vrfname, 0, vrfnamelen);
memset(local, 0, sizeof(*local));
memset(peer, 0, sizeof(*peer));

mlen = recvmsg(sd, &msghdr6, MSG_DONTWAIT);
if (mlen == -1) {
if (errno != EAGAIN)
@@ -983,6 +971,12 @@ int bfd_recv_cb(struct thread *t)
return 0;
}

/* Sanitize input/output. */
memset(port, 0, sizeof(port));
memset(vrfname, 0, sizeof(vrfname));
memset(&local, 0, sizeof(local));
memset(&peer, 0, sizeof(peer));

/* Handle control packets. */
is_mhop = is_vxlan = false;
if (sd == bglobal.bg_shop || sd == bglobal.bg_mhop) {
Oops, something went wrong.

0 comments on commit 018928c

Please sign in to comment.
You can’t perform that action at this time.