]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: use the correct VRF ID when parsing INTERFACE_LINK_PARAMS messages
authorRenato Westphal <renato@opensourcerouting.org>
Fri, 18 Jan 2019 18:06:00 +0000 (16:06 -0200)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 18 Jan 2019 18:06:00 +0000 (16:06 -0200)
Bug found during code inspection.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
isisd/isis_zebra.c
lib/zclient.c
lib/zclient.h
ospfd/ospf_zebra.c

index 958f8c2281a4a90e4af4fd44ab3d46dc77055710..d03c1dde08924fed75a48e646c5626c802e34915 100644 (file)
@@ -219,11 +219,11 @@ static int isis_zebra_if_address_del(int command, struct zclient *client,
 }
 
 static int isis_zebra_link_params(int command, struct zclient *zclient,
-                                 zebra_size_t length)
+                                 zebra_size_t length, vrf_id_t vrf_id)
 {
        struct interface *ifp;
 
-       ifp = zebra_interface_link_params_read(zclient->ibuf);
+       ifp = zebra_interface_link_params_read(zclient->ibuf, vrf_id);
 
        if (ifp == NULL)
                return 0;
index 367a21f7d0a841a9c7729dcc0a50505fdfd286d3..187a4b20b06e121b5fd977f82f86e65ff4be4917 100644 (file)
@@ -1495,7 +1495,8 @@ static void link_params_set_value(struct stream *s, struct if_link_params *iflp)
        iflp->use_bw = stream_getf(s);
 }
 
-struct interface *zebra_interface_link_params_read(struct stream *s)
+struct interface *zebra_interface_link_params_read(struct stream *s,
+                                                  vrf_id_t vrf_id)
 {
        struct if_link_params *iflp;
        ifindex_t ifindex;
@@ -1504,7 +1505,7 @@ struct interface *zebra_interface_link_params_read(struct stream *s)
 
        ifindex = stream_getl(s);
 
-       struct interface *ifp = if_lookup_by_index(ifindex, VRF_DEFAULT);
+       struct interface *ifp = if_lookup_by_index(ifindex, vrf_id);
 
        if (ifp == NULL) {
                flog_err(EC_LIB_ZAPI_ENCODE,
@@ -2581,7 +2582,7 @@ static int zclient_read(struct thread *thread)
        case ZEBRA_INTERFACE_LINK_PARAMS:
                if (zclient->interface_link_params)
                        (*zclient->interface_link_params)(command, zclient,
-                                                         length);
+                                                         length, vrf_id);
                break;
        case ZEBRA_FEC_UPDATE:
                if (zclient_debug)
index 401d6c400a9e87289562f447e0866d8b7e91c7c7..95f0a990b21c53cbbf1e26c4a061a2d5c52e4a0d 100644 (file)
@@ -229,7 +229,7 @@ struct zclient {
        int (*interface_address_add)(int, struct zclient *, uint16_t, vrf_id_t);
        int (*interface_address_delete)(int, struct zclient *, uint16_t,
                                        vrf_id_t);
-       int (*interface_link_params)(int, struct zclient *, uint16_t);
+       int (*interface_link_params)(int, struct zclient *, uint16_t, vrf_id_t);
        int (*interface_bfd_dest_update)(int, struct zclient *, uint16_t,
                                         vrf_id_t);
        int (*interface_nbr_address_add)(int, struct zclient *, uint16_t,
@@ -564,7 +564,8 @@ extern struct interface *zebra_interface_vrf_update_read(struct stream *s,
 extern void zebra_interface_if_set_value(struct stream *, struct interface *);
 extern void zebra_router_id_update_read(struct stream *s, struct prefix *rid);
 
-extern struct interface *zebra_interface_link_params_read(struct stream *);
+extern struct interface *zebra_interface_link_params_read(struct stream *s,
+                                                         vrf_id_t vrf_id);
 extern size_t zebra_interface_link_params_write(struct stream *,
                                                struct interface *);
 extern int zclient_send_get_label_chunk(
index 79ddb192c17b8ba0b45686c0c887b77a399c3bab..21695ac776d2a702c0a1a26e80d9c66ab1c4c876 100644 (file)
@@ -340,11 +340,11 @@ static int ospf_interface_address_delete(int command, struct zclient *zclient,
 }
 
 static int ospf_interface_link_params(int command, struct zclient *zclient,
-                                     zebra_size_t length)
+                                     zebra_size_t length, vrf_id_t vrf_id)
 {
        struct interface *ifp;
 
-       ifp = zebra_interface_link_params_read(zclient->ibuf);
+       ifp = zebra_interface_link_params_read(zclient->ibuf, vrf_id);
 
        if (ifp == NULL)
                return 0;