diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2009-06-11 17:25:38 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2009-06-11 17:25:38 +0200 |
commit | 386752028143e78d0a617216d86f95af4024346d (patch) | |
tree | 374611e90ecc021013e4c78a88face13069f1a87 /proto/ospf/topology.c | |
parent | 3d15dcdb1cc91c694aa9319b86bb37510d7ed12b (diff) |
Implements an option that allows to change a set of stub networks.
Diffstat (limited to 'proto/ospf/topology.c')
-rw-r--r-- | proto/ospf/topology.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index 18100f7e..371856f9 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -52,6 +52,25 @@ lsab_flush(struct proto_ospf *po) return r; } +static int +configured_stubnet(struct ospf_area *oa, struct ifa *a) +{ + struct ospf_stubnet_config *sn; + WALK_LIST(sn, oa->ac->stubnet_list) + { + if (sn->summary) + { + if (ipa_in_net(a->prefix, sn->px.addr, sn->px.len) && (a->pxlen >= sn->px.len)) + return 1; + } + else + { + if (ipa_equal(a->prefix, sn->px.addr) && (a->pxlen == sn->px.len)) + return 1; + } + } + return 0; +} static void * originate_rt_lsa_body(struct ospf_area *oa, u16 * length) @@ -163,9 +182,11 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 * length) { if (((a == ifa->iface->addr) && master) || (a->flags & IA_SECONDARY) || - (a->flags & IA_UNNUMBERED)) + (a->flags & IA_UNNUMBERED) || + configured_stubnet(oa, a)) continue; + ln = lsab_alloc(po, sizeof(struct ospf_lsa_rt_link)); ln->type = LSART_STUB; ln->id = ipa_to_u32(a->prefix); @@ -176,6 +197,19 @@ originate_rt_lsa_body(struct ospf_area *oa, u16 * length) } } + struct ospf_stubnet_config *sn; + WALK_LIST(sn, oa->ac->stubnet_list) + if (!sn->hidden) + { + ln = lsab_alloc(po, sizeof(struct ospf_lsa_rt_link)); + ln->type = LSART_STUB; + ln->id = ipa_to_u32(sn->px.addr); + ln->data = ipa_to_u32(ipa_mkmask(sn->px.len)); + ln->metric = sn->cost; + ln->notos = 0; + i++; + } + rt = po->lsab; rt->links = i; rt->veb.bit.v = bitv; |