]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d: unlink router from vrf on deletion
authorIgor Ryzhov <iryzhov@nfware.com>
Thu, 27 May 2021 10:16:40 +0000 (13:16 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Thu, 27 May 2021 11:39:28 +0000 (14:39 +0300)
Otherwise `ospf6_lookup_by_vrf_id` returns stale pointer.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
ospf6d/ospf6_top.c

index 2376409ccd907a80cc337aa03fb1016456ecfd6e..42405ca35ea48fdeb6df88185bae163d87a7f4fa 100644 (file)
@@ -413,6 +413,7 @@ void ospf6_delete(struct ospf6 *o)
 {
        struct listnode *node, *nnode;
        struct ospf6_area *oa;
+       struct vrf *vrf;
 
        QOBJ_UNREG(o);
 
@@ -442,6 +443,12 @@ void ospf6_delete(struct ospf6 *o)
        ospf6_distance_reset(o);
        route_table_finish(o->distance_table);
 
+       if (o->vrf_id != VRF_UNKNOWN) {
+               vrf = vrf_lookup_by_id(o->vrf_id);
+               if (vrf)
+                       ospf6_vrf_unlink(o, vrf);
+       }
+
        XFREE(MTYPE_OSPF6_TOP, o->name);
        XFREE(MTYPE_OSPF6_TOP, o);
 }