summaryrefslogtreecommitdiffstats
path: root/babeld
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2023-02-10 01:36:08 +0100
committerGitHub <noreply@github.com>2023-02-10 01:36:08 +0100
commitbda32ba92a3dfb2547a75676b8c1836b45d4a93a (patch)
tree5d35aac7e4980407e3c59742e91998461ff3d6d0 /babeld
parentMerge pull request #12782 from opensourcerouting/fix/bgpd_aspath_str_crash (diff)
parentbabeld: changes for code maintainability (diff)
downloadfrr-bda32ba92a3dfb2547a75676b8c1836b45d4a93a.tar.xz
frr-bda32ba92a3dfb2547a75676b8c1836b45d4a93a.zip
Merge pull request #12762 from sri-mohan1/sri-bable
babeld: changes for code maintainability
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" : "");