version 1.1.1.1, 2012/02/21 17:26:12
|
version 1.1.1.2, 2016/11/02 10:09:12
|
Line 45
|
Line 45
|
|
|
/* Fill in the the 'key' as appropriate to retrieve the entry for nbr |
/* Fill in the the 'key' as appropriate to retrieve the entry for nbr |
* from the ospf_interface's nbrs table. Indexed by interface address |
* from the ospf_interface's nbrs table. Indexed by interface address |
* for all cases except Virtual-link interfaces, where neighbours are | * for all cases except Virtual-link and PointToPoint interfaces, where |
* indexed by router-ID instead. | * neighbours are indexed by router-ID instead. |
*/ |
*/ |
static void |
static void |
ospf_nbr_key (struct ospf_interface *oi, struct ospf_neighbor *nbr, |
ospf_nbr_key (struct ospf_interface *oi, struct ospf_neighbor *nbr, |
Line 56 ospf_nbr_key (struct ospf_interface *oi, struct ospf_n
|
Line 56 ospf_nbr_key (struct ospf_interface *oi, struct ospf_n
|
key->prefixlen = IPV4_MAX_BITLEN; |
key->prefixlen = IPV4_MAX_BITLEN; |
|
|
/* vlinks are indexed by router-id */ |
/* 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; |
key->u.prefix4 = nbr->router_id; |
else |
else |
key->u.prefix4 = nbr->src; |
key->u.prefix4 = nbr->src; |
Line 202 ospf_nbr_bidirectional (struct in_addr *router_id,
|
Line 203 ospf_nbr_bidirectional (struct in_addr *router_id,
|
return 0; |
return 0; |
} |
} |
|
|
|
/* reset nbr_self */ |
|
void |
|
ospf_nbr_self_reset (struct ospf_interface *oi) |
|
{ |
|
ospf_nbr_delete (oi->nbr_self); |
|
oi->nbr_self = ospf_nbr_new (oi); |
|
ospf_nbr_add_self (oi); |
|
} |
|
|
/* Add self to nbr list. */ |
/* Add self to nbr list. */ |
void |
void |
ospf_nbr_add_self (struct ospf_interface *oi) |
ospf_nbr_add_self (struct ospf_interface *oi) |
Line 262 ospf_nbr_count (struct ospf_interface *oi, int state)
|
Line 272 ospf_nbr_count (struct ospf_interface *oi, int state)
|
return count; |
return count; |
} |
} |
|
|
#ifdef HAVE_OPAQUE_LSA |
|
int |
int |
ospf_nbr_count_opaque_capable (struct ospf_interface *oi) |
ospf_nbr_count_opaque_capable (struct ospf_interface *oi) |
{ |
{ |
Line 279 ospf_nbr_count_opaque_capable (struct ospf_interface *
|
Line 288 ospf_nbr_count_opaque_capable (struct ospf_interface *
|
|
|
return count; |
return count; |
} |
} |
#endif /* HAVE_OPAQUE_LSA */ |
|
|
|
/* lookup nbr by address - use this only if you know you must |
/* lookup nbr by address - use this only if you know you must |
* otherwise use the ospf_nbr_lookup() wrapper, which deals | * otherwise use the ospf_nbr_lookup() wrapper, which deals |
* with virtual link neighbours | * with virtual link and PointToPoint neighbours |
*/ |
*/ |
struct ospf_neighbor * |
struct ospf_neighbor * |
ospf_nbr_lookup_by_addr (struct route_table *nbrs, |
ospf_nbr_lookup_by_addr (struct route_table *nbrs, |
Line 375 struct ospf_neighbor *
|
Line 383 struct ospf_neighbor *
|
ospf_nbr_lookup (struct ospf_interface *oi, struct ip *iph, |
ospf_nbr_lookup (struct ospf_interface *oi, struct ip *iph, |
struct ospf_header *ospfh) |
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)); |
return (ospf_nbr_lookup_by_routerid (oi->nbrs, &ospfh->router_id)); |
else |
else |
return (ospf_nbr_lookup_by_addr (oi->nbrs, &iph->ip_src)); |
return (ospf_nbr_lookup_by_addr (oi->nbrs, &iph->ip_src)); |
Line 435 ospf_nbr_get (struct ospf_interface *oi, struct ospf_h
|
Line 444 ospf_nbr_get (struct ospf_interface *oi, struct ospf_h
|
key.family = AF_INET; |
key.family = AF_INET; |
key.prefixlen = IPV4_MAX_BITLEN; |
key.prefixlen = IPV4_MAX_BITLEN; |
|
|
if (oi->type == OSPF_IFTYPE_VIRTUALLINK) | if (oi->type == OSPF_IFTYPE_VIRTUALLINK || |
key.u.prefix4 = ospfh->router_id; /* index vlink nbrs by router-id */ | oi->type == OSPF_IFTYPE_POINTOPOINT) |
| key.u.prefix4 = ospfh->router_id;/* index vlink and ptp nbrs by router-id */ |
else |
else |
key.u.prefix4 = iph->ip_src; |
key.u.prefix4 = iph->ip_src; |
|
|