mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 19:59:37 +00:00
ospf6d: Review comment fixes
This commit is ease reviewing the review comment fixes. Signed:-off-by: Mobashshera Rasool <mrasool@vmware.com>
This commit is contained in:
parent
8440558257
commit
789828186e
@ -1328,23 +1328,22 @@ ospf6_external_aggr_match(struct ospf6 *ospf6, struct prefix *p)
|
|||||||
{
|
{
|
||||||
struct route_node *node;
|
struct route_node *node;
|
||||||
|
|
||||||
node = route_node_match(ospf6->rt_aggr_tbl, (struct prefix *)p);
|
node = route_node_match(ospf6->rt_aggr_tbl, p);
|
||||||
if (node) {
|
if (node == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (IS_OSPF6_DEBUG_AGGR) {
|
if (IS_OSPF6_DEBUG_AGGR) {
|
||||||
if (node->info) {
|
|
||||||
struct ospf6_external_aggr_rt *ag = node->info;
|
struct ospf6_external_aggr_rt *ag = node->info;
|
||||||
zlog_debug("%s: Matching aggregator found.prefix: %pFX Aggregator %pFX",
|
zlog_debug("%s: Matching aggregator found.prefix: %pFX Aggregator %pFX",
|
||||||
__func__,
|
__func__,
|
||||||
p,
|
p,
|
||||||
&ag->p);
|
&ag->p);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
route_unlock_node(node);
|
route_unlock_node(node);
|
||||||
|
|
||||||
return node->info;
|
return node->info;
|
||||||
}
|
}
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
|
void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
|
||||||
struct prefix *prefix,
|
struct prefix *prefix,
|
||||||
@ -2942,8 +2941,7 @@ ospf6_originate_summary_lsa(struct ospf6 *ospf6,
|
|||||||
* then it need to be refreshed and originate bit should
|
* then it need to be refreshed and originate bit should
|
||||||
* be set.
|
* be set.
|
||||||
*/
|
*/
|
||||||
if (lsa && prefix_same((struct prefix *)&aggr->p,
|
if (lsa && prefix_same(&aggr->p, &rt->prefix)) {
|
||||||
(struct prefix *)&rt->prefix)) {
|
|
||||||
if (IS_OSPF6_DEBUG_AGGR)
|
if (IS_OSPF6_DEBUG_AGGR)
|
||||||
zlog_debug("%s: External route prefix is same as aggr so refreshing LSA(%pFX)",
|
zlog_debug("%s: External route prefix is same as aggr so refreshing LSA(%pFX)",
|
||||||
__PRETTY_FUNCTION__,
|
__PRETTY_FUNCTION__,
|
||||||
@ -3034,47 +3032,16 @@ ospf6_asbr_summary_config_delete(struct ospf6 *ospf6, struct route_node *rn)
|
|||||||
route_unlock_node(rn);
|
route_unlock_node(rn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ospf6_handle_external_aggr_update(struct ospf6 *ospf6)
|
static int
|
||||||
|
ospf6_handle_external_aggr_modify(struct ospf6 *ospf6,
|
||||||
|
struct ospf6_external_aggr_rt *aggr)
|
||||||
{
|
{
|
||||||
struct route_node *rn = NULL;
|
|
||||||
unsigned int metric = 0;
|
|
||||||
int mtype;
|
|
||||||
|
|
||||||
if (IS_OSPF6_DEBUG_AGGR)
|
|
||||||
zlog_debug("%s: Process modified aggregators.", __func__);
|
|
||||||
|
|
||||||
for (rn = route_top(ospf6->rt_aggr_tbl); rn; rn = route_next(rn)) {
|
|
||||||
struct ospf6_external_aggr_rt *aggr;
|
|
||||||
struct ospf6_lsa *lsa = NULL;
|
struct ospf6_lsa *lsa = NULL;
|
||||||
struct ospf6_as_external_lsa *asel = NULL;
|
struct ospf6_as_external_lsa *asel = NULL;
|
||||||
struct ospf6_route *rt_aggr;
|
struct ospf6_route *rt_aggr;
|
||||||
|
unsigned int metric = 0;
|
||||||
route_tag_t tag = 0;
|
route_tag_t tag = 0;
|
||||||
|
int mtype;
|
||||||
if (!rn->info)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
aggr = rn->info;
|
|
||||||
|
|
||||||
if (aggr->action == OSPF6_ROUTE_AGGR_DEL) {
|
|
||||||
aggr->action = OSPF6_ROUTE_AGGR_NONE;
|
|
||||||
ospf6_asbr_summary_config_delete(ospf6, rn);
|
|
||||||
|
|
||||||
if (OSPF6_EXTERNAL_RT_COUNT(aggr))
|
|
||||||
hash_clean(aggr->match_extnl_hash,
|
|
||||||
(void *)ospf6_aggr_handle_external_info);
|
|
||||||
|
|
||||||
hash_free(aggr->match_extnl_hash);
|
|
||||||
XFREE(MTYPE_OSPF6_EXTERNAL_RT_AGGR, aggr);
|
|
||||||
|
|
||||||
} else if (aggr->action == OSPF6_ROUTE_AGGR_MODIFY) {
|
|
||||||
|
|
||||||
aggr->action = OSPF6_ROUTE_AGGR_NONE;
|
|
||||||
|
|
||||||
/* Check if tag/metric/metric-type modified */
|
|
||||||
if (CHECK_FLAG(aggr->aggrflags,
|
|
||||||
OSPF6_EXTERNAL_AGGRT_ORIGINATED)
|
|
||||||
&& !CHECK_FLAG(aggr->aggrflags,
|
|
||||||
OSPF6_EXTERNAL_AGGRT_NO_ADVERTISE)) {
|
|
||||||
|
|
||||||
lsa = ospf6_lsdb_lookup(
|
lsa = ospf6_lsdb_lookup(
|
||||||
htons(OSPF6_LSTYPE_AS_EXTERNAL),
|
htons(OSPF6_LSTYPE_AS_EXTERNAL),
|
||||||
@ -3086,7 +3053,7 @@ static void ospf6_handle_external_aggr_update(struct ospf6 *ospf6)
|
|||||||
__func__,
|
__func__,
|
||||||
&aggr->p);
|
&aggr->p);
|
||||||
|
|
||||||
continue;
|
return OSPF6_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
asel = (struct ospf6_as_external_lsa *)
|
asel = (struct ospf6_as_external_lsa *)
|
||||||
@ -3122,6 +3089,51 @@ static void ospf6_handle_external_aggr_update(struct ospf6 *ospf6)
|
|||||||
aggr->route,
|
aggr->route,
|
||||||
ospf6);
|
ospf6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return OSPF6_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ospf6_handle_external_aggr_update(struct ospf6 *ospf6)
|
||||||
|
{
|
||||||
|
struct route_node *rn = NULL;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (IS_OSPF6_DEBUG_AGGR)
|
||||||
|
zlog_debug("%s: Process modified aggregators.", __func__);
|
||||||
|
|
||||||
|
for (rn = route_top(ospf6->rt_aggr_tbl); rn; rn = route_next(rn)) {
|
||||||
|
struct ospf6_external_aggr_rt *aggr;
|
||||||
|
|
||||||
|
if (!rn->info)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
aggr = rn->info;
|
||||||
|
|
||||||
|
if (aggr->action == OSPF6_ROUTE_AGGR_DEL) {
|
||||||
|
aggr->action = OSPF6_ROUTE_AGGR_NONE;
|
||||||
|
ospf6_asbr_summary_config_delete(ospf6, rn);
|
||||||
|
|
||||||
|
if (OSPF6_EXTERNAL_RT_COUNT(aggr))
|
||||||
|
hash_clean(aggr->match_extnl_hash,
|
||||||
|
ospf6_aggr_handle_external_info);
|
||||||
|
|
||||||
|
hash_free(aggr->match_extnl_hash);
|
||||||
|
XFREE(MTYPE_OSPF6_EXTERNAL_RT_AGGR, aggr);
|
||||||
|
|
||||||
|
} else if (aggr->action == OSPF6_ROUTE_AGGR_MODIFY) {
|
||||||
|
|
||||||
|
aggr->action = OSPF6_ROUTE_AGGR_NONE;
|
||||||
|
|
||||||
|
/* Check if tag/metric/metric-type modified */
|
||||||
|
if (CHECK_FLAG(aggr->aggrflags,
|
||||||
|
OSPF6_EXTERNAL_AGGRT_ORIGINATED)
|
||||||
|
&& !CHECK_FLAG(aggr->aggrflags,
|
||||||
|
OSPF6_EXTERNAL_AGGRT_NO_ADVERTISE)) {
|
||||||
|
|
||||||
|
ret = ospf6_handle_external_aggr_modify(ospf6,
|
||||||
|
aggr);
|
||||||
|
if (ret == OSPF6_FAILURE)
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Advertise option modified ?
|
/* Advertise option modified ?
|
||||||
@ -3145,7 +3157,7 @@ void ospf6_external_aggregator_free(struct ospf6_external_aggr_rt *aggr)
|
|||||||
{
|
{
|
||||||
if (OSPF6_EXTERNAL_RT_COUNT(aggr))
|
if (OSPF6_EXTERNAL_RT_COUNT(aggr))
|
||||||
hash_clean(aggr->match_extnl_hash,
|
hash_clean(aggr->match_extnl_hash,
|
||||||
(void *)ospf6_aggr_unlink_external_info);
|
ospf6_aggr_unlink_external_info);
|
||||||
|
|
||||||
if (IS_OSPF6_DEBUG_AGGR)
|
if (IS_OSPF6_DEBUG_AGGR)
|
||||||
zlog_debug("%s: Release the aggregator Address(%pFX)",
|
zlog_debug("%s: Release the aggregator Address(%pFX)",
|
||||||
@ -3168,8 +3180,10 @@ ospf6_delete_all_marked_aggregators(struct ospf6 *ospf6)
|
|||||||
* which are marked as DELETE. Set action to NONE for remaining
|
* which are marked as DELETE. Set action to NONE for remaining
|
||||||
* aggregators
|
* aggregators
|
||||||
*/
|
*/
|
||||||
for (rn = route_top(ospf6->rt_aggr_tbl); rn; rn = route_next(rn))
|
for (rn = route_top(ospf6->rt_aggr_tbl); rn; rn = route_next(rn)) {
|
||||||
if (rn->info) {
|
if (!rn->info)
|
||||||
|
continue;
|
||||||
|
|
||||||
aggr = rn->info;
|
aggr = rn->info;
|
||||||
|
|
||||||
if (aggr->action != OSPF6_ROUTE_AGGR_DEL) {
|
if (aggr->action != OSPF6_ROUTE_AGGR_DEL) {
|
||||||
@ -3223,8 +3237,7 @@ static void ospf6_handle_aggregated_exnl_rt(struct ospf6 *ospf6,
|
|||||||
* and aggegate prefix is same
|
* and aggegate prefix is same
|
||||||
* If same dont flush the originated external LSA.
|
* If same dont flush the originated external LSA.
|
||||||
*/
|
*/
|
||||||
if (prefix_same((struct prefix *)&aggr->p,
|
if (prefix_same(&aggr->p, &rt->prefix)) {
|
||||||
(struct prefix *)&rt->prefix)) {
|
|
||||||
if (IS_OSPF6_DEBUG_AGGR)
|
if (IS_OSPF6_DEBUG_AGGR)
|
||||||
zlog_debug("%s: External Route prefix same as Aggregator(%pFX), so dont flush.",
|
zlog_debug("%s: External Route prefix same as Aggregator(%pFX), so dont flush.",
|
||||||
__func__,
|
__func__,
|
||||||
@ -3269,7 +3282,9 @@ ospf6_handle_external_aggr_add(struct ospf6 *ospf6)
|
|||||||
for (rt = ospf6_route_head(ospf6->external_table); rt;
|
for (rt = ospf6_route_head(ospf6->external_table); rt;
|
||||||
rt = ospf6_route_next(rt)) {
|
rt = ospf6_route_next(rt)) {
|
||||||
ei = rt->route_option;
|
ei = rt->route_option;
|
||||||
if (ei != NULL) {
|
if (ei == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (is_default_prefix(&rt->prefix))
|
if (is_default_prefix(&rt->prefix))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -3302,7 +3317,6 @@ ospf6_handle_external_aggr_add(struct ospf6 *ospf6)
|
|||||||
ospf6, rt);
|
ospf6, rt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static int ospf6_asbr_summary_process(struct thread *thread)
|
static int ospf6_asbr_summary_process(struct thread *thread)
|
||||||
{
|
{
|
||||||
@ -3373,7 +3387,7 @@ int ospf6_asbr_external_rt_advertise(struct ospf6 *ospf6,
|
|||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
struct ospf6_external_aggr_rt *aggr;
|
struct ospf6_external_aggr_rt *aggr;
|
||||||
|
|
||||||
rn = route_node_lookup(ospf6->rt_aggr_tbl, (struct prefix *)p);
|
rn = route_node_lookup(ospf6->rt_aggr_tbl, p);
|
||||||
if (!rn)
|
if (!rn)
|
||||||
return OSPF6_INVALID;
|
return OSPF6_INVALID;
|
||||||
|
|
||||||
@ -3417,8 +3431,7 @@ static bool ospf6_external_rt_hash_cmp(const void *d1, const void *d2)
|
|||||||
const struct ospf6_route *rt1 = d1;
|
const struct ospf6_route *rt1 = d1;
|
||||||
const struct ospf6_route *rt2 = d2;
|
const struct ospf6_route *rt2 = d2;
|
||||||
|
|
||||||
return prefix_same((struct prefix *)&rt1->prefix,
|
return prefix_same(&rt1->prefix, &rt2->prefix);
|
||||||
(struct prefix *)&rt2->prefix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ospf6_external_aggr_rt *
|
static struct ospf6_external_aggr_rt *
|
||||||
@ -3426,16 +3439,10 @@ ospf6_external_aggr_new(struct prefix *p)
|
|||||||
{
|
{
|
||||||
struct ospf6_external_aggr_rt *aggr;
|
struct ospf6_external_aggr_rt *aggr;
|
||||||
|
|
||||||
aggr = (struct ospf6_external_aggr_rt *)XCALLOC(
|
aggr = XCALLOC(MTYPE_OSPF6_EXTERNAL_RT_AGGR,
|
||||||
MTYPE_OSPF6_EXTERNAL_RT_AGGR,
|
|
||||||
sizeof(struct ospf6_external_aggr_rt));
|
sizeof(struct ospf6_external_aggr_rt));
|
||||||
|
|
||||||
if (!aggr)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
aggr->p.family = p->family;
|
|
||||||
prefix_copy(&aggr->p, p);
|
prefix_copy(&aggr->p, p);
|
||||||
aggr->p.prefixlen = p->prefixlen;
|
|
||||||
aggr->metric = -1;
|
aggr->metric = -1;
|
||||||
aggr->mtype = DEFAULT_METRIC_TYPE;
|
aggr->mtype = DEFAULT_METRIC_TYPE;
|
||||||
aggr->match_extnl_hash = hash_create(ospf6_external_rt_hash_key,
|
aggr->match_extnl_hash = hash_create(ospf6_external_rt_hash_key,
|
||||||
@ -3454,7 +3461,7 @@ static void ospf6_external_aggr_add(struct ospf6 *ospf6,
|
|||||||
__func__,
|
__func__,
|
||||||
&aggr->p);
|
&aggr->p);
|
||||||
|
|
||||||
rn = route_node_get(ospf6->rt_aggr_tbl, (struct prefix *)&aggr->p);
|
rn = route_node_get(ospf6->rt_aggr_tbl, &aggr->p);
|
||||||
if (rn->info)
|
if (rn->info)
|
||||||
route_unlock_node(rn);
|
route_unlock_node(rn);
|
||||||
else
|
else
|
||||||
@ -3503,7 +3510,7 @@ ospf6_external_aggr_config_lookup(struct ospf6 *ospf6, struct prefix *p)
|
|||||||
{
|
{
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
|
|
||||||
rn = route_node_lookup(ospf6->rt_aggr_tbl, (struct prefix *)p);
|
rn = route_node_lookup(ospf6->rt_aggr_tbl, p);
|
||||||
if (rn) {
|
if (rn) {
|
||||||
route_unlock_node(rn);
|
route_unlock_node(rn);
|
||||||
return rn->info;
|
return rn->info;
|
||||||
@ -3559,7 +3566,7 @@ int ospf6_external_aggr_config_unset(struct ospf6 *ospf6,
|
|||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
struct ospf6_external_aggr_rt *aggr;
|
struct ospf6_external_aggr_rt *aggr;
|
||||||
|
|
||||||
rn = route_node_lookup(ospf6->rt_aggr_tbl, (struct prefix *)p);
|
rn = route_node_lookup(ospf6->rt_aggr_tbl, p);
|
||||||
if (!rn)
|
if (!rn)
|
||||||
return OSPF6_INVALID;
|
return OSPF6_INVALID;
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ struct ospf6_lsa *ospf6_find_external_lsa(struct ospf6 *ospf6, struct prefix *p)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
info = (struct ospf6_external_info *)(match->route_option);
|
info = match->route_option;
|
||||||
assert(info);
|
assert(info);
|
||||||
|
|
||||||
lsa = ospf6_lsdb_lookup(htons(OSPF6_LSTYPE_AS_EXTERNAL),
|
lsa = ospf6_lsdb_lookup(htons(OSPF6_LSTYPE_AS_EXTERNAL),
|
||||||
|
@ -1929,7 +1929,7 @@ ospf6_print_json_external_routes_walkcb(struct hash_bucket *bucket, void *arg)
|
|||||||
|
|
||||||
prefix2str(&rt->prefix, buf, sizeof(buf));
|
prefix2str(&rt->prefix, buf, sizeof(buf));
|
||||||
|
|
||||||
snprintf(exnalbuf, 20, "Exnl Addr-%d", count);
|
snprintf(exnalbuf, sizeof(exnalbuf), "Exnl Addr-%d", count);
|
||||||
|
|
||||||
json_object_string_add(json, exnalbuf, buf);
|
json_object_string_add(json, exnalbuf, buf);
|
||||||
|
|
||||||
@ -1958,8 +1958,10 @@ ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6,
|
|||||||
ospf6->aggr_delay_interval);
|
ospf6->aggr_delay_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (rn = route_top(ospf6->rt_aggr_tbl); rn; rn = route_next(rn))
|
for (rn = route_top(ospf6->rt_aggr_tbl); rn; rn = route_next(rn)) {
|
||||||
if (rn->info) {
|
if (!rn->info)
|
||||||
|
continue;
|
||||||
|
|
||||||
struct ospf6_external_aggr_rt *aggr = rn->info;
|
struct ospf6_external_aggr_rt *aggr = rn->info;
|
||||||
json_object *json_aggr = NULL;
|
json_object *json_aggr = NULL;
|
||||||
char buf[PREFIX2STR_BUFFER];
|
char buf[PREFIX2STR_BUFFER];
|
||||||
@ -2129,9 +2131,12 @@ static int ospf6_asbr_summary_config_write(struct vty *vty, struct ospf6 *ospf6)
|
|||||||
ospf6->aggr_delay_interval);
|
ospf6->aggr_delay_interval);
|
||||||
|
|
||||||
/* print 'summary-address A:B::C:D/M' */
|
/* print 'summary-address A:B::C:D/M' */
|
||||||
for (rn = route_top(ospf6->rt_aggr_tbl); rn; rn = route_next(rn))
|
for (rn = route_top(ospf6->rt_aggr_tbl); rn; rn = route_next(rn)) {
|
||||||
if (rn->info) {
|
if (!rn->info)
|
||||||
|
continue;
|
||||||
|
|
||||||
aggr = rn->info;
|
aggr = rn->info;
|
||||||
|
|
||||||
prefix2str(&aggr->p, buf, sizeof(buf));
|
prefix2str(&aggr->p, buf, sizeof(buf));
|
||||||
vty_out(vty, " summary-address %s", buf);
|
vty_out(vty, " summary-address %s", buf);
|
||||||
if (aggr->tag)
|
if (aggr->tag)
|
||||||
|
Loading…
Reference in New Issue
Block a user