summaryrefslogtreecommitdiff
path: root/proto/ospf/topology.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2020-05-26 18:21:43 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2020-05-26 18:21:43 +0200
commitc1632ad0f39f7221d649a9e469cacc38105528e2 (patch)
tree02567e33e3d6c06954ef35cd65aceb19e18b2c3a /proto/ospf/topology.c
parent1ca7665fa4a9858a6d4c591ccff5b61e5e6aed13 (diff)
OSPF: Fix handling of unnumbered PtPs
This issue has a long history. In 2012, we changed data field for unnumbered PtP links from iface id (specified by RFC) to IP address based on reports of bugs in Quagga that required it, and we used out-of-band information to distinquish unnumberred PtPs with the same local IP address. Then with OSPF graceful restart implementation, we found that we can no longer use out-of-band information, and we need to use only LSAdb info for routing table calculation, but i forgot to finish handling of this case, so multiple unnumbered PtPs with the same local IP addresses were broken. Considering that even recent Mikrotik RouterOS has broken next hop calculation that depends on IP address in PtP link data field, we cannot just switch back to the iface id for unnumbered PtP links. The patch makes two changes: First, it goes back to use out-of-band (position) info for distinguishing local interfaces in SPF when graceful restart is not enabled, while still uses LSAdb-only approach for SPF calculation when graceful restart is enabled. Second, it adds OSPF interface option 'ptp address', which controls whether IP address or iface id is used in data field. It is enabled by default except for unnumbered PtP links with enabled graceful restart. Thanks to Kenth Eriksson for the bugreport and Joakim Tjernlund for suggestions.
Diffstat (limited to 'proto/ospf/topology.c')
-rw-r--r--proto/ospf/topology.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c
index c8ec730a..f59db49d 100644
--- a/proto/ospf/topology.c
+++ b/proto/ospf/topology.c
@@ -797,14 +797,11 @@ prepare_rt2_lsa_body(struct ospf_proto *p, struct ospf_area *oa)
if (neigh->state == NEIGHBOR_FULL)
{
/*
- * ln->data should be ifa->iface_id in case of no/ptp
- * address (ifa->addr->flags & IA_PEER) on PTP link (see
- * RFC 2328 12.4.1.1.), but the iface ID value has no use,
- * while using IP address even in this case is here for
- * compatibility with some broken implementations that use
- * this address as a next-hop.
+ * ln->data field should be ifa->iface_id for unnumbered PtP links,
+ * IP address otherwise (see RFC 2328 12.4.1.1). This is controlled
+ * by ifa->ptp_address field.
*/
- add_rt2_lsa_link(p, LSART_PTP, neigh->rid, ipa_to_u32(ifa->addr->ip), link_cost);
+ add_rt2_lsa_link(p, LSART_PTP, neigh->rid, ospf_iface_get_data(ifa), link_cost);
i++;
}
break;