[PATCH 9/9] Route notify, sync and some Area Border Router processing use SADR.
Dean Luga
dluga93 at gmail.com
Tue Mar 7 00:56:33 CET 2017
From: dean <dluga93 at gmail.com>
This last patch updates the function in OSPF that handles routing
table update notifications to use source information. Similar changes
are applied to the function that synchronizes OSPF routing tables with
nest's routing tables.
Finally, some work of area border routers (like deciding whether to
flush or originate summary LSAs) is also changed to support SADR
entries if SADR is enabled.
---
proto/ospf/rt.c | 30 ++++++++++++++++++++----------
proto/ospf/topology.c | 6 ++++--
2 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c
index ac21f6e..39de770 100644
--- a/proto/ospf/rt.c
+++ b/proto/ospf/rt.c
@@ -1054,8 +1054,9 @@ decide_sum_lsa(struct ospf_area *oa, ort *nf, int dest)
if ((nf->n.oa == oa->po->backbone) && oa->trcap)
return 1;
+ addr_data addr = addr_data_fn_init(&nf->fn);
struct area_net *anet = (struct area_net *)
- fib_route(&nf->n.oa->net_fib, nf->fn.prefix, nf->fn.pxlen);
+ fib_route2(&nf->n.oa->net_fib, addr);
/* Condensed area network found */
if (anet)
@@ -1080,7 +1081,8 @@ check_sum_net_lsa(struct ospf_proto *p, ort *nf)
/* Find that area network */
WALK_LIST(anet_oa, p->area_list)
{
- anet = (struct area_net *) fib_find(&anet_oa->net_fib, &nf->fn.prefix, nf->fn.pxlen);
+ addr_data addr = addr_data_fn_init(&nf->fn);
+ anet = (struct area_net *) fib_find2(&anet_oa->net_fib, addr);
if (anet)
break;
}
@@ -1115,7 +1117,8 @@ decide_nssa_lsa(struct ospf_proto *p, ort *nf, struct ospf_lsa_ext_local *rt)
return 0;
/* Condensed area network found */
- if (fib_route(&oa->enet_fib, nf->fn.prefix, nf->fn.pxlen))
+ addr_data addr = addr_data_fn_init(&nf->fn);
+ if (fib_route2(&oa->enet_fib, addr))
return 0;
if (!en || (en->lsa_type != LSA_T_NSSA))
@@ -1150,7 +1153,8 @@ check_nssa_lsa(struct ospf_proto *p, ort *nf)
/* Find that area network */
WALK_LIST(oa, p->area_list)
{
- anet = (struct area_net *) fib_find(&oa->enet_fib, &nf->fn.prefix, nf->fn.pxlen);
+ addr_data addr = addr_data_fn_init(&nf->fn);
+ anet = (struct area_net *) fib_find2(&oa->enet_fib, addr);
if (anet)
break;
}
@@ -1246,7 +1250,8 @@ ospf_rt_abr1(struct ospf_proto *p)
/* Compute condensed area networks */
if (nf->n.type == RTS_OSPF)
{
- anet = (struct area_net *) fib_route(&nf->n.oa->net_fib, nf->fn.prefix, nf->fn.pxlen);
+ addr_data addr = addr_data_fn_init(&nf->fn);
+ anet = (struct area_net *) fib_route2(&nf->n.oa->net_fib, addr);
if (anet)
{
if (!anet->active)
@@ -1254,7 +1259,8 @@ ospf_rt_abr1(struct ospf_proto *p)
anet->active = 1;
/* Get a RT entry and mark it to know that it is an area network */
- ort *nfi = (ort *) fib_get(&p->rtf, &anet->fn.prefix, anet->fn.pxlen);
+ addr_data addr2 = addr_data_fn_init(&anet->fn);
+ ort *nfi = (ort *) fib_get2(&p->rtf, addr2);
nfi->area_net = 1;
/* 16.2. (3) */
@@ -1402,8 +1408,9 @@ ospf_rt_abr2(struct ospf_proto *p)
nf = (ort *) nftmp;
if (rt_is_nssa(nf) && (nf->n.options & ORTA_PROP))
{
+ addr_data addr = addr_data_fn_init(&nf->fn);
struct area_net *anet = (struct area_net *)
- fib_route(&nf->n.oa->enet_fib, nf->fn.prefix, nf->fn.pxlen);
+ fib_route2(&nf->n.oa->enet_fib, addr);
if (anet)
{
@@ -1412,7 +1419,8 @@ ospf_rt_abr2(struct ospf_proto *p)
anet->active = 1;
/* Get a RT entry and mark it to know that it is an area network */
- nf2 = (ort *) fib_get(&p->rtf, &anet->fn.prefix, anet->fn.pxlen);
+ addr_data addr2 = addr_data_fn_init(&anet->fn);
+ nf2 = (ort *) fib_get2(&p->rtf, addr2);
nf2->area_net = 1;
}
@@ -2019,7 +2027,8 @@ again1:
if (reload || ort_changed(nf, &a0))
{
- net *ne = net_get(p->p.table, nf->fn.prefix, nf->fn.pxlen);
+ addr_data addr = addr_data_fn_init(&nf->fn);
+ net *ne = net_get2(p->p.table, addr);
rta *a = rta_lookup(&a0);
rte *e = rte_get_temp(a);
@@ -2044,7 +2053,8 @@ again1:
rta_free(nf->old_rta);
nf->old_rta = NULL;
- net *ne = net_get(p->p.table, nf->fn.prefix, nf->fn.pxlen);
+ addr_data addr = addr_data_fn_init(&nf->fn);
+ net *ne = net_get2(p->p.table, addr);
rte_update(&p->p, ne, NULL);
}
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c
index 55910bc..4bcf3ce 100644
--- a/proto/ospf/topology.c
+++ b/proto/ospf/topology.c
@@ -1271,7 +1271,8 @@ ospf_rt_notify(struct proto *P, rtable *tbl UNUSED, net *n, rte *new, rte *old U
if (!new)
{
- nf = (ort *) fib_find(&p->rtf, &n->n.prefix, n->n.pxlen);
+ addr_data addr = addr_data_fn_init(&n->n);
+ nf = (ort *) fib_find2(&p->rtf, addr);
if (!nf || !nf->external_rte)
return;
@@ -1314,7 +1315,8 @@ ospf_rt_notify(struct proto *P, rtable *tbl UNUSED, net *n, rte *new, rte *old U
}
}
- nf = (ort *) fib_get(&p->rtf, &n->n.prefix, n->n.pxlen);
+ addr_data addr = addr_data_fn_init(&n->n);
+ nf = (ort *) fib_get2(&p->rtf, addr);
ospf_originate_ext_lsa(p, oa, nf, LSA_M_EXPORT, metric, ebit, fwd, tag, 1);
nf->external_rte = 1;
}
--
2.7.4
More information about the Bird-users
mailing list