Ondrej Zajicek <santiago@crfreenet.org> wrote on 2010/12/21 00:27:44:
On Fri, Dec 17, 2010 at 02:02:07PM +0100, Joakim Tjernlund wrote:
Something like this. It is not tested at all and and very simple.
Here is version 2, even simpler :)
That is nice, makes several things simpler. I will merge that, with some minor modifications.
Found a bug, here is a fix: --- proto/ospf/topology.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index 32fcc5e..94847f8 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -228,7 +228,7 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length) WALK_LIST(ifa, po->iface_list) { - int net_lsa = 0; + int net_lsa = 0, rt_pos = ~0; if ((ifa->type == OSPF_IT_VLINK) && (ifa->voa == oa) && (!EMPTY_LIST(ifa->neigh_list))) @@ -254,6 +254,7 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length) ifa->iface->index : ipa_to_u32(ifa->addr->ip); ln->metric = ifa->cost; ln->padding = 0; + rt_pos = i; i++; } break; @@ -268,6 +269,7 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length) ln->data = ipa_to_u32(ifa->addr->ip); ln->metric = ifa->cost; ln->padding = 0; + rt_pos = i; i++; net_lsa = 1; } @@ -283,6 +285,7 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length) ln->data = ipa_to_u32(ifa->addr->ip); ln->metric = ifa->cost; ln->padding = 0; + rt_pos = i; i++; } break; @@ -291,7 +294,7 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 *length) log("Unknown interface type %s", ifa->iface->name); break; } - ospf_lsa_pos_set(i, ifa); + ospf_lsa_pos_set(rt_pos, ifa); /* Now we will originate stub area if there is no primary */ if (net_lsa || (ifa->type == OSPF_IT_VLINK) || -- 1.7.2.5