bfd: Update bfd status on bfd creation and deletion.
authorAlex Wang <alexw@nicira.com>
Wed, 7 May 2014 06:46:39 +0000 (23:46 -0700)
committerAlex Wang <alexw@nicira.com>
Wed, 7 May 2014 18:03:33 +0000 (11:03 -0700)
Commit 88bf179aa3 (bfd/cfm: Check status change before update
status to database.) used a boolean flag to trigger bfd status
update.  However, the flag is not set on bfd creation and deletion.

To prevent any stale status in database, this commit makes bfd module
always set the flag on bfd creation and deletion.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
lib/bfd.c

index 2d53bd2..d83d198 100644 (file)
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -388,6 +388,8 @@ bfd_configure(struct bfd *bfd, const char *name, const struct smap *cfg,
         bfd_set_state(bfd, STATE_DOWN, DIAG_NONE);
 
         memcpy(bfd->eth_dst, eth_addr_bfd, ETH_ADDR_LEN);
+
+        bfd_status_changed(bfd);
     }
 
     atomic_store(&bfd->check_tnl_key,
@@ -492,6 +494,7 @@ bfd_unref(struct bfd *bfd) OVS_EXCLUDED(mutex)
 {
     if (bfd && ovs_refcount_unref(&bfd->ref_cnt) == 1) {
         ovs_mutex_lock(&mutex);
+        bfd_status_changed(bfd);
         hmap_remove(all_bfds, &bfd->node);
         netdev_close(bfd->netdev);
         free(bfd->name);