]> git.proxmox.com Git - mirror_frr.git/commitdiff
bfdd: avoid having bfd config inherited from operation context
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 17 Apr 2019 16:01:11 +0000 (18:01 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 18 Apr 2019 09:48:16 +0000 (11:48 +0200)
there are cases where bfd sessions are created from remote daemons. in
that case, the bfd daemon were appearing in both operational and
configuration contexts of bfd. Change that by only keeping operational
contexts.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bfdd/bfd.h
bfdd/bfdd_vty.c

index a69ff9a1a7b9a33b7756d6ef6305a125904220d2..78122baf7a152ed8874a3896f647fe033e9fb1be 100644 (file)
@@ -166,6 +166,7 @@ enum bfd_session_flags {
                                                 * expires
                                                 */
        BFD_SESS_FLAG_SHUTDOWN = 1 << 7,        /* disable BGP peer function */
+       BFD_SESS_FLAG_CONFIG = 1 << 8,  /* Session configured with bfd NB API */
 };
 
 #define BFD_SET_FLAG(field, flag) (field |= flag)
index c13949207642fe1e81673269291b48a957afda2f..4efdd817c1c78a44a22844d84cb9b907fd9f6379 100644 (file)
@@ -158,6 +158,12 @@ DEFUN_NOSH(
                }
        }
 
+       if (!BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_CONFIG)) {
+               if (bs->refcount)
+                       vty_out(vty, "%% session peer is now configurable via bfd daemon.\n");
+               BFD_SET_FLAG(bs->flags, BFD_SESS_FLAG_CONFIG);
+       }
+
        VTY_PUSH_CONTEXT(BFD_PEER_NODE, bs);
 
        return CMD_SUCCESS;
@@ -984,6 +990,9 @@ static void _bfdd_peer_write_config_iter(struct hash_bucket *hb, void *arg)
        struct vty *vty = arg;
        struct bfd_session *bs = hb->data;
 
+       if (!BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_CONFIG))
+               return;
+
        _bfdd_peer_write_config(vty, bs);
 }