Commit graph

15 commits

Author SHA1 Message Date
Ondrej Zajicek 4c19a8a984 CLI: Fix for long-lived sessions during high loads
When there is a continuos stream of CLI commands, cli_get_command()
always returns 1 (there is a new command). Anyway, the socket receive
buffer was reset only when there was no command at all, leading to a
strange behavior: after a while, the CLI receive buffer came to its end,
then read() was called with zero size buffer, it returned 0 which was
interpreted as EOF.

The patch fixes that by resetting the buffer position after each command
and moving remaining data at the beginning of buffer.

Thanks to Maria Matejka for examining the bug and for the original bugfix.
2022-12-10 17:32:42 +01:00
Ondrej Zajicek (work) c26c6bc2d7 Show info from multiple protocols when protocol is not specified
Most commands like 'show ospf neighbors' fail when protocol is not
specified and there are multiple instances of given protocol type.
This is annoying in BIRD 2, as many protocols have IPv4 and IPv6
instances. The patch changes that by showing output from all protocol
instances of appropriate type.

Note that the patch also removes terminating cli_msg() call from these
commands and moves it to the common iterating code.
2020-06-28 15:38:47 +02:00
Jan Moskyto Matejka f8d44b01df Nest: split route show into separate file 2017-05-15 12:10:51 +02:00
Pavel Tvrdík ae80a2de95 unsigned [int] -> uint 2015-06-08 02:24:08 +02:00
Ondrej Zajicek a92cf57dd6 Implements undo command and optional timeout for configuration
Several new configure command variants:

configure undo - undo last reconfiguration
configure timeout - configure with scheduled undo if not confirmed in timeout
configure confirm - confirm last configuration
configure check - just parse and validate config file
2012-12-26 12:40:48 +01:00
Ondrej Zajicek fdf16eb658 Prints full community lists during 'show route all'. 2011-07-03 19:43:30 +02:00
Ondrej Zajicek e0a45fb421 Restricted read-only CLI.
Also adds support for executing commands using birdc <cmd>.
2010-02-21 09:57:26 +01:00
Ondrej Zajicek 6baef17ecf Fixes bug in CLI TX buffer management. 2009-07-14 14:18:54 +02:00
Martin Mares 4b87e256eb Split off general commands to cmds.c.
Added `show symbols' command which dumps whole symbol table together
with symbol types etc.
2000-01-19 12:30:19 +00:00
Martin Mares 34350a5270 Implemented echoing of log messages to CLI connections. Just try `echo all'. 1999-12-06 12:34:45 +00:00
Martin Mares 3579376927 cli_msg() moved to cli.h, so that it can be used outside the parser. 1999-11-25 15:34:51 +00:00
Martin Mares ffb59d243a Command line interface now works. 1999-11-17 12:00:21 +00:00
Martin Mares bc2fb68098 Parse CLI commands. We use the same parser as for configuration files (because
we want to allow filter and similar complex constructs to be used in commands
and we should avoid code duplication), only with CLI_MARKER token prepended
before the whole input.

Defined macro CF_CLI(cmd, args, help) for defining CLI commands in .Y files.
The first argument specifies the command itself, the remaining two arguments
are copied to the help file (er, will be copied after the help file starts
to exist). This macro automatically creates a skeleton rule for the command,
you only need to append arguments as in:

	CF_CLI(STEAL MONEY, <$>, [[Steal <$> US dollars or equivalent in any other currency]]): NUM {
		cli_msg(0, "%d$ stolen", $3);
	} ;

Also don't forget to reset lexer state between inputs.
1999-10-31 17:47:47 +00:00
Martin Mares b9672a845f The CLI I/O functions work as desired. 1999-10-31 15:43:44 +00:00
Martin Mares 7d3aab1c16 First steps of the Command Line Interface: I/O routines. 1999-10-29 12:10:10 +00:00