]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_zebra.c
lib, bgpd: implement pthread lifecycle management
[mirror_frr.git] / bgpd / bgp_zebra.c
index 0d1d768294ff572f152a52628b4453cccb2f5738..1cf04abfce69a32c7a9682133cdaaf5784aa9548 100644 (file)
@@ -524,9 +524,10 @@ static int bgp_interface_vrf_update(int command, struct zclient *zclient,
 static int zebra_read_route(int command, struct zclient *zclient,
                            zebra_size_t length, vrf_id_t vrf_id)
 {
+       enum nexthop_types_t nhtype;
        struct zapi_route api;
        union g_addr nexthop;
-       unsigned int ifindex;
+       ifindex_t ifindex;
        int add, i;
        struct bgp *bgp;
 
@@ -548,6 +549,7 @@ static int zebra_read_route(int command, struct zclient *zclient,
 
        nexthop = api.nexthops[0].gate;
        ifindex = api.nexthops[0].ifindex;
+       nhtype = api.nexthops[0].type;
 
        add = (command == ZEBRA_REDISTRIBUTE_ROUTE_ADD);
        if (add) {
@@ -568,8 +570,8 @@ static int zebra_read_route(int command, struct zclient *zclient,
 
                /* Now perform the add/update. */
                bgp_redistribute_add(bgp, &api.prefix, &nexthop, ifindex,
-                                    api.metric, api.type, api.instance,
-                                    api.tag);
+                                    nhtype, api.metric, api.type,
+                                    api.instance, api.tag);
        } else {
                bgp_redistribute_delete(bgp, &api.prefix, api.type,
                                        api.instance);
@@ -1338,12 +1340,14 @@ int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type, u_short instance)
                vrf_bitmap_set(zclient->redist[afi][type], bgp->vrf_id);
        }
 
-       /* Don't try to register if we're not connected to Zebra or Zebra
-        * doesn't
-        * know of this instance.
+       /*
+        * Don't try to register if we're not connected to Zebra or Zebra
+        * doesn't know of this instance.
+        *
+        * When we come up later well resend if needed.
         */
        if (!bgp_install_info_to_zebra(bgp))
-               return CMD_WARNING_CONFIG_FAILED;
+               return CMD_SUCCESS;
 
        if (BGP_DEBUG(zebra, ZEBRA))
                zlog_debug("Tx redistribute add VRF %u afi %d %s %d",
@@ -1755,7 +1759,7 @@ void bgp_zebra_init(struct thread_master *master)
        zclient_num_connects = 0;
 
        /* Set default values. */
-       zclient = zclient_new(master);
+       zclient = zclient_new_notify(master, &zclient_options_default);
        zclient_init(zclient, ZEBRA_ROUTE_BGP, 0, &bgpd_privs);
        zclient->zebra_connected = bgp_zebra_connected;
        zclient->router_id_update = bgp_router_id_update;