/* detect interval. */
uint64_t decay_rx_packets; /* Packets received by 'netdev'. */
long long int decay_detect_time; /* Decay detection time. */
+
+ uint64_t flap_count; /* Counts bfd forwarding flaps. */
};
static struct ovs_mutex mutex = OVS_MUTEX_INITIALIZER;
smap_add(smap, "forwarding", bfd->forwarding ? "true" : "false");
smap_add(smap, "state", bfd_state_str(bfd->state));
smap_add(smap, "diagnostic", bfd_diag_str(bfd->diag));
+ smap_add_format(smap, "flap_count", "%"PRIu64, bfd->flap_count);
if (bfd->state != STATE_DOWN) {
smap_add(smap, "remote_state", bfd_state_str(bfd->rmt_state));
bfd->netdev = netdev_ref(netdev);
bfd->rx_packets = bfd_rx_packets(bfd);
bfd->in_decay = false;
+ bfd->flap_count = 0;
/* RFC 5881 section 4
* The source port MUST be in the range 49152 through 65535. The same
msg = ofpbuf_at(p, (uint8_t *)p->l7 - (uint8_t *)p->data, BFD_PACKET_LEN);
if (!msg) {
VLOG_INFO_RL(&rl, "%s: Received too-short BFD control message (only "
- "%td bytes long, at least %d required).",
+ "%"PRIdPTR" bytes long, at least %d required).",
bfd->name, (uint8_t *) ofpbuf_tail(p) - (uint8_t *) p->l7,
BFD_PACKET_LEN);
goto out;
}
\f
-/* Updates the forwarding flag. */
+/* Updates the forwarding flag. If override is not configured and
+ * the forwarding flag value changes, increments the flap count. */
static bool
bfd_forwarding__(struct bfd *bfd) OVS_REQUIRES(mutex)
{
long long int time;
+ bool forwarding_old = bfd->forwarding;
if (bfd->forwarding_override != -1) {
return bfd->forwarding_override == 1;
&& bfd->rmt_diag != DIAG_PATH_DOWN
&& bfd->rmt_diag != DIAG_CPATH_DOWN
&& bfd->rmt_diag != DIAG_RCPATH_DOWN;
+ if (bfd->forwarding != forwarding_old) {
+ bfd->flap_count++;
+ }
return bfd->forwarding;
}