lib, isisd: enable concurrent configuration editing

Finally, this disables the config editing lock for isisd.  It also
enables deprecation warnings for the lib/ and isisd/ to catch accidental
uses of vty->index.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2016-09-27 16:53:25 +02:00 committed by Donald Sharp
parent 8ff5a39992
commit cc933ef9f6
5 changed files with 16 additions and 2 deletions

View file

@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib \ AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib \
@ISIS_TOPOLOGY_INCLUDES@ @ISIS_TOPOLOGY_INCLUDES@ -DVTY_DEPRECATE_INDEX
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600 INSTALL_SDATA=@INSTALL@ -m 600
LIBS = @LIBS@ LIBS = @LIBS@

View file

@ -342,6 +342,7 @@ main (int argc, char **argv, char **envp)
*/ */
signal_init (master, array_size (isisd_signals), isisd_signals); signal_init (master, array_size (isisd_signals), isisd_signals);
cmd_init (1); cmd_init (1);
vty_config_lockless ();
vty_init (master); vty_init (master);
memory_init (); memory_init ();
access_list_init(); access_list_init();

View file

@ -1,6 +1,7 @@
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-DVTY_DEPRECATE_INDEX
AM_CFLAGS = $(WERROR) AM_CFLAGS = $(WERROR)
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"

View file

@ -83,6 +83,7 @@ char *vty_cwd = NULL;
/* Configure lock. */ /* Configure lock. */
static int vty_config; static int vty_config;
static int vty_config_is_lockless = 0;
/* Login password check. */ /* Login password check. */
static int no_password_check = 0; static int no_password_check = 0;
@ -2634,6 +2635,8 @@ vty_log_fixed (char *buf, size_t len)
int int
vty_config_lock (struct vty *vty) vty_config_lock (struct vty *vty)
{ {
if (vty_config_is_lockless)
return 1;
if (vty_config == 0) if (vty_config == 0)
{ {
vty->config = 1; vty->config = 1;
@ -2645,6 +2648,8 @@ vty_config_lock (struct vty *vty)
int int
vty_config_unlock (struct vty *vty) vty_config_unlock (struct vty *vty)
{ {
if (vty_config_is_lockless)
return 0;
if (vty_config == 1 && vty->config == 1) if (vty_config == 1 && vty->config == 1)
{ {
vty->config = 0; vty->config = 0;
@ -2653,6 +2658,12 @@ vty_config_unlock (struct vty *vty)
return vty->config; return vty->config;
} }
void
vty_config_lockless (void)
{
vty_config_is_lockless = 1;
}
/* Master of the threads. */ /* Master of the threads. */
static struct thread_master *vty_master; static struct thread_master *vty_master;

View file

@ -353,6 +353,7 @@ extern void vty_log (const char *level, const char *proto,
const char *fmt, struct timestamp_control *, va_list); const char *fmt, struct timestamp_control *, va_list);
extern int vty_config_lock (struct vty *); extern int vty_config_lock (struct vty *);
extern int vty_config_unlock (struct vty *); extern int vty_config_unlock (struct vty *);
extern void vty_config_lockless (void);
extern int vty_shell (struct vty *); extern int vty_shell (struct vty *);
extern int vty_shell_serv (struct vty *); extern int vty_shell_serv (struct vty *);
extern void vty_hello (struct vty *); extern void vty_hello (struct vty *);