summaryrefslogtreecommitdiff
path: root/ospfd/ospf_interface.c
diff options
context:
space:
mode:
authorhasso <hasso>2004-10-19 19:44:43 +0000
committerhasso <hasso>2004-10-19 19:44:43 +0000
commit3fb9cd6ef456959b6eff939d5c316f6785c2dda4 (patch)
treee350cb3ef7b20b8bbccfb1aa9309152311e845bd /ospfd/ospf_interface.c
parent5ae35f45f1292dce3a01f241accafeb2e59b10cc (diff)
OK. Here it is - PtP patch from Andrew J. Schorr. No problems with ospfd,
ripd might need some more testing though.
Diffstat (limited to 'ospfd/ospf_interface.c')
-rw-r--r--ospfd/ospf_interface.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 277d508b..e74c375a 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -338,27 +338,45 @@ ospf_if_free (struct ospf_interface *oi)
/*
* check if interface with given address is configured and
-* return it if yes.
+* return it if yes. special treatment for PtP networks.
*/
struct ospf_interface *
ospf_if_is_configured (struct ospf *ospf, struct in_addr *address)
{
struct listnode *node;
struct ospf_interface *oi;
- struct prefix *addr;
+ struct prefix_ipv4 addr;
+
+ addr.family = AF_INET;
+ addr.prefix = *address;
+ addr.prefixlen = IPV4_MAX_PREFIXLEN;
for (node = listhead (ospf->oiflist); node; nextnode (node))
if ((oi = getdata (node)) != NULL && oi->type != OSPF_IFTYPE_VIRTUALLINK)
{
if (oi->type == OSPF_IFTYPE_POINTOPOINT)
- addr = oi->connected->destination;
+ {
+ if (CONNECTED_DEST_HOST(oi->connected))
+ {
+ /* match only destination addr, since local addr is most likely
+ * not unique (borrowed from another interface) */
+ if (IPV4_ADDR_SAME (address,
+ &oi->connected->destination->u.prefix4))
+ return oi;
+ }
+ else
+ {
+ /* special leniency: match if addr is anywhere on PtP subnet */
+ if (prefix_match(oi->address,(struct prefix *)&addr))
+ return oi;
+ }
+ }
else
- addr = oi->address;
-
- if (IPV4_ADDR_SAME (address, &addr->u.prefix4))
- return oi;
+ {
+ if (IPV4_ADDR_SAME (address, &oi->address->u.prefix4))
+ return oi;
+ }
}
-
return NULL;
}
@@ -417,7 +435,8 @@ ospf_if_lookup_by_prefix (struct ospf *ospf, struct prefix_ipv4 *p)
{
if ((oi = getdata (node)) != NULL && oi->type != OSPF_IFTYPE_VIRTUALLINK)
{
- if (oi->type == OSPF_IFTYPE_POINTOPOINT)
+ if ((oi->type == OSPF_IFTYPE_POINTOPOINT) &&
+ CONNECTED_DEST_HOST(oi->connected))
{
prefix_copy (&ptmp, oi->connected->destination);
ptmp.prefixlen = IPV4_MAX_BITLEN;
@@ -454,7 +473,8 @@ ospf_if_lookup_recv_if (struct ospf *ospf, struct in_addr src)
if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
continue;
- if (oi->type == OSPF_IFTYPE_POINTOPOINT)
+ if ((oi->type == OSPF_IFTYPE_POINTOPOINT) &&
+ CONNECTED_DEST_HOST(oi->connected))
{
if (IPV4_ADDR_SAME (&oi->connected->destination->u.prefix4, &src))
return oi;