[quagga-dev 5459] [PATCH 3/6] Add ospf_if_lookup_by_ifindex()

Joakim Tjernlund Joakim.Tjernlund at transmode.se
Tue Jun 3 18:41:38 BST 2008


Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
---
 ospfd/ospf_interface.c |   14 ++++++++++++++
 ospfd/ospf_interface.h |    2 ++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 1f8e09d..4a7bf48 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -464,6 +464,20 @@ ospf_if_lookup_recv_if (struct ospf *ospf, struct in_addr ip_dst,
 
   return NULL;
 }
+
+struct ospf_interface *
+ospf_if_lookup_by_ifindex(struct ospf *ospf, unsigned int ifindex)
+{
+  struct listnode *node;
+  struct ospf_interface *oi;
+
+  for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
+    {
+      if (oi->ifp->ifindex == ifindex)
+	return oi;
+    }
+  return NULL;
+}
 
 void
 ospf_if_stream_set (struct ospf_interface *oi)
diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h
index f40488e..244c202 100644
--- a/ospfd/ospf_interface.h
+++ b/ospfd/ospf_interface.h
@@ -252,6 +252,8 @@ extern struct ospf_interface *ospf_if_addr_local (struct in_addr);
 extern struct ospf_interface *ospf_if_lookup_recv_if (struct ospf *,
 						      struct in_addr,
 						      struct interface *);
+extern struct ospf_interface *ospf_if_lookup_by_ifindex(struct ospf *, unsigned int);
+
 extern struct ospf_interface *ospf_if_is_configured (struct ospf *,
 						     struct in_addr *);
 
-- 
1.5.5.1




More information about the Quagga-dev mailing list