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_route.c b/ospfd/ospf_route.c
index 0829e8e..267237b 100644
--- a/ospfd/ospf_route.c
+++ b/ospfd/ospf_route.c
@@ -165,7 +165,7 @@
if (! IPV4_ADDR_SAME (&op->nexthop, &newop->nexthop))
return 0;
- if (op->oi->ifp->ifindex != newop->oi->ifp->ifindex)
+ if (op->ifindex != newop->ifindex)
return 0;
}
return 1;
@@ -640,7 +640,7 @@
path = ospf_path_new ();
path->nexthop.s_addr = 0;
- path->oi = oi;
+ path->ifindex = oi->ifp->ifindex;
listnode_add (or->paths, path);
}
else
@@ -788,7 +788,8 @@
struct ospf_path *path;
for (ALL_LIST_ELEMENTS (plist, node, nnode, path))
- if (IPV4_ADDR_SAME (&path->nexthop, &nexthop) && path->oi == oi)
+ if (IPV4_ADDR_SAME (&path->nexthop, &nexthop) &&
+ path->ifindex == oi->ifp->ifindex)
return 1;
return 0;
@@ -815,7 +816,7 @@
{
path = ospf_path_new ();
path->nexthop = nexthop->router;
- path->oi = nexthop->oi;
+ path->ifindex = nexthop->oi->ifp->ifindex;
listnode_add (to->paths, path);
}
}
@@ -834,7 +835,7 @@
continue;
if (!IPV4_ADDR_SAME (&op->adv_router, &path->adv_router))
continue;
- if (op->oi->ifp->ifindex != path->oi->ifp->ifindex)
+ if (op->ifindex != path->ifindex)
continue;
return op;
}