]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/vty.c
Merge pull request #5793 from ton31337/fix/formatting_show_bgp_summary_failed
[mirror_frr.git] / lib / vty.c
index 18a449f647ad017a3c3292067d5876b43dde95df..cf161338520471264518bd749644c6515da745fb 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -89,7 +89,7 @@ static char *vty_ipv6_accesslist_name = NULL;
 static vector Vvty_serv_thread;
 
 /* Current directory. */
-char vty_cwd[MAXPATHLEN];
+static char vty_cwd[MAXPATHLEN];
 
 /* Login password check. */
 static int no_password_check = 0;
@@ -337,7 +337,8 @@ void vty_hello(struct vty *vty)
                                /* work backwards to ignore trailling isspace()
                                 */
                                for (s = buf + strlen(buf);
-                                    (s > buf) && isspace((int)*(s - 1)); s--)
+                                    (s > buf) && isspace((unsigned char)s[-1]);
+                                    s--)
                                        ;
                                *s = '\0';
                                vty_out(vty, "%s\n", buf);
@@ -347,6 +348,15 @@ void vty_hello(struct vty *vty)
                        vty_out(vty, "MOTD file not found\n");
        } else if (host.motd)
                vty_out(vty, "%s", host.motd);
+
+#if CONFDATE > 20200901
+       CPP_NOTICE("Please remove solaris code from system as it is deprecated");
+#endif
+#ifdef SUNOS_5
+       zlog_warn("If you are using FRR on Solaris, the FRR developers would love to hear from you\n");
+       zlog_warn("Please send email to dev@lists.frrouting.org about this message\n");
+       zlog_warn("We are considering deprecating Solaris and want to find users of Solaris systems\n");
+#endif
 }
 
 /* Put out prompt and wait input from user. */
@@ -468,7 +478,7 @@ static int vty_command(struct vty *vty, char *buf)
                cp = buf;
        if (cp != NULL) {
                /* Skip white spaces. */
-               while (isspace((int)*cp) && *cp != '\0')
+               while (isspace((unsigned char)*cp) && *cp != '\0')
                        cp++;
        }
        if (cp != NULL && *cp != '\0') {
@@ -892,7 +902,7 @@ static void vty_complete_command(struct vty *vty)
                return;
 
        /* In case of 'help \t'. */
-       if (isspace((int)vty->buf[vty->length - 1]))
+       if (isspace((unsigned char)vty->buf[vty->length - 1]))
                vector_set(vline, NULL);
 
        matched = cmd_complete_command(vline, vty, &ret);
@@ -1006,7 +1016,7 @@ static void vty_describe_command(struct vty *vty)
        if (vline == NULL) {
                vline = vector_init(1);
                vector_set(vline, NULL);
-       } else if (isspace((int)vty->buf[vty->length - 1]))
+       } else if (isspace((unsigned char)vty->buf[vty->length - 1]))
                vector_set(vline, NULL);
 
        describe = cmd_describe_command(vline, vty, &ret);
@@ -2331,8 +2341,7 @@ static void vty_read_file(struct nb_config *config, FILE *confp)
         * Automatically commit the candidate configuration after
         * reading the configuration file.
         */
-       if (config == NULL && vty->candidate_config
-           && frr_get_cli_mode() == FRR_CLI_TRANSACTIONAL) {
+       if (config == NULL) {
                ret = nb_candidate_commit(vty->candidate_config, NB_CLIENT_CLI,
                                          vty, true, "Read configuration file",
                                          NULL);
@@ -2572,22 +2581,17 @@ int vty_config_enter(struct vty *vty, bool private_config, bool exclusive)
        vty->private_config = private_config;
        vty->xpath_index = 0;
 
-       pthread_rwlock_rdlock(&running_config->lock);
-       {
-               if (private_config) {
-                       vty->candidate_config = nb_config_dup(running_config);
+       if (private_config) {
+               vty->candidate_config = nb_config_dup(running_config);
+               vty->candidate_config_base = nb_config_dup(running_config);
+               vty_out(vty,
+                       "Warning: uncommitted changes will be discarded on exit.\n\n");
+       } else {
+               vty->candidate_config = vty_shared_candidate_config;
+               if (frr_get_cli_mode() == FRR_CLI_TRANSACTIONAL)
                        vty->candidate_config_base =
                                nb_config_dup(running_config);
-                       vty_out(vty,
-                               "Warning: uncommitted changes will be discarded on exit.\n\n");
-               } else {
-                       vty->candidate_config = vty_shared_candidate_config;
-                       if (frr_get_cli_mode() == FRR_CLI_TRANSACTIONAL)
-                               vty->candidate_config_base =
-                                       nb_config_dup(running_config);
-               }
        }
-       pthread_rwlock_unlock(&running_config->lock);
 
        return CMD_SUCCESS;
 }
@@ -3007,15 +3011,8 @@ void vty_reset(void)
 
        vty_timeout_val = VTY_TIMEOUT_DEFAULT;
 
-       if (vty_accesslist_name) {
-               XFREE(MTYPE_VTY, vty_accesslist_name);
-               vty_accesslist_name = NULL;
-       }
-
-       if (vty_ipv6_accesslist_name) {
-               XFREE(MTYPE_VTY, vty_ipv6_accesslist_name);
-               vty_ipv6_accesslist_name = NULL;
-       }
+       XFREE(MTYPE_VTY, vty_accesslist_name);
+       XFREE(MTYPE_VTY, vty_ipv6_accesslist_name);
 }
 
 static void vty_save_cwd(void)