Skip to content

Commit

Permalink
Merge pull request #17167 from sri-mohan1/srib-24-frr-a
Browse files Browse the repository at this point in the history
bgpd: changes for code maintainability
  • Loading branch information
ton31337 authored Oct 20, 2024
2 parents 0952110 + 67d0720 commit fa291dd
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions bgpd/bgp_routemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ route_match_script(void *rule, const struct prefix *prefix, void *object)

path->attr->med = newattr.med;

if (path->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
if (CHECK_FLAG(path->attr->flag, ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)))
locpref = path->attr->local_pref;
if (locpref != newattr.local_pref) {
SET_FLAG(path->attr->flag,
Expand Down Expand Up @@ -713,15 +713,15 @@ route_match_prefix_list_flowspec(afi_t afi, struct prefix_list *plist,
afi);
if (ret < 0)
return RMAP_NOMATCH;
if (api.match_bitmask & PREFIX_DST_PRESENT ||
api.match_bitmask_iprule & PREFIX_DST_PRESENT) {
if (CHECK_FLAG(api.match_bitmask, PREFIX_DST_PRESENT) ||
CHECK_FLAG(api.match_bitmask_iprule, PREFIX_DST_PRESENT)) {
if (family2afi((&api.dst_prefix)->family) != afi)
return RMAP_NOMATCH;
return prefix_list_apply(plist, &api.dst_prefix) == PREFIX_DENY
? RMAP_NOMATCH
: RMAP_MATCH;
} else if (api.match_bitmask & PREFIX_SRC_PRESENT ||
api.match_bitmask_iprule & PREFIX_SRC_PRESENT) {
} else if (CHECK_FLAG(api.match_bitmask, PREFIX_SRC_PRESENT) ||
CHECK_FLAG(api.match_bitmask_iprule, PREFIX_SRC_PRESENT)) {
if (family2afi((&api.src_prefix)->family) != afi)
return RMAP_NOMATCH;
return (prefix_list_apply(plist, &api.src_prefix) == PREFIX_DENY
Expand Down Expand Up @@ -2071,7 +2071,7 @@ route_set_ip_nexthop(void *rule, const struct prefix *prefix, void *object)
sockunion_family(peer->su_remote) == AF_INET) {
path->attr->nexthop.s_addr =
sockunion2ip(peer->su_remote);
path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
SET_FLAG(path->attr->flag, ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP));
} else if (CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_OUT)) {
/* The next hop value will be set as part of
* packet rewrite. Set the flags here to indicate
Expand All @@ -2084,7 +2084,7 @@ route_set_ip_nexthop(void *rule, const struct prefix *prefix, void *object)
}
} else {
/* Set next hop value. */
path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
SET_FLAG(path->attr->flag, ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP));
path->attr->nexthop = *rins->address;
SET_FLAG(path->attr->rmap_change_flags,
BATTR_RMAP_IPV4_NHOP_CHANGED);
Expand Down Expand Up @@ -2218,7 +2218,7 @@ route_set_local_pref(void *rule, const struct prefix *prefix, void *object)
if (path->attr->local_pref)
locpref = path->attr->local_pref;

path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF);
SET_FLAG(path->attr->flag, ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF));
path->attr->local_pref = route_value_adjust(rv, locpref, path);

return RMAP_OKAY;
Expand Down Expand Up @@ -2293,7 +2293,7 @@ route_set_metric(void *rule, const struct prefix *prefix, void *object)
rv = rule;
path = object;

if (path->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
if (CHECK_FLAG(path->attr->flag, ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC)))
med = path->attr->med;

bgp_attr_set_med(path->attr, route_value_adjust(rv, med, path));
Expand Down Expand Up @@ -3493,7 +3493,7 @@ route_set_atomic_aggregate(void *rule, const struct prefix *pfx, void *object)
struct bgp_path_info *path;

path = object;
path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE);
SET_FLAG(path->attr->flag, ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE));

return RMAP_OKAY;
}
Expand Down Expand Up @@ -3571,7 +3571,7 @@ route_set_aggregator_as(void *rule, const struct prefix *prefix, void *object)

path->attr->aggregator_as = aggregator->as;
path->attr->aggregator_addr = aggregator->address;
path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR);
SET_FLAG(path->attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR));

return RMAP_OKAY;
}
Expand Down Expand Up @@ -3651,7 +3651,7 @@ route_set_label_index(void *rule, const struct prefix *prefix, void *object)
label_index = rv->value;
if (label_index) {
path->attr->label_index = label_index;
path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID);
SET_FLAG(path->attr->flag, ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID));
}

return RMAP_OKAY;
Expand Down Expand Up @@ -4318,7 +4318,7 @@ route_set_originator_id(void *rule, const struct prefix *prefix, void *object)
address = rule;
path = object;

path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID);
SET_FLAG(path->attr->flag, ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID));
path->attr->originator_id = *address;

return RMAP_OKAY;
Expand Down

0 comments on commit fa291dd

Please sign in to comment.