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;
/* 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);
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. */
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') {
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);
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);
int vty_sock = THREAD_FD(thread);
struct vty *vty = THREAD_ARG(thread);
- vty->t_read = NULL;
/* Read raw data from socket */
if ((nbytes = read(vty->fd, buf, VTY_READ_BUFSIZ)) <= 0) {
int vty_sock = THREAD_FD(thread);
struct vty *vty = THREAD_ARG(thread);
- vty->t_write = NULL;
-
/* Tempolary disable read thread. */
- if ((vty->lines == 0) && vty->t_read) {
- thread_cancel(vty->t_read);
- vty->t_read = NULL;
- }
+ if (vty->lines == 0)
+ THREAD_OFF(vty->t_read);
/* Function execution continue. */
erase = ((vty->status == VTY_MORE || vty->status == VTY_MORELINE));
if (!stdio_vty)
return;
- if (stdio_vty->t_write)
- thread_cancel(stdio_vty->t_write);
- if (stdio_vty->t_read)
- thread_cancel(stdio_vty->t_read);
- if (stdio_vty->t_timeout)
- thread_cancel(stdio_vty->t_timeout);
+ THREAD_OFF(stdio_vty->t_write);
+ THREAD_OFF(stdio_vty->t_read);
+ THREAD_OFF(stdio_vty->t_timeout);
if (stdio_termios)
tcsetattr(0, TCSANOW, &stdio_orig_termios);
sock = THREAD_FD(thread);
vty = THREAD_ARG(thread);
- vty->t_read = NULL;
if ((nbytes = read(sock, buf, VTY_READ_BUFSIZ)) <= 0) {
if (nbytes < 0) {
{
struct vty *vty = THREAD_ARG(thread);
- vty->t_write = NULL;
vtysh_flush(vty);
return 0;
}
bool was_stdio = false;
/* Cancel threads.*/
- if (vty->t_read)
- thread_cancel(vty->t_read);
- if (vty->t_write)
- thread_cancel(vty->t_write);
- if (vty->t_timeout)
- thread_cancel(vty->t_timeout);
+ THREAD_OFF(vty->t_read);
+ THREAD_OFF(vty->t_write);
+ THREAD_OFF(vty->t_timeout);
/* Flush buffer. */
buffer_flush_all(vty->obuf, vty->wfd);
struct vty *vty;
vty = THREAD_ARG(thread);
- vty->t_timeout = NULL;
vty->v_timeout = 0;
/* Clear buffer*/
* 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);
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;
}
vector_set_index(Vvty_serv_thread, sock, vty_serv_thread);
break;
case VTYSH_READ:
- vty->t_read = NULL;
thread_add_read(vty_master, vtysh_read, vty, sock,
&vty->t_read);
break;
case VTYSH_WRITE:
- vty->t_write = NULL;
thread_add_write(vty_master, vtysh_write, vty, sock,
&vty->t_write);
break;
#endif /* VTYSH */
case VTY_READ:
- vty->t_read = NULL;
thread_add_read(vty_master, vty_read, vty, sock, &vty->t_read);
/* Time out treatment. */
if (vty->v_timeout) {
- if (vty->t_timeout)
- thread_cancel(vty->t_timeout);
- vty->t_timeout = NULL;
+ THREAD_OFF(vty->t_timeout);
thread_add_timer(vty_master, vty_timeout, vty,
vty->v_timeout, &vty->t_timeout);
}
&vty->t_write);
break;
case VTY_TIMEOUT_RESET:
- if (vty->t_timeout) {
- thread_cancel(vty->t_timeout);
- vty->t_timeout = NULL;
- }
- if (vty->v_timeout) {
- vty->t_timeout = NULL;
+ THREAD_OFF(vty->t_timeout);
+ if (vty->v_timeout)
thread_add_timer(vty_master, vty_timeout, vty,
vty->v_timeout, &vty->t_timeout);
- }
break;
}
}
for (i = 0; i < vector_active(Vvty_serv_thread); i++)
if ((vty_serv_thread = vector_slot(Vvty_serv_thread, i))
!= NULL) {
- thread_cancel(vty_serv_thread);
+ THREAD_OFF(vty_serv_thread);
vector_slot(Vvty_serv_thread, i) = NULL;
close(i);
}
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)