From 2db3d05da3ac6b1ff9452a5f291bfc39a719d1c6 Mon Sep 17 00:00:00 2001 From: hasso Date: Wed, 11 Feb 2004 21:52:13 +0000 Subject: Don't crash when attempting to read path->oi->ifp if oi doesn't exist any more. I'm not sure if this read should be attempted at all, but I'm trying to keep code safe AND stable. --- ospfd/ospf_interface.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ospfd/ospf_interface.c') diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index 2afe19ec..2f94b43f 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -370,6 +370,23 @@ ospf_if_is_up (struct ospf_interface *oi) return if_is_up (oi->ifp); } +struct ospf_interface * +ospf_if_exists (struct ospf_interface *oic) +{ + listnode node; + struct ospf *ospf; + struct ospf_interface *oi; + + ospf = ospf_lookup (); + + for (node = listhead (ospf->oiflist); node; nextnode (node)) + { + if (((oi = getdata (node)) != NULL) && (oi == oic)) + return oi; + } + return NULL; +} + struct ospf_interface * ospf_if_lookup_by_local_addr (struct ospf *ospf, struct interface *ifp, struct in_addr address) -- cgit v1.2.1