Merge pull request #12413 from donaldsharp/misc_and_then_some

Misc and then some
This commit is contained in:
Donatas Abraitis 2022-11-29 10:27:43 +02:00 committed by GitHub
commit a70449c214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 26 deletions

View File

@ -278,8 +278,10 @@ void bgp_mp_list_add(struct list *mp_list, struct bgp_path_info *mpinfo)
static struct bgp_path_info_mpath *bgp_path_info_mpath_new(void)
{
struct bgp_path_info_mpath *new_mpath;
new_mpath = XCALLOC(MTYPE_BGP_MPATH_INFO,
sizeof(struct bgp_path_info_mpath));
return new_mpath;
}
@ -313,8 +315,6 @@ bgp_path_info_mpath_get(struct bgp_path_info *path)
if (!path->mpath) {
mpath = bgp_path_info_mpath_new();
if (!mpath)
return NULL;
path->mpath = mpath;
mpath->mp_info = path;
}

View File

@ -1322,7 +1322,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
ospf6_copy_nexthops(tmp_route->nh_list,
o_path->nh_list);
if (ospf6_route_cmp_nexthops(tmp_route, route) != 0) {
if (!ospf6_route_cmp_nexthops(tmp_route, route)) {
/* adv. router exists in the list, update nhs */
list_delete_all_node(o_path->nh_list);
ospf6_copy_nexthops(o_path->nh_list,

View File

@ -246,7 +246,10 @@ void ospf6_merge_nexthops(struct list *dst, struct list *src)
}
}
int ospf6_route_cmp_nexthops(struct ospf6_route *a, struct ospf6_route *b)
/*
* If the nexthops are the same return true
*/
bool ospf6_route_cmp_nexthops(struct ospf6_route *a, struct ospf6_route *b)
{
struct listnode *anode, *bnode;
struct ospf6_nexthop *anh, *bnh;
@ -264,14 +267,14 @@ int ospf6_route_cmp_nexthops(struct ospf6_route *a, struct ospf6_route *b)
/* Currnet List A element not found List B
* Non-Identical lists return */
if (identical == false)
return 1;
return false;
}
return 0;
return true;
} else
return 1;
return false;
}
/* One of the routes doesn't exist ? */
return (1);
return false;
}
int ospf6_num_nexthops(struct list *nh_list)
@ -577,12 +580,7 @@ ospf6_route_lookup_identical(struct ospf6_route *route,
for (target = ospf6_route_lookup(&route->prefix, table); target;
target = target->next) {
if (target->type == route->type
&& prefix_same(&target->prefix, &route->prefix)
&& target->path.type == route->path.type
&& target->path.cost == route->path.cost
&& target->path.u.cost_e2 == route->path.u.cost_e2
&& ospf6_route_cmp_nexthops(target, route) == 0)
if (ospf6_route_is_identical(target, route))
return target;
}
return NULL;

View File

@ -304,7 +304,7 @@ extern const char *const ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX];
(ra)->path.cost == (rb)->path.cost && \
(ra)->path.u.cost_e2 == (rb)->path.u.cost_e2 && \
listcount(ra->paths) == listcount(rb->paths) && \
ospf6_route_cmp_nexthops(ra, rb) == 0)
ospf6_route_cmp_nexthops(ra, rb))
#define ospf6_route_is_best(r) (CHECK_FLAG ((r)->flag, OSPF6_ROUTE_BEST))
@ -330,8 +330,8 @@ extern void ospf6_add_nexthop(struct list *nh_list, int ifindex,
struct in6_addr *addr);
extern void ospf6_add_route_nexthop_blackhole(struct ospf6_route *route);
extern int ospf6_num_nexthops(struct list *nh_list);
extern int ospf6_route_cmp_nexthops(struct ospf6_route *a,
struct ospf6_route *b);
extern bool ospf6_route_cmp_nexthops(struct ospf6_route *a,
struct ospf6_route *b);
extern void ospf6_route_zebra_copy_nexthops(struct ospf6_route *route,
struct zapi_nexthop nexthops[],
int entries, vrf_id_t vrf_id);

View File

@ -223,8 +223,10 @@ int ospf_dr_election(struct ospf_interface *oi)
new_state = ospf_ism_state(oi);
zlog_debug("DR-Election[1st]: Backup %pI4", &BDR(oi));
zlog_debug("DR-Election[1st]: DR %pI4", &DR(oi));
if (IS_DEBUG_OSPF(ism, ISM_STATUS)) {
zlog_debug("DR-Election[1st]: Backup %pI4", &BDR(oi));
zlog_debug("DR-Election[1st]: DR %pI4", &DR(oi));
}
if (new_state != old_state
&& !(new_state == ISM_DROther && old_state < ISM_DROther)) {
@ -233,8 +235,10 @@ int ospf_dr_election(struct ospf_interface *oi)
new_state = ospf_ism_state(oi);
zlog_debug("DR-Election[2nd]: Backup %pI4", &BDR(oi));
zlog_debug("DR-Election[2nd]: DR %pI4", &DR(oi));
if (IS_DEBUG_OSPF(ism, ISM_STATUS)) {
zlog_debug("DR-Election[2nd]: Backup %pI4", &BDR(oi));
zlog_debug("DR-Election[2nd]: DR %pI4", &DR(oi));
}
}
list_delete(&el_list);

View File

@ -104,11 +104,12 @@ int ospf_if_add_alldrouters(struct ospf *top, struct prefix *p,
"can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %pI4, ifindex %u, AllDRouters): %s; perhaps a kernel limit on # of multicast group memberships has been exceeded?",
top->fd, &p->u.prefix4, ifindex,
safe_strerror(errno));
else
zlog_debug(
"interface %pI4 [%u] join AllDRouters Multicast group.",
&p->u.prefix4, ifindex);
else {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
"interface %pI4 [%u] join AllDRouters Multicast group.",
&p->u.prefix4, ifindex);
}
return ret;
}