diff options
author | Chris Hall <GMCH@hestia.halldom.com> | 2010-06-16 21:02:37 +0100 |
---|---|---|
committer | Chris Hall <GMCH@hestia.halldom.com> | 2010-06-16 21:02:37 +0100 |
commit | db0632a8aeb717cb715c444ae203f38ec42a92e6 (patch) | |
tree | d4da01a34a2e41796c09c2389de58fe0ccc38ee9 | |
parent | d0dcbe07baffdbff39521e5ae8eca3f80a8d6f3e (diff) | |
download | quagga-db0632a8aeb717cb715c444ae203f38ec42a92e6.tar.bz2 quagga-db0632a8aeb717cb715c444ae203f38ec42a92e6.tar.xz |
Fixes to vty stuff so that zebra runs.
Changes to vty handling require the library to behave one way
when running as part of the new (threaded) bgpd and another way
when running as part of any of the other Quagga daemons.
Code to revoke things from the command queue failed to test
whether it was running as part of the new bgpd or not.
-rw-r--r-- | lib/command_queue.c | 18 | ||||
-rw-r--r-- | lib/vty.c | 3 | ||||
-rw-r--r-- | lib/vty_cli.c | 3 | ||||
-rw-r--r-- | lib/vty_io.c | 3 |
4 files changed, 21 insertions, 6 deletions
diff --git a/lib/command_queue.c b/lib/command_queue.c index 18144844..5f14abae 100644 --- a/lib/command_queue.c +++ b/lib/command_queue.c @@ -54,8 +54,11 @@ void cq_enqueue(struct vty *vty, qpn_nexus dst) { struct cq_command_args* args ; + mqueue_block mqb ; - mqueue_block mqb = mqb_init_new(NULL, cq_action, vty) ; + assert(vty_cli_nexus) ; /* must be running qnexus-wise */ + + mqb = mqb_init_new(NULL, cq_action, vty) ; args = mqb_get_args(mqb) ; args->ret = CMD_QUEUED ; @@ -77,6 +80,8 @@ cq_action(mqueue_block mqb, mqb_flag_t flag) struct vty *vty; struct cq_command_args* args ; + assert(vty_cli_nexus) ; /* must be running qnexus-wise */ + vty = mqb_get_arg0(mqb); args = mqb_get_args(mqb) ; @@ -113,6 +118,8 @@ cq_return(mqueue_block mqb, mqb_flag_t flag) struct vty *vty ; struct cq_command_args* args ; + assert(vty_cli_nexus) ; /* must be running qnexus-wise */ + vty = mqb_get_arg0(mqb) ; args = mqb_get_args(mqb) ; @@ -127,7 +134,7 @@ cq_return(mqueue_block mqb, mqb_flag_t flag) } /*------------------------------------------------------------------------------ - * Revoke any messages related to the given VTY + * Revoke any messages related to the given VTY -- if running qnexus-wise. * * Revokes in vty_cmd_nexus -- so before command is started * and in vty_cli_nexus -- so after command has completed @@ -138,7 +145,10 @@ cq_return(mqueue_block mqb, mqb_flag_t flag) void cq_revoke(struct vty *vty) { - mqueue_revoke(vty_cmd_nexus->queue, vty) ; - mqueue_revoke(vty_cli_nexus->queue, vty) ; + if (vty_cli_nexus) + { + mqueue_revoke(vty_cmd_nexus->queue, vty) ; + mqueue_revoke(vty_cli_nexus->queue, vty) ; + } ; } @@ -440,7 +440,8 @@ uty_reset (bool curtains, const char* why) vio = next ; next = sdl_next(vio, vio_list) ; - cq_revoke(vio->vty) ; + if (vio->type == VTY_TERM) + cq_revoke(vio->vty) ; if (why != NULL) vio->close_reason = why ; diff --git a/lib/vty_cli.c b/lib/vty_cli.c index fab266b1..b4791365 100644 --- a/lib/vty_cli.c +++ b/lib/vty_cli.c @@ -349,6 +349,9 @@ uty_cli_start(vty_io vio) extern void uty_cli_close(vty_io vio) { + VTY_ASSERT_LOCKED() ; + assert(vio->type == VTY_TERM) ; + cq_revoke(vio->vty) ; vio->cli_blocked = 1 ; /* don't attempt any more */ diff --git a/lib/vty_io.c b/lib/vty_io.c index 9fd9ff2a..2eadc2d1 100644 --- a/lib/vty_io.c +++ b/lib/vty_io.c @@ -775,7 +775,8 @@ uty_close (vty_io vio) { uty_half_close(vio, NULL) ; /* place on death watch -- if not already done */ - uty_cli_close(vio) ; /* tell the CLI to stop */ + if (vio->type == VTY_TERM) + uty_cli_close(vio) ; /* tell the CLI to stop */ vio->closed = 1 ; /* now closed (stop uty_write() from recursing) */ |