summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-format2
-rw-r--r--bgpd/bgp_flowspec_util.c44
-rw-r--r--bgpd/bgp_nht.c37
-rw-r--r--pimd/pim_tib.c2
4 files changed, 45 insertions, 40 deletions
diff --git a/.clang-format b/.clang-format
index 7aefafa58f..72018d5a82 100644
--- a/.clang-format
+++ b/.clang-format
@@ -55,7 +55,7 @@ BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
-ColumnLimit: 80
+ColumnLimit: 100
# Linux: CommentPragmas: '^ IWYU pragma:'
CommentPragmas: '\$(FRR|clippy)'
CompactNamespaces: false
diff --git a/bgpd/bgp_flowspec_util.c b/bgpd/bgp_flowspec_util.c
index 66426ab32f..31e14d41f7 100644
--- a/bgpd/bgp_flowspec_util.c
+++ b/bgpd/bgp_flowspec_util.c
@@ -305,14 +305,14 @@ int bgp_flowspec_op_decode(enum bgp_flowspec_util_nlri_t type,
break;
mval->value = value;
if (op[5] == 1)
- mval->compare_operator |=
- OPERATOR_COMPARE_LESS_THAN;
+ SET_FLAG(mval->compare_operator,
+ OPERATOR_COMPARE_LESS_THAN);
if (op[6] == 1)
- mval->compare_operator |=
- OPERATOR_COMPARE_GREATER_THAN;
+ SET_FLAG(mval->compare_operator,
+ OPERATOR_COMPARE_GREATER_THAN);
if (op[7] == 1)
- mval->compare_operator |=
- OPERATOR_COMPARE_EQUAL_TO;
+ SET_FLAG(mval->compare_operator,
+ OPERATOR_COMPARE_EQUAL_TO);
if (op[1] == 1)
mval->unary_operator = OPERATOR_UNARY_AND;
else
@@ -413,16 +413,16 @@ int bgp_flowspec_bitmask_decode(enum bgp_flowspec_util_nlri_t type,
mval->value = value;
if (op[6] == 1) {
/* different from */
- mval->compare_operator |=
- OPERATOR_COMPARE_LESS_THAN;
- mval->compare_operator |=
- OPERATOR_COMPARE_GREATER_THAN;
+ SET_FLAG(mval->compare_operator,
+ OPERATOR_COMPARE_LESS_THAN);
+ SET_FLAG(mval->compare_operator,
+ OPERATOR_COMPARE_GREATER_THAN);
} else
- mval->compare_operator |=
- OPERATOR_COMPARE_EQUAL_TO;
+ SET_FLAG(mval->compare_operator,
+ OPERATOR_COMPARE_EQUAL_TO);
if (op[7] == 1)
- mval->compare_operator |=
- OPERATOR_COMPARE_EXACT_MATCH;
+ SET_FLAG(mval->compare_operator,
+ OPERATOR_COMPARE_EXACT_MATCH);
if (op[1] == 1)
mval->unary_operator =
OPERATOR_UNARY_AND;
@@ -467,11 +467,11 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len,
case FLOWSPEC_SRC_PREFIX:
bitmask = 0;
if (type == FLOWSPEC_DEST_PREFIX) {
- bitmask |= PREFIX_DST_PRESENT;
+ SET_FLAG(bitmask, PREFIX_DST_PRESENT);
prefix = &bpem->dst_prefix;
prefix_offset = &bpem->dst_prefix_offset;
} else {
- bitmask |= PREFIX_SRC_PRESENT;
+ SET_FLAG(bitmask, PREFIX_SRC_PRESENT);
prefix = &bpem->src_prefix;
prefix_offset = &bpem->src_prefix_offset;
}
@@ -491,14 +491,16 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len,
*/
if (prefix->family == AF_INET
&& prefix->u.prefix4.s_addr == INADDR_ANY)
- bpem->match_bitmask_iprule |= bitmask;
+ SET_FLAG(bpem->match_bitmask_iprule,
+ bitmask);
else if (prefix->family == AF_INET6
&& !memcmp(&prefix->u.prefix6,
&in6addr_any,
sizeof(struct in6_addr)))
- bpem->match_bitmask_iprule |= bitmask;
+ SET_FLAG(bpem->match_bitmask_iprule,
+ bitmask);
else
- bpem->match_bitmask |= bitmask;
+ SET_FLAG(bpem->match_bitmask, bitmask);
}
offset += ret;
break;
@@ -640,8 +642,8 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len,
|| bpem->match_dst_port_num || bpem->match_protocol_num
|| bpem->match_bitmask || bpem->match_flowlabel_num)
bpem->type = BGP_PBR_IPSET;
- else if ((bpem->match_bitmask_iprule & PREFIX_SRC_PRESENT) ||
- (bpem->match_bitmask_iprule & PREFIX_DST_PRESENT))
+ else if (CHECK_FLAG(bpem->match_bitmask_iprule, PREFIX_SRC_PRESENT) ||
+ CHECK_FLAG(bpem->match_bitmask_iprule, PREFIX_DST_PRESENT))
/* the extracted policy rule may not need an
* iptables/ipset filtering. check this may not be
* a standard ip rule : permit any to any ( eg)
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index c89ccc9792..8719af56b3 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -607,10 +607,10 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
}
if (nhr->metric != bnc->metric)
- bnc->change_flags |= BGP_NEXTHOP_METRIC_CHANGED;
+ SET_FLAG(bnc->change_flags, BGP_NEXTHOP_METRIC_CHANGED);
if (nhr->nexthop_num != bnc->nexthop_num)
- bnc->change_flags |= BGP_NEXTHOP_CHANGED;
+ SET_FLAG(bnc->change_flags, BGP_NEXTHOP_CHANGED);
if (import_check && (nhr->type == ZEBRA_ROUTE_BGP ||
!prefix_same(&bnc->prefix, &nhr->prefix))) {
@@ -636,11 +636,12 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED);
if (!bnc->is_evpn_gwip_nexthop)
- bnc->flags |= BGP_NEXTHOP_VALID;
+ SET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
bnc->metric = nhr->metric;
bnc->nexthop_num = nhr->nexthop_num;
- bnc->flags &= ~BGP_NEXTHOP_LABELED_VALID; /* check below */
+ UNSET_FLAG(bnc->flags,
+ BGP_NEXTHOP_LABELED_VALID); /* check below */
for (i = 0; i < nhr->nexthop_num; i++) {
int num_labels = 0;
@@ -670,8 +671,7 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
/* There is at least one label-switched path */
if (nexthop->nh_label &&
nexthop->nh_label->num_labels) {
-
- bnc->flags |= BGP_NEXTHOP_LABELED_VALID;
+ SET_FLAG(bnc->flags, BGP_NEXTHOP_LABELED_VALID);
num_labels = nexthop->nh_label->num_labels;
}
@@ -695,7 +695,7 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
* determined
* that there has been a change.
*/
- if (bnc->change_flags & BGP_NEXTHOP_CHANGED)
+ if (CHECK_FLAG(bnc->change_flags, BGP_NEXTHOP_CHANGED))
continue;
for (oldnh = bnc->nexthop; oldnh; oldnh = oldnh->next)
@@ -703,7 +703,7 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
break;
if (!oldnh)
- bnc->change_flags |= BGP_NEXTHOP_CHANGED;
+ SET_FLAG(bnc->change_flags, BGP_NEXTHOP_CHANGED);
}
bnc_nexthop_free(bnc);
bnc->nexthop = nhlist_head;
@@ -727,19 +727,22 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
: "failed"));
if (evpn_resolved) {
- bnc->flags |= BGP_NEXTHOP_VALID;
- bnc->flags &= ~BGP_NEXTHOP_EVPN_INCOMPLETE;
- bnc->change_flags |= BGP_NEXTHOP_MACIP_CHANGED;
+ SET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
+ UNSET_FLAG(bnc->flags,
+ BGP_NEXTHOP_EVPN_INCOMPLETE);
+ SET_FLAG(bnc->change_flags,
+ BGP_NEXTHOP_MACIP_CHANGED);
} else {
- bnc->flags |= BGP_NEXTHOP_EVPN_INCOMPLETE;
- bnc->flags &= ~BGP_NEXTHOP_VALID;
+ SET_FLAG(bnc->flags,
+ BGP_NEXTHOP_EVPN_INCOMPLETE);
+ UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
}
}
} else {
memset(&bnc->resolved_prefix, 0, sizeof(bnc->resolved_prefix));
- bnc->flags &= ~BGP_NEXTHOP_EVPN_INCOMPLETE;
- bnc->flags &= ~BGP_NEXTHOP_VALID;
- bnc->flags &= ~BGP_NEXTHOP_LABELED_VALID;
+ UNSET_FLAG(bnc->flags, BGP_NEXTHOP_EVPN_INCOMPLETE);
+ UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
+ UNSET_FLAG(bnc->flags, BGP_NEXTHOP_LABELED_VALID);
bnc->nexthop_num = nhr->nexthop_num;
/* notify bgp fsm if nbr ip goes from valid->invalid */
@@ -1181,7 +1184,7 @@ static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command)
static void register_zebra_rnh(struct bgp_nexthop_cache *bnc)
{
/* Check if we have already registered */
- if (bnc->flags & BGP_NEXTHOP_REGISTERED)
+ if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED))
return;
if (bnc->ifindex_ipv6_ll) {
diff --git a/pimd/pim_tib.c b/pimd/pim_tib.c
index e1cc69efa9..ac07154f86 100644
--- a/pimd/pim_tib.c
+++ b/pimd/pim_tib.c
@@ -193,5 +193,5 @@ void tib_sg_gm_prune(struct pim_instance *pim, pim_sgaddr sg,
*/
pim_ifchannel_local_membership_del(oif, &sg);
- pim_channel_oil_del(*oilp, __func__);
+ *oilp = pim_channel_oil_del(*oilp, __func__);
}