]> git.proxmox.com Git - mirror_frr.git/blobdiff - pimd/pim_zlookup.c
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / pimd / pim_zlookup.c
index baa07a8ec686263b88ee3efa6c17737bb7451405..6b45313081d9fa75d111bbeba764a16c423d2b25 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include <zebra.h>
-#include "zebra/rib.h"
 
 #include "log.h"
 #include "prefix.h"
@@ -121,10 +120,10 @@ void zclient_lookup_free(void)
 
 void zclient_lookup_new(void)
 {
-       zlookup = zclient_new_notify(master, &zclient_options_default);
+       zlookup = zclient_new(master, &zclient_options_default);
        if (!zlookup) {
-               flog_err(LIB_ERR_ZAPI_SOCKET, "%s: zclient_new() failure",
-                         __PRETTY_FUNCTION__);
+               flog_err(EC_LIB_ZAPI_SOCKET, "%s: zclient_new() failure",
+                        __PRETTY_FUNCTION__);
                return;
        }
 
@@ -170,9 +169,9 @@ static int zclient_read_nexthop(struct pim_instance *pim,
                err = zclient_read_header(s, zlookup->sock, &length, &marker,
                                          &version, &vrf_id, &command);
                if (err < 0) {
-                       flog_err(LIB_ERR_ZAPI_MISSMATCH,
-                                 "%s: zclient_read_header() failed",
-                                 __PRETTY_FUNCTION__);
+                       flog_err(EC_LIB_ZAPI_MISSMATCH,
+                                "%s: zclient_read_header() failed",
+                                __PRETTY_FUNCTION__);
                        zclient_lookup_failed(zlookup);
                        return -1;
                }
@@ -203,10 +202,12 @@ static int zclient_read_nexthop(struct pim_instance *pim,
        }
 
        for (i = 0; i < nexthop_num; ++i) {
+               vrf_id_t nexthop_vrf_id;
                enum nexthop_types_t nexthop_type;
                struct pim_neighbor *nbr;
                struct prefix p;
 
+               nexthop_vrf_id = stream_getl(s);
                nexthop_type = stream_getc(s);
                if (num_ifindex >= tab_size) {
                        char addr_str[INET_ADDRSTRLEN];
@@ -220,6 +221,7 @@ static int zclient_read_nexthop(struct pim_instance *pim,
                }
                nexthop_tab[num_ifindex].protocol_distance = distance;
                nexthop_tab[num_ifindex].route_metric = metric;
+               nexthop_tab[num_ifindex].vrf_id = nexthop_vrf_id;
                switch (nexthop_type) {
                case NEXTHOP_TYPE_IFINDEX:
                        nexthop_tab[num_ifindex].ifindex = stream_getl(s);
@@ -266,12 +268,12 @@ static int zclient_read_nexthop(struct pim_instance *pim,
                                        if_lookup_by_index(
                                                nexthop_tab[num_ifindex]
                                                        .ifindex,
-                                               vrf_id),
+                                               nexthop_vrf_id),
                                        &p);
                        else
                                nbr = pim_neighbor_find_if(if_lookup_by_index(
                                        nexthop_tab[num_ifindex].ifindex,
-                                       vrf_id));
+                                       nexthop_vrf_id));
                        if (nbr) {
                                nexthop_tab[num_ifindex].nexthop_addr.family =
                                        AF_INET;
@@ -315,9 +317,9 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim,
 
        /* Check socket. */
        if (zlookup->sock < 0) {
-               flog_err(LIB_ERR_ZAPI_SOCKET,
-                         "%s: zclient lookup socket is not connected",
-                         __PRETTY_FUNCTION__);
+               flog_err(EC_LIB_ZAPI_SOCKET,
+                        "%s: zclient lookup socket is not connected",
+                        __PRETTY_FUNCTION__);
                zclient_lookup_failed(zlookup);
                return -1;
        }
@@ -338,14 +340,14 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim,
        ret = writen(zlookup->sock, s->data, stream_get_endp(s));
        if (ret < 0) {
                flog_err(
-                       LIB_ERR_SOCKET,
+                       EC_LIB_SOCKET,
                        "%s: writen() failure: %d writing to zclient lookup socket",
                        __PRETTY_FUNCTION__, errno);
                zclient_lookup_failed(zlookup);
                return -2;
        }
        if (ret == 0) {
-               flog_err_sys(LIB_ERR_SOCKET,
+               flog_err_sys(EC_LIB_SOCKET,
                             "%s: connection closed on zclient lookup socket",
                             __PRETTY_FUNCTION__);
                zclient_lookup_failed(zlookup);
@@ -516,7 +518,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil)
        ret = writen(zlookup->sock, s->data, count);
        if (ret <= 0) {
                flog_err(
-                       LIB_ERR_SOCKET,
+                       EC_LIB_SOCKET,
                        "%s: writen() failure: %d writing to zclient lookup socket",
                        __PRETTY_FUNCTION__, errno);
                return -1;
@@ -535,9 +537,9 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil)
                err = zclient_read_header(s, zlookup->sock, &length, &marker,
                                          &version, &vrf_id, &command);
                if (err < 0) {
-                       flog_err(LIB_ERR_ZAPI_MISSMATCH,
-                                 "%s: zclient_read_header() failed",
-                                 __PRETTY_FUNCTION__);
+                       flog_err(EC_LIB_ZAPI_MISSMATCH,
+                                "%s: zclient_read_header() failed",
+                                __PRETTY_FUNCTION__);
                        zclient_lookup_failed(zlookup);
                        return -1;
                }
@@ -553,7 +555,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil)
                        more.src = c_oil->oil.mfcc_origin;
                        more.grp = c_oil->oil.mfcc_mcastgrp;
                        flog_err(
-                               LIB_ERR_ZAPI_MISSMATCH,
+                               EC_LIB_ZAPI_MISSMATCH,
                                "%s: Received wrong %s(%s) information requested",
                                __PRETTY_FUNCTION__, pim_str_sg_dump(&more),
                                c_oil->pim->vrf->name);