summaryrefslogtreecommitdiff
path: root/proto/ospf/ospf.h
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/ospf.h
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/ospf.h')
-rw-r--r--proto/ospf/ospf.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h
index d0286f72..db55aa6a 100644
--- a/proto/ospf/ospf.h
+++ b/proto/ospf/ospf.h
@@ -191,6 +191,7 @@ struct ospf_iface_patt
u8 link_lsa_suppression;
u8 real_bcast; /* Not really used in OSPFv3 */
u8 ptp_netmask; /* bool + 2 for unspecified */
+ u8 ptp_address; /* bool + 2 for unspecified */
u8 ttl_security; /* bool + 2 for TX only */
u8 bfd;
list *passwords;
@@ -348,6 +349,7 @@ struct ospf_iface
u8 ecmp_weight; /* Weight used for ECMP */
u8 link_lsa_suppression; /* Suppression of Link-LSA origination */
u8 ptp_netmask; /* Send real netmask for P2P */
+ u8 ptp_address; /* Send IP address in data field for PtP */
u8 check_ttl; /* Check incoming packets for TTL 255 */
u8 bfd; /* Use BFD on iface */
};
@@ -1018,6 +1020,20 @@ struct nbma_node *find_nbma_node_(list *nnl, ip_addr ip);
static inline struct nbma_node * find_nbma_node(struct ospf_iface *ifa, ip_addr ip)
{ return find_nbma_node_(&ifa->nbma_list, ip); }
+static inline u32 ospf_iface_get_data(struct ospf_iface *ifa)
+{
+ /*
+ * Return expected value of the link data field in Rt-LSA for given iface.
+ * It should be ifa->iface_id for unnumbered PtP links, IP address otherwise
+ * (see RFC 2328 12.4.1.1). It is controlled by ifa->ptp_address field so it
+ * can be overriden for compatibility purposes.
+ */
+
+ return ((ifa->type == OSPF_IT_PTP) && !ifa->ptp_address) ?
+ ifa->iface_id :
+ ipa_to_u32(ifa->addr->ip);
+}
+
/* neighbor.c */
struct ospf_neighbor *ospf_neighbor_new(struct ospf_iface *ifa);
void ospf_neigh_sm(struct ospf_neighbor *n, int event);