mirror of
https://git.proxmox.com/git/mirror_frr
synced 2026-01-04 13:42:56 +00:00
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)
This commit is contained in:
parent
6a697154ff
commit
0ab4a2d61d
@ -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;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user