From 386752028143e78d0a617216d86f95af4024346d Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Thu, 11 Jun 2009 17:25:38 +0200 Subject: Implements an option that allows to change a set of stub networks. --- proto/ospf/topology.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'proto/ospf/topology.c') diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index 18100f7..371856f 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; -- cgit v1.2.3