]> git.proxmox.com Git - mirror_frr.git/blobdiff - sharpd/sharp_zebra.c
Merge pull request #3546 from opensourcerouting/ospf-show-neighbor-fix
[mirror_frr.git] / sharpd / sharp_zebra.c
index 999255e9254e08f812ab649da3f03326b9ec2093..f752009eb8fc61312e35b08e0d13bbe44e26aabf 100644 (file)
@@ -176,7 +176,7 @@ void vrf_label_add(vrf_id_t vrf_id, afi_t afi, mpls_label_t label)
        zclient_send_vrf_label(zclient, vrf_id, afi, label, ZEBRA_LSP_SHARP);
 }
 
-void route_add(struct prefix *p, struct nexthop *nh)
+void route_add(struct prefix *p, uint8_t instance, struct nexthop *nh)
 {
        struct zapi_route api;
        struct zapi_nexthop *api_nh;
@@ -184,6 +184,7 @@ void route_add(struct prefix *p, struct nexthop *nh)
        memset(&api, 0, sizeof(api));
        api.vrf_id = VRF_DEFAULT;
        api.type = ZEBRA_ROUTE_SHARP;
+       api.instance = instance;
        api.safi = SAFI_UNICAST;
        memcpy(&api.prefix, p, sizeof(*p));
 
@@ -192,7 +193,7 @@ void route_add(struct prefix *p, struct nexthop *nh)
 
        api_nh = &api.nexthops[0];
        api_nh->vrf_id = VRF_DEFAULT;
-       api_nh->gate.ipv4 = nh->gate.ipv4;
+       api_nh->gate = nh->gate;
        api_nh->type = nh->type;
        api_nh->ifindex = nh->ifindex;
        api.nexthop_num = 1;
@@ -200,7 +201,7 @@ void route_add(struct prefix *p, struct nexthop *nh)
        zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
 }
 
-void route_delete(struct prefix *p)
+void route_delete(struct prefix *p, uint8_t instance)
 {
        struct zapi_route api;
 
@@ -208,6 +209,7 @@ void route_delete(struct prefix *p)
        api.vrf_id = VRF_DEFAULT;
        api.type = ZEBRA_ROUTE_SHARP;
        api.safi = SAFI_UNICAST;
+       api.instance = instance;
        memcpy(&api.prefix, p, sizeof(*p));
        zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
 
@@ -221,7 +223,9 @@ void sharp_zebra_nexthop_watch(struct prefix *p, bool watch)
        if (!watch)
                command = ZEBRA_NEXTHOP_UNREGISTER;
 
-       zclient_send_rnh(zclient, command, p, true, VRF_DEFAULT);
+       if (zclient_send_rnh(zclient, command, p, true, VRF_DEFAULT) < 0)
+               zlog_warn("%s: Failure to send nexthop to zebra",
+                         __PRETTY_FUNCTION__);
 }
 
 static int sharp_nexthop_update(int command, struct zclient *zclient,
@@ -279,7 +283,7 @@ void sharp_zebra_init(void)
 {
        struct zclient_options opt = {.receive_notify = true};
 
-       zclient = zclient_new_notify(master, &opt);
+       zclient = zclient_new(master, &opt);
 
        zclient_init(zclient, ZEBRA_ROUTE_SHARP, 0, &sharp_privs);
        zclient->zebra_connected = zebra_connected;