summaryrefslogtreecommitdiff
path: root/proto/ospf/topology.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2013-06-11 12:12:11 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2013-06-11 12:12:11 +0200
commitf623ab9875cad2d129f708e95021d3a252930000 (patch)
tree03c6bae47798d39ebe85853fb573f6c0d025c5b6 /proto/ospf/topology.c
parent924868543c2010f3ef2cfcb7ba6bac5988ab3264 (diff)
Implements OSPF stub router option (RFC 3137).
Also fixes OSPFv3 routing table calculcation w.r.t. errata 2078 to RFC 5340.
Diffstat (limited to 'proto/ospf/topology.c')
-rw-r--r--proto/ospf/topology.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c
index 5f4d1d54..5d93c0e9 100644
--- a/proto/ospf/topology.c
+++ b/proto/ospf/topology.c
@@ -233,6 +233,7 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length)
WALK_LIST(ifa, po->iface_list)
{
int net_lsa = 0;
+ u32 link_cost = po->stub_router ? 0xffff : ifa->cost;
if ((ifa->type == OSPF_IT_VLINK) && (ifa->voa == oa) &&
(!EMPTY_LIST(ifa->neigh_list)))
@@ -268,8 +269,7 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length)
* this address as a next-hop.
*/
ln->data = ipa_to_u32(ifa->addr->ip);
-
- ln->metric = ifa->cost;
+ ln->metric = link_cost;
ln->padding = 0;
i++;
}
@@ -283,7 +283,7 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length)
ln->type = LSART_NET;
ln->id = ipa_to_u32(ifa->drip);
ln->data = ipa_to_u32(ifa->addr->ip);
- ln->metric = ifa->cost;
+ ln->metric = link_cost;
ln->padding = 0;
i++;
net_lsa = 1;
@@ -298,7 +298,7 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length)
ln->type = LSART_VLNK;
ln->id = neigh->rid;
ln->data = ipa_to_u32(ifa->addr->ip);
- ln->metric = ifa->cost;
+ ln->metric = link_cost;
ln->padding = 0;
i++;
}