summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ospfd/ospf_interface.c16
-rw-r--r--ospfd/ospf_interface.h3
-rw-r--r--ospfd/ospf_packet.c4
3 files changed, 15 insertions, 8 deletions
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 4eccee76..afe3acf1 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -439,11 +439,12 @@ ospf_if_lookup_by_prefix (struct ospf *ospf, struct prefix_ipv4 *p)
return NULL;
}
-/* determine receiving interface by source of packet */
+/* determine receiving interface by ifp and source address */
struct ospf_interface *
-ospf_if_lookup_recv_if (struct ospf *ospf, struct in_addr src)
+ospf_if_lookup_recv_if (struct ospf *ospf, struct in_addr src,
+ struct interface *ifp)
{
- struct listnode *node;
+ struct route_node *rn;
struct prefix_ipv4 addr;
struct ospf_interface *oi, *match;
@@ -453,11 +454,16 @@ ospf_if_lookup_recv_if (struct ospf *ospf, struct in_addr src)
match = NULL;
- for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
+ for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
{
+ oi = rn->info;
+
+ if (!oi) /* oi can be NULL for PtP aliases */
+ continue;
+
if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
continue;
-
+
if (if_is_loopback (oi->ifp))
continue;
diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h
index 0fc4ccba..ab0b7580 100644
--- a/ospfd/ospf_interface.h
+++ b/ospfd/ospf_interface.h
@@ -252,7 +252,8 @@ extern struct ospf_interface *ospf_if_table_lookup (struct interface *,
struct prefix *);
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 in_addr,
+ struct interface *);
extern struct ospf_interface *ospf_if_is_configured (struct ospf *,
struct in_addr *);
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 7ebf114e..effef390 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -2373,7 +2373,7 @@ ospf_read (struct thread *thread)
ospfh = (struct ospf_header *) STREAM_PNT (ibuf);
/* associate packet with ospf interface */
- oi = ospf_if_lookup_recv_if (ospf, iph->ip_src);
+ oi = ospf_if_lookup_recv_if (ospf, iph->ip_src, ifp);
/* If incoming interface is passive one, ignore it. */
if (oi && OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_PASSIVE)
@@ -2419,7 +2419,7 @@ ospf_read (struct thread *thread)
return 0;
}
}
-
+
/* else it must be a local ospf interface, check it was received on
* correct link
*/