mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 09:22:32 +00:00
lib: Don't add/del from name tree if name isnt set
If the name has not been set yet (we were only passed the ifindex in some cases like with master/slave timings) then do not add/del it from the ifname rb tree on the vrf struct. Doing so causes duplicate entries on the tree and infinte loops can happen when iterating over it. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
parent
3d231b2d7a
commit
38152a1141
4
lib/if.c
4
lib/if.c
@ -186,7 +186,9 @@ void if_update_to_new_vrf(struct interface *ifp, vrf_id_t vrf_id)
|
|||||||
/* remove interface from old master vrf list */
|
/* remove interface from old master vrf list */
|
||||||
old_vrf = vrf_lookup_by_id(ifp->vrf_id);
|
old_vrf = vrf_lookup_by_id(ifp->vrf_id);
|
||||||
if (old_vrf) {
|
if (old_vrf) {
|
||||||
|
if (ifp->name[0] != '\0')
|
||||||
IFNAME_RB_REMOVE(old_vrf, ifp);
|
IFNAME_RB_REMOVE(old_vrf, ifp);
|
||||||
|
|
||||||
if (ifp->ifindex != IFINDEX_INTERNAL)
|
if (ifp->ifindex != IFINDEX_INTERNAL)
|
||||||
IFINDEX_RB_REMOVE(old_vrf, ifp);
|
IFINDEX_RB_REMOVE(old_vrf, ifp);
|
||||||
}
|
}
|
||||||
@ -194,7 +196,9 @@ void if_update_to_new_vrf(struct interface *ifp, vrf_id_t vrf_id)
|
|||||||
ifp->vrf_id = vrf_id;
|
ifp->vrf_id = vrf_id;
|
||||||
vrf = vrf_get(ifp->vrf_id, NULL);
|
vrf = vrf_get(ifp->vrf_id, NULL);
|
||||||
|
|
||||||
|
if (ifp->name[0] != '\0')
|
||||||
IFNAME_RB_INSERT(vrf, ifp);
|
IFNAME_RB_INSERT(vrf, ifp);
|
||||||
|
|
||||||
if (ifp->ifindex != IFINDEX_INTERNAL)
|
if (ifp->ifindex != IFINDEX_INTERNAL)
|
||||||
IFINDEX_RB_INSERT(vrf, ifp);
|
IFINDEX_RB_INSERT(vrf, ifp);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user