From db0632a8aeb717cb715c444ae203f38ec42a92e6 Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Wed, 16 Jun 2010 21:02:37 +0100 Subject: 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. --- lib/command_queue.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'lib/command_queue.c') 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) ; + } ; } -- cgit v1.2.3