summaryrefslogtreecommitdiffstats
path: root/babeld/util.c
diff options
context:
space:
mode:
authorsri-mohan1 <sri.mohan@samsung.com>2024-09-06 03:32:51 +0200
committersri-mohan1 <sri.mohan@samsung.com>2024-09-06 03:32:51 +0200
commit53819c298b663af926fdad8d3a816b4bb937417f (patch)
treec1f7acfe08fa3eef96b613917750771fe855318b /babeld/util.c
parentMerge pull request #16751 from opensourcerouting/fix/solo_peer-group (diff)
downloadfrr-53819c298b663af926fdad8d3a816b4bb937417f.tar.xz
frr-53819c298b663af926fdad8d3a816b4bb937417f.zip
babeld: changes for code maintainability
these changes are for improving the code maintainability and readability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
Diffstat (limited to 'babeld/util.c')
-rw-r--r--babeld/util.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/babeld/util.c b/babeld/util.c
index 4facdabbc..f5edb0ed1 100644
--- a/babeld/util.c
+++ b/babeld/util.c
@@ -211,8 +211,8 @@ mask_prefix(unsigned char *restrict ret,
memset(ret, 0, 16);
memcpy(ret, prefix, plen / 8);
if(plen % 8 != 0)
- ret[plen / 8] =
- (prefix[plen / 8] & ((0xFF << (8 - (plen % 8))) & 0xFF));
+ ret[plen / 8] = CHECK_FLAG(prefix[plen / 8],
+ CHECK_FLAG((0xFF << (8 - (plen % 8))), 0xFF));
return ret;
}
@@ -353,12 +353,13 @@ martian_prefix(const unsigned char *prefix, int plen)
{
return
(plen >= 8 && prefix[0] == 0xFF) ||
- (plen >= 10 && prefix[0] == 0xFE && (prefix[1] & 0xC0) == 0x80) ||
+ (plen >= 10 && prefix[0] == 0xFE &&
+ (CHECK_FLAG(prefix[1], 0xC0) == 0x80)) ||
(plen >= 128 && memcmp(prefix, zeroes, 15) == 0 &&
(prefix[15] == 0 || prefix[15] == 1)) ||
(plen >= 96 && v4mapped(prefix) &&
((plen >= 104 && (prefix[12] == 127 || prefix[12] == 0)) ||
- (plen >= 100 && (prefix[12] & 0xE0) == 0xE0)));
+ (plen >= 100 && CHECK_FLAG(prefix[12], 0xE0) == 0xE0)));
}
int