]> git.puffer.fish Git - mirror/frr.git/commitdiff
babeld: changes for code maintainability 12802/head
authorsri-mohan1 <sri.mohan@samsung.com>
Tue, 14 Feb 2023 10:29:29 +0000 (15:59 +0530)
committersri-mohan1 <sri.mohan@samsung.com>
Tue, 14 Feb 2023 10:29:29 +0000 (15:59 +0530)
These changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
babeld/babel_interface.c
babeld/babel_interface.h
babeld/babel_zebra.c
babeld/babeld.c

index 53dcbb834801437870b0bcd2204ac2ecdff4fec4..e8be854f8d69659d28733d7f32938182f832df02 100644 (file)
@@ -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);
index 9833827927e64900bd84e83a2d6f2a7647d5bc1f..cf85310beac298fbeddab31f98a3c7f4d06086bc 100644 (file)
@@ -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 {
index daaa870a646a700959f0fa11c4e84b9adcdbaa84..bc8274d21a942a65a96738853e8e3fcfb32dc074 100644 (file)
@@ -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");
index 972d52819b879e43a4d1b8509a0657cfcc3a512e..81a1eb0e46ac1715ecad69252df62716abe185cb 100644 (file)
@@ -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