ospfd: Change struct ospf_path *oi to ifindex.
* global: In struct ospf_path, change struct ospf_interface *oi to int
ifindex. It is unsafe to reference *oi as an ospf interface can be
deleted under your feet. Use a weak reference instead.
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c
index 88636f1..7e32195 100644
--- a/ospfd/ospf_abr.c
+++ b/ospfd/ospf_abr.c
@@ -814,15 +814,12 @@
{
struct listnode *node, *nnode;
struct ospf_path *path;
+ struct ospf_interface *oi;
- for (ALL_LIST_ELEMENTS (or->paths, node, nnode, path))
- {
- struct ospf_interface *oi = path->oi;
-
- if (oi != NULL)
- if (oi->area == area)
- return 1;
- }
+ for (ALL_LIST_ELEMENTS_RO (or->paths, node, path))
+ for (ALL_LIST_ELEMENTS_RO (area->oiflist, nnode, oi))
+ if (oi->ifp && oi->ifp->ifindex == path->ifindex)
+ return 1;
return 0;
}