summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2009-11-29 11:08:37 +0000
committerDavid Lamparter <equinox@diac24.net>2010-02-03 23:30:19 +0100
commit84cc670c3764d1032730ffa5abe444264f39de33 (patch)
tree35a1852aa4e6adc5655fd709b98922f0f6053c75
parentd1ccf9fd4d0f4e9901742be90cdccdfe0889c28f (diff)
downloadquagga-84cc670c3764d1032730ffa5abe444264f39de33.tar.bz2
quagga-84cc670c3764d1032730ffa5abe444264f39de33.tar.xz
ospfd: fix ospf_nbr_lookup_by_addr()
ospf_nbr_lookup_by_addr() included routerID while searching. That is not the intention of this function so change it to only search for IP addresses.
-rw-r--r--ospfd/ospf_neighbor.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/ospfd/ospf_neighbor.c b/ospfd/ospf_neighbor.c
index 967ca15d..81b3fdcd 100644
--- a/ospfd/ospf_neighbor.c
+++ b/ospfd/ospf_neighbor.c
@@ -289,31 +289,18 @@ struct ospf_neighbor *
ospf_nbr_lookup_by_addr (struct route_table *nbrs,
struct in_addr *addr)
{
- struct prefix p;
struct route_node *rn;
struct ospf_neighbor *nbr;
- p.family = AF_INET;
- p.prefixlen = IPV4_MAX_BITLEN;
- p.u.prefix4 = *addr;
-
- rn = route_node_lookup (nbrs, &p);
- if (! rn)
- return NULL;
-
- /* See comment in ospf_nbr_delete */
- assert (rn->info);
-
- if (rn->info == NULL)
- {
- route_unlock_node (rn);
- return NULL;
- }
-
- nbr = (struct ospf_neighbor *) rn->info;
- route_unlock_node (rn);
+ for (rn = route_top (nbrs); rn; rn = route_next (rn))
+ if ((nbr = rn->info) != NULL)
+ if (IPV4_ADDR_SAME (&nbr->src, addr))
+ {
+ route_unlock_node(rn);
+ return nbr;
+ }
- return nbr;
+ return NULL;
}
struct ospf_neighbor *