mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-12 11:18:59 +00:00
ospfd: Cleanup some awful deep indentation in ospf_zebra.c
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
8ad44ef497
commit
6ec9c6a899
@ -1262,7 +1262,6 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (ospf->router_id.s_addr != INADDR_ANY) {
|
if (ospf->router_id.s_addr != INADDR_ANY) {
|
||||||
if (ei) {
|
|
||||||
if (is_prefix_default(&p))
|
if (is_prefix_default(&p))
|
||||||
ospf_external_lsa_refresh_default(ospf);
|
ospf_external_lsa_refresh_default(ospf);
|
||||||
else {
|
else {
|
||||||
@ -1271,28 +1270,25 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
|
|||||||
struct ospf_lsa *lsa = NULL;
|
struct ospf_lsa *lsa = NULL;
|
||||||
struct in_addr mask;
|
struct in_addr mask;
|
||||||
|
|
||||||
aggr = ospf_external_aggr_match(ospf,
|
aggr = ospf_external_aggr_match(ospf, &ei->p);
|
||||||
&ei->p);
|
|
||||||
|
|
||||||
if (aggr) {
|
if (aggr) {
|
||||||
/* Check the AS-external-LSA
|
/* Check the AS-external-LSA
|
||||||
* should be originated.
|
* should be originated.
|
||||||
*/
|
*/
|
||||||
if (!ospf_redistribute_check(
|
if (!ospf_redistribute_check(ospf, ei,
|
||||||
ospf, ei, NULL))
|
NULL))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (IS_DEBUG_OSPF(
|
if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR))
|
||||||
lsa,
|
|
||||||
EXTNL_LSA_AGGR))
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: Send Aggreate LSA (%pI4/%d)",
|
"%s: Send Aggreate LSA (%pI4/%d)",
|
||||||
__func__,
|
__func__,
|
||||||
&aggr->p.prefix,
|
&aggr->p.prefix,
|
||||||
aggr->p.prefixlen);
|
aggr->p.prefixlen);
|
||||||
|
|
||||||
ospf_originate_summary_lsa(
|
ospf_originate_summary_lsa(ospf, aggr,
|
||||||
ospf, aggr, ei);
|
ei);
|
||||||
|
|
||||||
/* Handling the case where the
|
/* Handling the case where the
|
||||||
* external route prefix
|
* external route prefix
|
||||||
@ -1302,21 +1298,17 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
|
|||||||
* external LSA.
|
* external LSA.
|
||||||
*/
|
*/
|
||||||
if (prefix_same(
|
if (prefix_same(
|
||||||
(struct prefix
|
(struct prefix *)&aggr->p,
|
||||||
*)&aggr->p,
|
(struct prefix *)&ei->p))
|
||||||
(struct prefix *)&ei
|
|
||||||
->p))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
lsa = ospf_external_info_find_lsa(
|
lsa = ospf_external_info_find_lsa(
|
||||||
ospf, &ei->p);
|
ospf, &ei->p);
|
||||||
|
|
||||||
if (lsa) {
|
if (lsa) {
|
||||||
al = (struct
|
al = (struct as_external_lsa *)
|
||||||
as_external_lsa *)
|
|
||||||
lsa->data;
|
lsa->data;
|
||||||
masklen2ip(
|
masklen2ip(ei->p.prefixlen,
|
||||||
ei->p.prefixlen,
|
|
||||||
&mask);
|
&mask);
|
||||||
|
|
||||||
if (mask.s_addr
|
if (mask.s_addr
|
||||||
@ -1324,14 +1316,13 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ospf_external_lsa_flush(
|
ospf_external_lsa_flush(
|
||||||
ospf, ei->type,
|
ospf, ei->type, &ei->p,
|
||||||
&ei->p, 0);
|
0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct ospf_lsa *current;
|
struct ospf_lsa *current;
|
||||||
|
|
||||||
current =
|
current = ospf_external_info_find_lsa(
|
||||||
ospf_external_info_find_lsa(
|
|
||||||
ospf, &ei->p);
|
ospf, &ei->p);
|
||||||
if (!current) {
|
if (!current) {
|
||||||
/* Check the
|
/* Check the
|
||||||
@ -1340,8 +1331,7 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
|
|||||||
* originated.
|
* originated.
|
||||||
*/
|
*/
|
||||||
if (!ospf_redistribute_check(
|
if (!ospf_redistribute_check(
|
||||||
ospf, ei,
|
ospf, ei, NULL))
|
||||||
NULL))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ospf_external_lsa_originate(
|
ospf_external_lsa_originate(
|
||||||
@ -1355,15 +1345,13 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
|
|||||||
__func__,
|
__func__,
|
||||||
&p.prefix);
|
&p.prefix);
|
||||||
ospf_external_lsa_refresh(
|
ospf_external_lsa_refresh(
|
||||||
ospf, current,
|
ospf, current, ei,
|
||||||
ei,
|
|
||||||
LSA_REFRESH_FORCE,
|
LSA_REFRESH_FORCE,
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if default-information originate is
|
* Check if default-information originate is
|
||||||
@ -1371,14 +1359,13 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
|
|||||||
*/
|
*/
|
||||||
ospf_external_lsa_default_routemap_apply(ospf, ei, cmd);
|
ospf_external_lsa_default_routemap_apply(ospf, ei, cmd);
|
||||||
|
|
||||||
} else /* if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_DEL) */
|
} else { /* if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_DEL) */
|
||||||
{
|
|
||||||
struct ospf_external_aggr_rt *aggr;
|
struct ospf_external_aggr_rt *aggr;
|
||||||
|
|
||||||
ei = ospf_external_info_lookup(ospf, rt_type, api.instance, &p);
|
ei = ospf_external_info_lookup(ospf, rt_type, api.instance, &p);
|
||||||
if (ei == NULL)
|
if (ei == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
|
||||||
/*
|
/*
|
||||||
* Check if default-information originate i
|
* Check if default-information originate i
|
||||||
* with some routemap prefix/access list match.
|
* with some routemap prefix/access list match.
|
||||||
@ -1405,7 +1392,6 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1490,28 +1476,28 @@ static int ospf_distribute_list_update_timer(struct thread *thread)
|
|||||||
rt = ext->external_info;
|
rt = ext->external_info;
|
||||||
if (!rt)
|
if (!rt)
|
||||||
continue;
|
continue;
|
||||||
for (rn = route_top(rt); rn; rn = route_next(rn))
|
for (rn = route_top(rt); rn; rn = route_next(rn)) {
|
||||||
if ((ei = rn->info) != NULL) {
|
ei = rn->info;
|
||||||
|
if (!ei)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (is_prefix_default(&ei->p))
|
if (is_prefix_default(&ei->p))
|
||||||
default_refresh = 1;
|
default_refresh = 1;
|
||||||
else {
|
else {
|
||||||
struct ospf_external_aggr_rt
|
struct ospf_external_aggr_rt *aggr;
|
||||||
*aggr;
|
|
||||||
aggr = ospf_external_aggr_match(
|
aggr = ospf_external_aggr_match(ospf,
|
||||||
ospf, &ei->p);
|
&ei->p);
|
||||||
if (aggr) {
|
if (aggr) {
|
||||||
/* Check the
|
/* Check the
|
||||||
* AS-external-LSA
|
* AS-external-LSA
|
||||||
* should be originated.
|
* should be originated.
|
||||||
*/
|
*/
|
||||||
if (!ospf_redistribute_check(
|
if (!ospf_redistribute_check(
|
||||||
ospf, ei,
|
ospf, ei, NULL)) {
|
||||||
NULL)) {
|
|
||||||
|
|
||||||
ospf_unlink_ei_from_aggr(
|
ospf_unlink_ei_from_aggr(
|
||||||
ospf,
|
ospf, aggr, ei);
|
||||||
aggr,
|
|
||||||
ei);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1531,8 +1517,7 @@ static int ospf_distribute_list_update_timer(struct thread *thread)
|
|||||||
ospf, aggr, ei);
|
ospf, aggr, ei);
|
||||||
} else if (
|
} else if (
|
||||||
(lsa = ospf_external_info_find_lsa(
|
(lsa = ospf_external_info_find_lsa(
|
||||||
ospf,
|
ospf, &ei->p))) {
|
||||||
&ei->p))) {
|
|
||||||
int force =
|
int force =
|
||||||
LSA_REFRESH_IF_CHANGED;
|
LSA_REFRESH_IF_CHANGED;
|
||||||
/* If this is a MaxAge
|
/* If this is a MaxAge
|
||||||
@ -1557,12 +1542,11 @@ static int ospf_distribute_list_update_timer(struct thread *thread)
|
|||||||
force = LSA_REFRESH_FORCE;
|
force = LSA_REFRESH_FORCE;
|
||||||
|
|
||||||
ospf_external_lsa_refresh(
|
ospf_external_lsa_refresh(
|
||||||
ospf, lsa, ei,
|
ospf, lsa, ei, force,
|
||||||
force, false);
|
false);
|
||||||
} else {
|
} else {
|
||||||
if (!ospf_redistribute_check(
|
if (!ospf_redistribute_check(
|
||||||
ospf, ei,
|
ospf, ei, NULL))
|
||||||
NULL))
|
|
||||||
continue;
|
continue;
|
||||||
ospf_external_lsa_originate(
|
ospf_external_lsa_originate(
|
||||||
ospf, ei);
|
ospf, ei);
|
||||||
@ -1718,17 +1702,16 @@ void ospf_prefix_list_update(struct prefix_list *plist)
|
|||||||
struct ospf_redist *red;
|
struct ospf_redist *red;
|
||||||
|
|
||||||
red_list = ospf->redist[type];
|
red_list = ospf->redist[type];
|
||||||
if (red_list) {
|
if (!red_list)
|
||||||
for (ALL_LIST_ELEMENTS_RO(red_list, node,
|
continue;
|
||||||
red)) {
|
|
||||||
|
for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) {
|
||||||
if (ROUTEMAP(red)) {
|
if (ROUTEMAP(red)) {
|
||||||
/* if route-map is not NULL
|
/* if route-map is not NULL
|
||||||
* it may be using
|
* it may be using
|
||||||
* this prefix list */
|
* this prefix list */
|
||||||
ospf_distribute_list_update(
|
ospf_distribute_list_update(
|
||||||
ospf, type,
|
ospf, type, red->instance);
|
||||||
red->instance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1736,26 +1719,22 @@ void ospf_prefix_list_update(struct prefix_list *plist)
|
|||||||
/* Update area filter-lists. */
|
/* Update area filter-lists. */
|
||||||
for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area)) {
|
for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area)) {
|
||||||
/* Update filter-list in. */
|
/* Update filter-list in. */
|
||||||
if (PREFIX_NAME_IN(area))
|
if (PREFIX_NAME_IN(area)
|
||||||
if (strcmp(PREFIX_NAME_IN(area),
|
&& strcmp(PREFIX_NAME_IN(area),
|
||||||
prefix_list_name(plist))
|
prefix_list_name(plist))
|
||||||
== 0) {
|
== 0) {
|
||||||
PREFIX_LIST_IN(area) =
|
PREFIX_LIST_IN(area) = prefix_list_lookup(
|
||||||
prefix_list_lookup(
|
AFI_IP, PREFIX_NAME_IN(area));
|
||||||
AFI_IP,
|
|
||||||
PREFIX_NAME_IN(area));
|
|
||||||
abr_inv++;
|
abr_inv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update filter-list out. */
|
/* Update filter-list out. */
|
||||||
if (PREFIX_NAME_OUT(area))
|
if (PREFIX_NAME_OUT(area)
|
||||||
if (strcmp(PREFIX_NAME_OUT(area),
|
&& strcmp(PREFIX_NAME_OUT(area),
|
||||||
prefix_list_name(plist))
|
prefix_list_name(plist))
|
||||||
== 0) {
|
== 0) {
|
||||||
PREFIX_LIST_IN(area) =
|
PREFIX_LIST_IN(area) = prefix_list_lookup(
|
||||||
prefix_list_lookup(
|
AFI_IP, PREFIX_NAME_OUT(area));
|
||||||
AFI_IP,
|
|
||||||
PREFIX_NAME_OUT(area));
|
|
||||||
abr_inv++;
|
abr_inv++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1857,8 +1836,11 @@ void ospf_distance_reset(struct ospf *ospf)
|
|||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
struct ospf_distance *odistance;
|
struct ospf_distance *odistance;
|
||||||
|
|
||||||
for (rn = route_top(ospf->distance_table); rn; rn = route_next(rn))
|
for (rn = route_top(ospf->distance_table); rn; rn = route_next(rn)) {
|
||||||
if ((odistance = rn->info) != NULL) {
|
odistance = rn->info;
|
||||||
|
if (!odistance)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (odistance->access_list)
|
if (odistance->access_list)
|
||||||
free(odistance->access_list);
|
free(odistance->access_list);
|
||||||
ospf_distance_free(odistance);
|
ospf_distance_free(odistance);
|
||||||
@ -1874,17 +1856,15 @@ uint8_t ospf_distance_apply(struct ospf *ospf, struct prefix_ipv4 *p,
|
|||||||
if (ospf == NULL)
|
if (ospf == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (ospf->distance_intra)
|
if (ospf->distance_intra && or->path_type == OSPF_PATH_INTRA_AREA)
|
||||||
if (or->path_type == OSPF_PATH_INTRA_AREA)
|
|
||||||
return ospf->distance_intra;
|
return ospf->distance_intra;
|
||||||
|
|
||||||
if (ospf->distance_inter)
|
if (ospf->distance_inter && or->path_type == OSPF_PATH_INTER_AREA)
|
||||||
if (or->path_type == OSPF_PATH_INTER_AREA)
|
|
||||||
return ospf->distance_inter;
|
return ospf->distance_inter;
|
||||||
|
|
||||||
if (ospf->distance_external)
|
if (ospf->distance_external
|
||||||
if (or->path_type == OSPF_PATH_TYPE1_EXTERNAL ||
|
&& (or->path_type == OSPF_PATH_TYPE1_EXTERNAL ||
|
||||||
or->path_type == OSPF_PATH_TYPE2_EXTERNAL)
|
or->path_type == OSPF_PATH_TYPE2_EXTERNAL))
|
||||||
return ospf->distance_external;
|
return ospf->distance_external;
|
||||||
|
|
||||||
if (ospf->distance_all)
|
if (ospf->distance_all)
|
||||||
|
Loading…
Reference in New Issue
Block a user