Skip to content

Commit

Permalink
tests: update timers in BFD VRF test
Browse files Browse the repository at this point in the history
Increase BFD Echo timers to make test stable.

Signed-off-by: Lynne Morrison <lynne.morrison@ibm.com>
  • Loading branch information
lynnemorrison authored and Javier Garcia committed Jun 20, 2022
1 parent 59ed254 commit afb8f2c
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 15 deletions.
24 changes: 14 additions & 10 deletions bfdd/bfd_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ int _ptm_bfd_send(struct bfd_session *bs, uint16_t *port, const void *data,
* Checksum is not set in the packet, just computed.
*
* pkt
* VRRP packet, fully filled out except for checksum field.
* Packet, fully filled out except for checksum field.
*
* pktsize
* sizeof(*pkt)
Expand All @@ -156,7 +156,7 @@ int _ptm_bfd_send(struct bfd_session *bs, uint16_t *port, const void *data,
* IP address that pkt will be transmitted from and too.
*
* Returns:
* VRRP checksum in network byte order.
* Checksum in network byte order.
*/
static uint16_t bfd_pkt_checksum(struct udphdr *pkt, size_t pktsize,
struct in6_addr *ip, sa_family_t family)
Expand Down Expand Up @@ -428,7 +428,6 @@ void ptm_bfd_snd(struct bfd_session *bfd, int fbit)
#ifdef BFD_LINUX
/*
* receive the ipv4 echo packet that was loopback in the peers forwarding plane
*
*/
ssize_t bfd_recv_ipv4_fp(int sd, uint8_t *msgbuf, size_t msgbuflen,
uint8_t *ttl, ifindex_t *ifindex,
Expand Down Expand Up @@ -470,8 +469,9 @@ ssize_t bfd_recv_ipv4_fp(int sd, uint8_t *msgbuf, size_t msgbuflen,
checksum = in_cksum((const void *)ip, sizeof(struct iphdr));
if (recv_checksum != checksum) {
if (bglobal.debug_network)
zlog_debug("%s: invalid iphdr checksum expected 0x%x rcvd 0x%x",
__func__, checksum, recv_checksum );
zlog_debug(
"%s: invalid iphdr checksum expected 0x%x rcvd 0x%x",
__func__, checksum, recv_checksum);
return -1;
}

Expand Down Expand Up @@ -501,11 +501,12 @@ ssize_t bfd_recv_ipv4_fp(int sd, uint8_t *msgbuf, size_t msgbuflen,
recv_checksum = uh->check;
uh->check = 0;
checksum = bfd_pkt_checksum(uh, ntohs(uh->len),
(struct in6_addr *)&ip->saddr, AF_INET);
(struct in6_addr *)&ip->saddr, AF_INET);
if (recv_checksum != checksum) {
if (bglobal.debug_network)
zlog_debug("%s: invalid udphdr checksum expected 0x%x rcvd 0x%x",
__func__, checksum, recv_checksum );
zlog_debug(
"%s: invalid udphdr checksum expected 0x%x rcvd 0x%x",
__func__, checksum, recv_checksum);
return -1;
}
return mlen;
Expand Down Expand Up @@ -1574,7 +1575,11 @@ int bp_echo_socket(const struct vrf *vrf)
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_IP);
sll.sll_ifindex = 0;
bind(s, (struct sockaddr *)&sll, sizeof(sll));
if (bind(s, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
zlog_warn("Failed to bind echo socket: %s",
safe_strerror(errno));
return -1;
}

return s;
}
Expand All @@ -1586,7 +1591,6 @@ int bp_echo_socket(const struct vrf *vrf)
frr_with_privs(&bglobal.bfdd_privs) {
s = vrf_socket(AF_INET, SOCK_DGRAM, 0, vrf->vrf_id, vrf->name);
}

if (s == -1)
zlog_fatal("echo-socket: socket: %s", strerror(errno));

Expand Down
7 changes: 6 additions & 1 deletion bfdd/bfdd_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,13 @@ DEFPY_YANG(
}

if (!no && !bglobal.bg_use_dplane) {
#ifdef BFD_LINUX
vty_out(vty,
"%% Echo mode works correctly for ipv4, but only works when the peer is also FRR for IPv6.\n");
"%% Echo mode works correctly for IPv4, but only works when the peer is also FRR for IPv6.\n");
#else
vty_out(vty,
"%% Current implementation of echo mode works only when the peer is also FRR.\n");
#endif /* BFD_LINUX */
}

nb_cli_enqueue_change(vty, "./echo-mode", NB_OP_MODIFY,
Expand Down
4 changes: 4 additions & 0 deletions tests/topotests/bfd_vrf_topo1/r1/bfdd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
!
bfd
peer 192.168.0.2 vrf r1-bfd-cust1
receive-interval 1000
transmit-interval 1000
echo-mode
echo transmit-interval 500
echo receive-interval 500
no shutdown
!
!
2 changes: 1 addition & 1 deletion tests/topotests/bfd_vrf_topo1/r1/peers.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"remote-receive-interval": 1000,
"remote-transmit-interval": 500,
"remote-transmit-interval": 1000,
"peer": "192.168.0.2",
"status": "up"
}
Expand Down
8 changes: 7 additions & 1 deletion tests/topotests/bfd_vrf_topo1/r2/bfdd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@
bfd
peer 192.168.0.1 vrf r2-bfd-cust1
receive-interval 1000
transmit-interval 500
transmit-interval 1000
echo-mode
echo transmit-interval 500
echo receive-interval 500
no shutdown
!
peer 192.168.1.1 vrf r2-bfd-cust1
receive-interval 1000
transmit-interval 1000
echo-mode
echo transmit-interval 500
echo receive-interval 500
no shutdown
!
!
2 changes: 1 addition & 1 deletion tests/topotests/bfd_vrf_topo1/r2/peers.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"status": "up"
},
{
"remote-echo-receive-interval": 100,
"remote-echo-receive-interval": 500,
"peer": "192.168.1.1",
"status": "up"
},
Expand Down
4 changes: 3 additions & 1 deletion tests/topotests/bfd_vrf_topo1/r3/bfdd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
!
bfd
peer 192.168.1.2 vrf r3-bfd-cust1
echo-interval 100
receive-interval 1000
transmit-interval 1000
echo-interval 500
echo-mode
no shutdown
!
Expand Down

0 comments on commit afb8f2c

Please sign in to comment.