summaryrefslogtreecommitdiff
path: root/ospfd/ospfd.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospfd.c')
-rw-r--r--ospfd/ospfd.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index dd5af5e9..f72295d1 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -795,6 +795,23 @@ ospf_network_unset (struct ospf *ospf, struct prefix_ipv4 *p,
int
ospf_network_match_iface(struct connected *co, struct prefix *net)
{
+#define COMPATIBILITY_MODE
+ /* The old code used to have a special case for PtP interfaces:
+
+ if (if_is_pointopoint (co->ifp) && co->destination &&
+ IPV4_ADDR_SAME ( &(co->destination->u.prefix4), &(net->u.prefix4)))
+ return 1;
+
+ The new approach is much more general. If a peer address is supplied,
+ then we are routing to that prefix, so that's the address to compare
+ against (not the local address, which may not be unique).
+ */
+#ifndef COMPATIBILITY_MODE
+ /* new approach: more elegant and conceptually clean */
+ return prefix_match(net, CONNECTED_PREFIX(co));
+#else /* COMPATIBILITY_MODE */
+ /* match old (strange?) behavior */
+
/* Behaviour to match both Cisco where:
* iface address lies within network specified -> ospf
* and zebra 0.9[2ish-3]:
@@ -806,7 +823,7 @@ ospf_network_match_iface(struct connected *co, struct prefix *net)
* exactly; this is not a test for falling within the prefix. This
* test is solely for compatibility with zebra.
*/
- if (if_is_pointopoint (co->ifp) && co->destination &&
+ if (CONNECTED_PEER(co) &&
IPV4_ADDR_SAME ( &(co->destination->u.prefix4), &(net->u.prefix4)))
return 1;
@@ -826,6 +843,8 @@ ospf_network_match_iface(struct connected *co, struct prefix *net)
return 1;
return 0; /* no match */
+
+#endif /* COMPATIBILITY_MODE */
}
void
@@ -856,10 +875,7 @@ ospf_network_run (struct ospf *ospf, struct prefix *p, struct ospf_area *area)
if (CHECK_FLAG(co->flags,ZEBRA_IFA_SECONDARY))
continue;
- if (CONNECTED_POINTOPOINT_HOST(co))
- addr = co->destination;
- else
- addr = co->address;
+ addr = CONNECTED_ID(co);
if (p->family == co->address->family
&& ! ospf_if_is_configured (ospf, &(addr->u.prefix4))