summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_neighbor.c
diff options
context:
space:
mode:
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>2014-04-25 14:36:16 +0200
committerDaniel Walton <dwalton@cumulusnetworks.com>2016-05-26 17:33:33 +0200
commit0ab4a2d61df3ccb2728804df8fe6bf9f6af4cf7b (patch)
tree8a21c17419202bd624977bbc47590d01a5c0774a /ospfd/ospf_neighbor.c
parenttests: Fix warnings from test-stream.c (diff)
downloadfrr-0ab4a2d61df3ccb2728804df8fe6bf9f6af4cf7b.tar.xz
frr-0ab4a2d61df3ccb2728804df8fe6bf9f6af4cf7b.zip
ospfd: PointToPoint neighbors are identified by router ID
According to RFC 2328, section 10.5 PointToPoint neighbors should be identified by router ID instead of source IP address. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> (cherry picked from commit 5c1791f28e2e831e4e9b92c3c2f7d8ed832cb968)
Diffstat (limited to 'ospfd/ospf_neighbor.c')
-rw-r--r--ospfd/ospf_neighbor.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/ospfd/ospf_neighbor.c b/ospfd/ospf_neighbor.c
index 83f91ad53..36251655a 100644
--- a/ospfd/ospf_neighbor.c
+++ b/ospfd/ospf_neighbor.c
@@ -47,8 +47,8 @@
/* Fill in the the 'key' as appropriate to retrieve the entry for nbr
* from the ospf_interface's nbrs table. Indexed by interface address
- * for all cases except Virtual-link interfaces, where neighbours are
- * indexed by router-ID instead.
+ * for all cases except Virtual-link and PointToPoint interfaces, where
+ * neighbours are indexed by router-ID instead.
*/
static void
ospf_nbr_key (struct ospf_interface *oi, struct ospf_neighbor *nbr,
@@ -58,7 +58,8 @@ ospf_nbr_key (struct ospf_interface *oi, struct ospf_neighbor *nbr,
key->prefixlen = IPV4_MAX_BITLEN;
/* vlinks are indexed by router-id */
- if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
+ if (oi->type == OSPF_IFTYPE_VIRTUALLINK ||
+ oi->type == OSPF_IFTYPE_POINTOPOINT)
key->u.prefix4 = nbr->router_id;
else
key->u.prefix4 = nbr->src;
@@ -295,8 +296,8 @@ ospf_nbr_count_opaque_capable (struct ospf_interface *oi)
#endif /* HAVE_OPAQUE_LSA */
/* lookup nbr by address - use this only if you know you must
- * otherwise use the ospf_nbr_lookup() wrapper, which deals
- * with virtual link neighbours
+ * otherwise use the ospf_nbr_lookup() wrapper, which deals
+ * with virtual link and PointToPoint neighbours
*/
struct ospf_neighbor *
ospf_nbr_lookup_by_addr (struct route_table *nbrs,
@@ -388,7 +389,8 @@ struct ospf_neighbor *
ospf_nbr_lookup (struct ospf_interface *oi, struct ip *iph,
struct ospf_header *ospfh)
{
- if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
+ if (oi->type == OSPF_IFTYPE_VIRTUALLINK ||
+ oi->type == OSPF_IFTYPE_POINTOPOINT)
return (ospf_nbr_lookup_by_routerid (oi->nbrs, &ospfh->router_id));
else
return (ospf_nbr_lookup_by_addr (oi->nbrs, &iph->ip_src));
@@ -448,8 +450,9 @@ ospf_nbr_get (struct ospf_interface *oi, struct ospf_header *ospfh,
key.family = AF_INET;
key.prefixlen = IPV4_MAX_BITLEN;
- if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
- key.u.prefix4 = ospfh->router_id; /* index vlink nbrs by router-id */
+ if (oi->type == OSPF_IFTYPE_VIRTUALLINK ||
+ oi->type == OSPF_IFTYPE_POINTOPOINT)
+ key.u.prefix4 = ospfh->router_id;/* index vlink and ptp nbrs by router-id */
else
key.u.prefix4 = iph->ip_src;