summaryrefslogtreecommitdiffstats
path: root/babeld
diff options
context:
space:
mode:
authorsri-mohan1 <sri.mohan@samsung.com>2023-02-07 09:05:04 +0100
committersri-mohan1 <sri.mohan@samsung.com>2023-02-07 09:05:04 +0100
commit44fab24d25cb9aca539578d91360cb37f7bb4278 (patch)
tree913a140ded2b49591a710ac8385e75d8341919cd /babeld
parentMerge pull request #12731 from donaldsharp/remove_pretty_print (diff)
downloadfrr-44fab24d25cb9aca539578d91360cb37f7bb4278.tar.xz
frr-44fab24d25cb9aca539578d91360cb37f7bb4278.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')
-rw-r--r--babeld/babel_interface.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c
index 4ca875206..53dcbb834 100644
--- a/babeld/babel_interface.c
+++ b/babeld/babel_interface.c
@@ -295,17 +295,18 @@ static void
babel_set_wired_internal(babel_interface_nfo *babel_ifp, int wired)
{
if(wired) {
- babel_ifp->flags |= BABEL_IF_WIRED;
- babel_ifp->flags |= BABEL_IF_SPLIT_HORIZON;
+ SET_FLAG(babel_ifp->flags, BABEL_IF_WIRED);
+ SET_FLAG(babel_ifp->flags, BABEL_IF_SPLIT_HORIZON);
babel_ifp->cost = BABEL_DEFAULT_RXCOST_WIRED;
babel_ifp->channel = BABEL_IF_CHANNEL_NONINTERFERING;
- babel_ifp->flags &= ~BABEL_IF_LQ;
- } else {
- babel_ifp->flags &= ~BABEL_IF_WIRED;
- babel_ifp->flags &= ~BABEL_IF_SPLIT_HORIZON;
+ UNSET_FLAG(babel_ifp->flags, BABEL_IF_LQ);
+ }
+ else {
+ UNSET_FLAG(babel_ifp->flags, BABEL_IF_WIRED);
+ UNSET_FLAG(babel_ifp->flags, BABEL_IF_SPLIT_HORIZON);
babel_ifp->cost = BABEL_DEFAULT_RXCOST_WIRELESS;
babel_ifp->channel = BABEL_IF_CHANNEL_INTERFERING;
- babel_ifp->flags |= BABEL_IF_LQ;
+ SET_FLAG(babel_ifp->flags, BABEL_IF_LQ);
}
}
@@ -595,7 +596,7 @@ interface_recalculate(struct interface *ifp)
return -1;
}
- babel_ifp->flags |= BABEL_IF_IS_UP;
+ SET_FLAG(babel_ifp->flags, BABEL_IF_IS_UP);
mtu = MIN(ifp->mtu, ifp->mtu6);
@@ -653,7 +654,7 @@ interface_recalculate(struct interface *ifp)
debugf(BABEL_DEBUG_COMMON,
"Upped interface %s (%s, cost=%d, channel=%d%s).",
ifp->name,
- (babel_ifp->flags & BABEL_IF_WIRED) ? "wired" : "wireless",
+ CHECK_FLAG(babel_ifp->flags, BABEL_IF_WIRED) ? "wired" : "wireless",
babel_ifp->cost,
babel_ifp->channel,
babel_ifp->ipv4 ? ", IPv4" : "");
@@ -673,11 +674,12 @@ interface_reset(struct interface *ifp)
struct ipv6_mreq mreq;
babel_interface_nfo *babel_ifp = babel_get_if_nfo(ifp);
- if (!(babel_ifp->flags & BABEL_IF_IS_UP))
+ if (!CHECK_FLAG(babel_ifp->flags, BABEL_IF_IS_UP))
return 0;
debugf(BABEL_DEBUG_IF, "interface reset: %s", ifp->name);
- babel_ifp->flags &= ~BABEL_IF_IS_UP;
+
+ UNSET_FLAG(babel_ifp->flags, BABEL_IF_IS_UP);
flush_interface_routes(ifp, 0);
babel_ifp->buffered = 0;
@@ -706,7 +708,7 @@ interface_reset(struct interface *ifp)
debugf(BABEL_DEBUG_COMMON,"Upped network %s (%s, cost=%d%s).",
ifp->name,
- (babel_ifp->flags & BABEL_IF_WIRED) ? "wired" : "wireless",
+ CHECK_FLAG(babel_ifp->flags, BABEL_IF_WIRED) ? "wired" : "wireless",
babel_ifp->cost,
babel_ifp->ipv4 ? ", IPv4" : "");