]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/zclient.c
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / lib / zclient.c
index 8b1069b827fe5f4ea5267d0009d9297882408234..d2a6c75548f41698834c1ec3efacc1f6eff85e9a 100644 (file)
@@ -58,8 +58,8 @@ int zclient_debug = 0;
 struct zclient_options zclient_options_default = {.receive_notify = false};
 
 /* Allocate zclient structure. */
-struct zclient *zclient_new_notify(struct thread_master *master,
-                                  struct zclient_options *opt)
+struct zclient *zclient_new(struct thread_master *master,
+                           struct zclient_options *opt)
 {
        struct zclient *zclient;
        zclient = XCALLOC(MTYPE_ZCLIENT, sizeof(struct zclient));
@@ -199,7 +199,7 @@ void zclient_reset(struct zclient *zclient)
  * @param zclient a pointer to zclient structure
  * @return socket fd just to make sure that connection established
  * @see zclient_init
- * @see zclient_new_notify
+ * @see zclient_new
  */
 int zclient_socket_connect(struct zclient *zclient)
 {
@@ -1217,6 +1217,7 @@ bool zapi_nexthop_update_decode(struct stream *s, struct zapi_route *nhr)
        STREAM_GETC(s, nhr->nexthop_num);
 
        for (i = 0; i < nhr->nexthop_num; i++) {
+               STREAM_GETL(s, nhr->nexthops[i].vrf_id);
                STREAM_GETC(s, nhr->nexthops[i].type);
                switch (nhr->nexthops[i].type) {
                case NEXTHOP_TYPE_IPV4:
@@ -1369,7 +1370,7 @@ static void zclient_vrf_add(struct zclient *zclient, vrf_id_t vrf_id)
        memcpy(vrf->data.l.netns_name, data.l.netns_name, NS_NAMSIZ);
        /* overwrite default vrf */
        if (vrf_id == VRF_DEFAULT)
-               vrf_set_default_name(vrfname_tmp);
+               vrf_set_default_name(vrfname_tmp, false);
        vrf_enable(vrf);
 }
 
@@ -1400,7 +1401,7 @@ struct interface *zebra_interface_add_read(struct stream *s, vrf_id_t vrf_id)
        stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
 
        /* Lookup/create interface by name. */
-       ifp = if_get_by_name(ifname_tmp, vrf_id, 0);
+       ifp = if_get_by_name(ifname_tmp, vrf_id);
 
        zebra_interface_if_set_value(s, ifp);
 
@@ -1769,19 +1770,19 @@ struct interface *zebra_interface_vrf_update_read(struct stream *s,
                                                  vrf_id_t vrf_id,
                                                  vrf_id_t *new_vrf_id)
 {
-       unsigned int ifindex;
+       char ifname[INTERFACE_NAMSIZ];
        struct interface *ifp;
        vrf_id_t new_id;
 
-       /* Get interface index. */
-       ifindex = stream_getl(s);
+       /* Read interface name. */
+       stream_get(ifname, s, INTERFACE_NAMSIZ);
 
        /* Lookup interface. */
-       ifp = if_lookup_by_index(ifindex, vrf_id);
+       ifp = if_lookup_by_name(ifname, vrf_id);
        if (ifp == NULL) {
                flog_err(EC_LIB_ZAPI_ENCODE,
-                        "INTERFACE_VRF_UPDATE: Cannot find IF %u in VRF %d",
-                        ifindex, vrf_id);
+                        "INTERFACE_VRF_UPDATE: Cannot find IF %s in VRF %d",
+                        ifname, vrf_id);
                return NULL;
        }