summaryrefslogtreecommitdiff
path: root/ospfd/ospfd.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospfd.c')
-rw-r--r--ospfd/ospfd.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 50cb49b7..89ef21b1 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -713,12 +713,32 @@ ospf_network_match_iface(struct connected *co, struct prefix *net)
* and zebra 0.9[2ish-3]:
* PtP special case: network specified == iface peer addr -> ospf
*/
- return (
- ((if_is_pointopoint (co->ifp) &&
- IPV4_ADDR_SAME ( &(co->destination->u.prefix4), &(net->u.prefix4)))
- || prefix_match (net, co->address))
- ? 1 : 0
- );
+
+ /* For PtP, match if peer address matches network address exactly.
+ * This can be addr/32 or addr/p for p < 32, but the addr must match
+ * 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) &&
+ IPV4_ADDR_SAME ( &(co->destination->u.prefix4), &(net->u.prefix4)))
+ return 1;
+
+#if 0
+ /* Decline to accept PtP if dst address does not match the
+ * prefix. (ifdefed out because this is a workaround, not the
+ * desired behavior.) */
+ if (if_is_pointopoint (co->ifp) &&
+ ! prefix_match (net, co->destination))
+ return 0;
+#endif
+
+ /* If the address is within the prefix, accept. Note that this
+ * applies to PtP as well as other types.
+ */
+ if (prefix_match (net, co->address))
+ return 1;
+
+ return 0; /* no match */
}
void