]> git.puffer.fish Git - mirror/frr.git/commitdiff
Revert "bgpd: use common api in bgp_get"
authorIgor Ryzhov <iryzhov@nfware.com>
Thu, 13 May 2021 23:12:24 +0000 (02:12 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 3 Aug 2021 20:36:31 +0000 (23:36 +0300)
This reverts commit bdaadb91e8adc103197d8f57a6a3358ff313a23c.

bgpd/bgp_nb_config.c

index a182a3e9a7d27d8d34621eca8594e0af0cf811eb..218772dec50f8b7468362017eb20aab0cd1e0027 100644 (file)
@@ -48,6 +48,33 @@ FRR_CFG_DEFAULT_ULONG(BGP_KEEPALIVE,
         { .val_ulong = 60 },
 );
 
+
+static int bgp_lookup_by_as_name_type(struct bgp **bgp_val, as_t *as,
+                                     const char *name,
+                                     enum bgp_instance_type inst_type)
+{
+       struct bgp *bgp;
+
+       if (name)
+               bgp = bgp_lookup_by_name(name);
+       else
+               bgp = bgp_get_default();
+
+       if (bgp) {
+               if (bgp->as != *as) {
+                       *as = bgp->as;
+                       return BGP_ERR_INSTANCE_MISMATCH;
+               }
+               if (bgp->inst_type != inst_type)
+                       return BGP_ERR_INSTANCE_MISMATCH;
+               *bgp_val = bgp;
+       } else {
+               *bgp_val = NULL;
+       }
+
+       return BGP_SUCCESS;
+}
+
 int routing_control_plane_protocols_name_validate(
        struct nb_cb_create_args *args)
 {