]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: set/unset bfd profile
authorDmitrii Turlupov <dturlupov@factor-ts.ru>
Wed, 29 Jun 2022 13:33:01 +0000 (16:33 +0300)
committerDmitrii Turlupov <dturlupov@factor-ts.ru>
Thu, 30 Jun 2022 07:56:34 +0000 (10:56 +0300)
Before this patch we can enable 'ip ospf bfd' via '[no] ip ospf bfd profile ...' commads.
After patch '[no] ip ospf bfd profile ...' actual only if 'ip ospf bfd' is set.

Signed-off-by: Dmitrii Turlupov <dturlupov@factor-ts.ru>
ospfd/ospf_bfd.c
tests/topotests/bfd_profiles_topo1/r1/ospfd.conf

index 56116cd28d1988d4f3e5c9134135ae126278323f..fb117ecfc21b0a21926b01856555ebb811983925 100644 (file)
@@ -266,8 +266,12 @@ DEFUN (ip_ospf_bfd_prof,
        struct ospf_if_params *params;
        int idx_prof = 4;
 
-       ospf_interface_enable_bfd(ifp);
        params = IF_DEF_PARAMS(ifp);
+       if (!params->bfd_config) {
+               vty_out(vty, "ip ospf bfd has not been set\n");
+               return CMD_WARNING;
+       }
+
        strlcpy(params->bfd_config->profile, argv[idx_prof]->arg,
                sizeof(params->bfd_config->profile));
        ospf_interface_bfd_apply(ifp);
@@ -288,8 +292,10 @@ DEFUN (no_ip_ospf_bfd_prof,
        VTY_DECLVAR_CONTEXT(interface, ifp);
        struct ospf_if_params *params;
 
-       ospf_interface_enable_bfd(ifp);
        params = IF_DEF_PARAMS(ifp);
+       if (!params->bfd_config)
+               return CMD_SUCCESS;
+
        params->bfd_config->profile[0] = 0;
        ospf_interface_bfd_apply(ifp);
 
index fcea5d48fcc697a05601ffd50047e0e8b657d717..373a0c5b94f3dd65bb74273abd63fdd809115375 100644 (file)
@@ -2,6 +2,7 @@ interface r1-eth1
  ip ospf area 0
  ip ospf hello-interval 2
  ip ospf dead-interval 10
+ ip ospf bfd
  ip ospf bfd profile slowtx
 !
 router ospf