]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: minor fix and code style compliance
authorDavid Schweizer <dschweizer@opensourcerouting.org>
Thu, 20 Aug 2020 14:50:21 +0000 (16:50 +0200)
committerDavid Schweizer <dschweizer@opensourcerouting.org>
Thu, 20 Aug 2020 14:50:21 +0000 (16:50 +0200)
* Applied style suggestions by automated compliance check.
* Fixed function bgp_shutdown_enable to use immutable message string.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
bgpd/bgp_vty.c
bgpd/bgpd.c
bgpd/bgpd.h

index 20c2f262e26eb2e5b22f40d514454e08b1558920..6938d301feb6970295563a03cb4f5294c764fbc2 100644 (file)
@@ -3600,15 +3600,13 @@ DEFUN (bgp_default_shutdown,
        return CMD_SUCCESS;
 }
 
-DEFPY (bgp_shutdown_msg,
-       bgp_shutdown_msg_cmd,
-       "bgp shutdown message MSG...",
-       BGP_STR
-       "Enable administrative shutdown of the BGP instance\n"
-       "Add a shutdown message (RFC 8203)\n"
-       "Shutdown message\n")
+DEFPY(bgp_shutdown_msg, bgp_shutdown_msg_cmd, "bgp shutdown message MSG...",
+      BGP_STR
+      "Enable administrative shutdown of the BGP instance\n"
+      "Add a shutdown message (RFC 8203)\n"
+      "Shutdown message\n")
 {
-       charmsgstr = NULL;
+       char *msgstr = NULL;
 
        VTY_DECLVAR_CONTEXT(bgp, bgp);
 
@@ -3621,10 +3619,8 @@ DEFPY (bgp_shutdown_msg,
        return CMD_SUCCESS;
 }
 
-DEFPY (bgp_shutdown, bgp_shutdown_cmd,
-       "bgp shutdown",
-       BGP_STR
-       "Enable administrative shutdown of the BGP instance\n")
+DEFPY(bgp_shutdown, bgp_shutdown_cmd, "bgp shutdown",
+      BGP_STR "Enable administrative shutdown of the BGP instance\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
 
@@ -3633,12 +3629,8 @@ DEFPY (bgp_shutdown, bgp_shutdown_cmd,
        return CMD_SUCCESS;
 }
 
-DEFPY (no_bgp_shutdown,
-       no_bgp_shutdown_cmd,
-       "no bgp shutdown",
-       NO_STR
-       BGP_STR
-       "Disable administrative shutdown of the BGP instance\n")
+DEFPY(no_bgp_shutdown, no_bgp_shutdown_cmd, "no bgp shutdown",
+      NO_STR BGP_STR "Disable administrative shutdown of the BGP instance\n")
 {
        VTY_DECLVAR_CONTEXT(bgp, bgp);
 
@@ -9376,7 +9368,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
                                                            "pfxSnt",
                                                            (PAF_SUBGRP(paf))->scount);
                                if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN)
-                                   || CHECK_FLAG(peer->bgp->flags, BGP_FLAG_SHUTDOWN))
+                                   || CHECK_FLAG(peer->bgp->flags,
+                                                 BGP_FLAG_SHUTDOWN))
                                        json_object_string_add(json_peer, "state",
                                                               "Idle (Admin)");
                                else if (peer->afc_recv[afi][safi])
@@ -9495,8 +9488,10 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
                                                                        ->scount);
                                        }
                                } else {
-                                       if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN)
-                                           || CHECK_FLAG(peer->bgp->flags, BGP_FLAG_SHUTDOWN))
+                                       if (CHECK_FLAG(peer->flags,
+                                                      PEER_FLAG_SHUTDOWN)
+                                           || CHECK_FLAG(peer->bgp->flags,
+                                                         BGP_FLAG_SHUTDOWN))
                                                vty_out(vty, " Idle (Admin)");
                                        else if (CHECK_FLAG(
                                                            peer->sflags,
index 7a52727a43356699f9f7d04896fc29238dca1785..2f9e8642a1a35701897f24e35f5d4f577d105144 100644 (file)
@@ -4024,7 +4024,7 @@ static void peer_flag_modify_action(struct peer *peer, uint32_t flag)
 }
 
 /* Enable global administrative shutdown of all peers of BGP instance */
-void bgp_shutdown_enable(struct bgp *bgp, char *msg)
+void bgp_shutdown_enable(struct bgp *bgp, const char *msg)
 {
        struct peer *peer;
        struct listnode *node;
@@ -4046,13 +4046,14 @@ void bgp_shutdown_enable(struct bgp *bgp, char *msg)
                /* send a RFC 4486 notification message if necessary */
                if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status)) {
                        if (msg)
-                               bgp_notify_send_with_data(peer, BGP_NOTIFY_CEASE,
-                                                         BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN,
-                                                         (uint8_t *)(msg),
-                                                         strlen(msg));
+                               bgp_notify_send_with_data(
+                                       peer, BGP_NOTIFY_CEASE,
+                                       BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN,
+                                       (uint8_t *)(msg), strlen(msg));
                        else
-                               bgp_notify_send(peer, BGP_NOTIFY_CEASE,
-                                               BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
+                               bgp_notify_send(
+                                       peer, BGP_NOTIFY_CEASE,
+                                       BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
                }
 
                /* reset start timer to initial value */
index 4e5ccf59dcd7f1c0655483cfc1e5681d7d2e516a..0a2dc2a09c51dac23917d754372f632d2059852a 100644 (file)
@@ -453,7 +453,7 @@ struct bgp {
 #define BGP_FLAG_SHOW_NEXTHOP_HOSTNAME (1 << 26)
 
 /* This flag is set if the instance is in administrative shutdown */
-#define BGP_FLAG_SHUTDOWN                (1 << 27)
+#define BGP_FLAG_SHUTDOWN (1 << 27)
 
        enum global_mode GLOBAL_GR_FSM[BGP_GLOBAL_GR_MODE]
                                      [BGP_GLOBAL_GR_EVENT_CMD];
@@ -1951,7 +1951,7 @@ extern struct peer_af *peer_af_create(struct peer *, afi_t, safi_t);
 extern struct peer_af *peer_af_find(struct peer *, afi_t, safi_t);
 extern int peer_af_delete(struct peer *, afi_t, safi_t);
 
-extern void bgp_shutdown_enable(struct bgp *bgp, char *msg);
+extern void bgp_shutdown_enable(struct bgp *bgp, const char *msg);
 extern void bgp_shutdown_disable(struct bgp *bgp);
 
 extern void bgp_close(void);