diff options
author | paulo <paul@bayleaf.org.uk> | 2009-12-14 17:38:26 +0000 |
---|---|---|
committer | paulo <paul@bayleaf.org.uk> | 2009-12-14 17:38:26 +0000 |
commit | 73fe495cffb7eae3f68df3d3598b0f83df81b79a (patch) | |
tree | 2e67e49a094ad232bf883b6e5141798da03fa6f9 /lib/command.c | |
parent | 9035f1d22beec82507c1c9137e7c9fb5c4d0fbc6 (diff) | |
download | quagga-73fe495cffb7eae3f68df3d3598b0f83df81b79a.tar.bz2 quagga-73fe495cffb7eae3f68df3d3598b0f83df81b79a.tar.xz |
Using message queue to send commands from cli thread to bgp thread.
Diffstat (limited to 'lib/command.c')
-rw-r--r-- | lib/command.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/command.c b/lib/command.c index 80b113e8..c057c0a7 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1996,7 +1996,7 @@ node_parent ( enum node_type node ) /* Execute command by argument vline vector. */ static int cmd_execute_command_real (vector vline, struct vty *vty, - struct cmd_element **cmd) + struct cmd_element **cmd, qpn_nexus bgp_nexus) { unsigned int i; unsigned int index; @@ -2112,12 +2112,21 @@ cmd_execute_command_real (vector vline, struct vty *vty, return CMD_SUCCESS_DAEMON; /* Execute matched command. */ - return (*matched_element->func) (matched_element, vty, argc, argv); + if (qpthreads_enabled) + { + /* Don't do it now, but send to bgp qpthread */ + cq_enqueue(matched_element, vty, argc, argv, bgp_nexus); + return CMD_SUCCESS; + } + else + { + return (*matched_element->func) (matched_element, vty, argc, argv); + } } int cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, - int vtysh) { + qpn_nexus bgp_nexus, int vtysh) { int ret, saved_ret, tried = 0; enum node_type onode, try_node; @@ -2138,7 +2147,7 @@ cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, vector_set_index (shifted_vline, index-1, vector_lookup(vline, index)); } - ret = cmd_execute_command_real (shifted_vline, vty, cmd); + ret = cmd_execute_command_real (shifted_vline, vty, cmd, bgp_nexus); vector_free(shifted_vline); vty->node = onode; @@ -2146,7 +2155,7 @@ cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, } - saved_ret = ret = cmd_execute_command_real (vline, vty, cmd); + saved_ret = ret = cmd_execute_command_real (vline, vty, cmd, bgp_nexus); if (vtysh) return saved_ret; @@ -2157,7 +2166,7 @@ cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, { try_node = node_parent(try_node); vty->node = try_node; - ret = cmd_execute_command_real (vline, vty, cmd); + ret = cmd_execute_command_real (vline, vty, cmd, bgp_nexus); tried = 1; if (ret == CMD_SUCCESS || ret == CMD_WARNING) { |