summaryrefslogtreecommitdiff
path: root/babeld
diff options
context:
space:
mode:
authorsri-mohan1 <sri.mohan@samsung.com>2023-02-14 15:59:29 +0530
committersri-mohan1 <sri.mohan@samsung.com>2023-02-14 15:59:29 +0530
commit03b7208c4c5b8a31e6fdc5eb7831e218701570d3 (patch)
treeb99e544e0a71ce2beb25bf85423aa1c01ee040de /babeld
parent44fab24d25cb9aca539578d91360cb37f7bb4278 (diff)
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.c12
-rw-r--r--babeld/babel_interface.h2
-rw-r--r--babeld/babel_zebra.c16
-rw-r--r--babeld/babeld.c2
4 files changed, 17 insertions, 15 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c
index 53dcbb8348..e8be854f8d 100644
--- a/babeld/babel_interface.c
+++ b/babeld/babel_interface.c
@@ -66,7 +66,7 @@ static vector babel_enable_if; /* enable interfaces (by cmd). */
int babel_ifp_up(struct interface *ifp)
{
- debugf(BABEL_DEBUG_IF, "receive a 'interface up'");
+ debugf(BABEL_DEBUG_IF, "receive an 'interface up'");
interface_recalculate(ifp);
return 0;
@@ -75,7 +75,7 @@ int babel_ifp_up(struct interface *ifp)
int
babel_ifp_down(struct interface *ifp)
{
- debugf(BABEL_DEBUG_IF, "receive a 'interface down'");
+ debugf(BABEL_DEBUG_IF, "receive an 'interface down'");
if (ifp == NULL) {
return 0;
@@ -87,7 +87,7 @@ babel_ifp_down(struct interface *ifp)
int babel_ifp_create (struct interface *ifp)
{
- debugf(BABEL_DEBUG_IF, "receive a 'interface add'");
+ debugf(BABEL_DEBUG_IF, "receive an 'interface add'");
interface_recalculate(ifp);
@@ -97,7 +97,7 @@ int babel_ifp_create (struct interface *ifp)
int
babel_ifp_destroy(struct interface *ifp)
{
- debugf(BABEL_DEBUG_IF, "receive a 'interface delete'");
+ debugf(BABEL_DEBUG_IF, "receive an 'interface delete'");
if (IS_ENABLE(ifp))
interface_reset(ifp);
@@ -112,7 +112,7 @@ babel_interface_address_add (ZAPI_CALLBACK_ARGS)
struct connected *ifc;
struct prefix *prefix;
- debugf(BABEL_DEBUG_IF, "receive a 'interface address add'");
+ debugf(BABEL_DEBUG_IF, "receive an 'interface address add'");
ifc = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD,
zclient->ibuf, vrf_id);
@@ -148,7 +148,7 @@ babel_interface_address_delete (ZAPI_CALLBACK_ARGS)
struct connected *ifc;
struct prefix *prefix;
- debugf(BABEL_DEBUG_IF, "receive a 'interface address delete'");
+ debugf(BABEL_DEBUG_IF, "receive an 'interface address delete'");
ifc = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE,
zclient->ibuf, vrf_id);
diff --git a/babeld/babel_interface.h b/babeld/babel_interface.h
index 9833827927..cf85310bea 100644
--- a/babeld/babel_interface.h
+++ b/babeld/babel_interface.h
@@ -100,7 +100,7 @@ if_up(struct interface *ifp)
{
return (if_is_operative(ifp) &&
ifp->connected != NULL &&
- (babel_get_if_nfo(ifp)->flags & BABEL_IF_IS_UP));
+ CHECK_FLAG(babel_get_if_nfo(ifp)->flags, BABEL_IF_IS_UP));
}
struct buffered_update {
diff --git a/babeld/babel_zebra.c b/babeld/babel_zebra.c
index daaa870a64..bc8274d21a 100644
--- a/babeld/babel_zebra.c
+++ b/babeld/babel_zebra.c
@@ -139,7 +139,7 @@ DEFUN (debug_babel,
for(i = 0; debug_type[i].str != NULL; i++) {
if (strncmp (debug_type[i].str, argv[2]->arg,
debug_type[i].str_min_len) == 0) {
- debug |= debug_type[i].type;
+ SET_FLAG(debug, debug_type[i].type);
return CMD_SUCCESS;
}
}
@@ -169,7 +169,7 @@ DEFUN (no_debug_babel,
for (i = 0; debug_type[i].str; i++) {
if (strncmp(debug_type[i].str, argv[3]->arg,
debug_type[i].str_min_len) == 0) {
- debug &= ~debug_type[i].type;
+ UNSET_FLAG(debug, debug_type[i].type);
return CMD_SUCCESS;
}
}
@@ -195,16 +195,18 @@ debug_babel_config_write (struct vty * vty)
lines++;
}
else
+ {
for (i = 0; debug_type[i].str != NULL; i++)
- if
- (
- debug_type[i].type != BABEL_DEBUG_ALL
- && CHECK_FLAG (debug, debug_type[i].type)
- )
+ {
+ if (debug_type[i].type != BABEL_DEBUG_ALL
+ && CHECK_FLAG (debug, debug_type[i].type))
{
vty_out (vty, "debug babel %s\n", debug_type[i].str);
lines++;
}
+ }
+ }
+
if (lines)
{
vty_out (vty, "!\n");
diff --git a/babeld/babeld.c b/babeld/babeld.c
index 972d52819b..81a1eb0e46 100644
--- a/babeld/babeld.c
+++ b/babeld/babeld.c
@@ -277,7 +277,7 @@ babel_get_myid(void)
exit(1);
}
/* Clear group and global bits */
- myid[0] &= ~3;
+ UNSET_FLAG (myid[0], 3);
}
/* Make some noise so that others notice us, and send retractions in