summaryrefslogtreecommitdiff
path: root/lib/command.c
AgeCommit message (Collapse)Author
2017-06-29*: vty_outln (vty, "") --> vty_out (vty, VTYNL)Quentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29*: s/VTY_NEWLINE/VTYNL/gQuentin Young
Should be able to fit more vty_out onto one line now Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29*: use vty_outlnQuentin Young
Saves 400 lines Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29Merge pull request #754 from qlyoung/fix-argv-argRuss White
use argv->text where appropriate
2017-06-27*: remove VTY_GET_*Quentin Young
CLI validates input tokens, so there's no need to do it in handler functions anymore. spatch follows ---------------- @getull@ expression v; expression str; @@ <... - VTY_GET_ULL(..., v, str) + v = strtoull (str, NULL, 10) ...> @getul@ expression v; expression str; @@ <... - VTY_GET_ULONG(..., v, str) + v = strtoul (str, NULL, 10) ...> @getintrange@ expression name; expression v; expression str; @@ <... - VTY_GET_INTEGER_RANGE(name, v, str, ...) + v = strtoul (str, NULL, 10) ...> @getint@ expression v; expression str; @@ <... - VTY_GET_INTEGER(..., v, str) + v = strtoul (str, NULL, 10) ...> @getv4@ expression v; expression str; @@ <... - VTY_GET_IPV4_ADDRESS(..., v, str) + inet_aton (str, &v) ...> @getv4pfx@ expression v; expression str; @@ <... - VTY_GET_IPV4_PREFIX(..., v, str) + str2prefix_ipv4 (str, &v) ...> Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-27*: use ->text and strmatch where appropriateQuentin Young
Still need to go fix all the places where we do a 1-char strncmp... spatch follows ------------------ @asdf@ expression idx; @@ <... strcmp ( - argv[idx]->arg, + argv[idx]->text, ...) ...> @depends on asdf@ expression idx; @@ <... - !strcmp (argv[idx]->text, + strmatch (argv[idx]->text, ...) ...> @depends on asdf@ expression idx; expression arg; @@ <... - strcmp (argv[idx]->text, arg) == 0 + strmatch (argv[idx]->text, arg) ...> @depends on asdf@ expression idx; expression arg; @@ <... - strcmp (argv[idx]->text, arg) != 0 + !strmatch (argv[idx]->text, arg) ...> Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-16lib: allow 'do' commands in ENABLE_NODEQuentin Young
'do' is syntax sugar that allows the user to execute a command under ENABLE_NODE when in another CLI node. If the user is already in ENABLE_NODE, use of 'do' was previously disallowed. This patch allows it because it makes it easier for us to hack around certain instances of the node synchronization problem with vtysh. Also included is a fix for one of these problems. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-13Merge remote-tracking branch 'frr/master' into pull-624David Lamparter
2017-06-02lib: free varhandler on exitQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-30Merge remote-tracking branch 'origin/master' into babelDonald Sharp
2017-05-23lib: remove BGP_ENCAP(V6)_NODELou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2017-05-18Merge branch 'frr/pull/550'David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-16Merge pull request #532 from opensourcerouting/gpl-headersDonald Sharp
*: make consistent & update GPLv2 file headers
2017-05-16lib: Remove the "This command currently does nothing" messageDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> This breaks the "vtysh -m" output which causes problems for frr-reload.py
2017-05-15lib: Improve error message for the developerDonald Sharp
I keep getting people asking me about what to do when this error is generated when they are programming new cli. Maybe this is a bit better bread-crumb? Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-15*: make consistent & update GPLv2 file headersDavid Lamparter
The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15vtysh: autocomplete variablesDavid Lamparter
This asks the connected daemons for their variable completions through a hidden CLI command. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15lib: cli: autocomplete variablesDavid Lamparter
Shows known values in the appropriate naming domain when the user hits <?> or <Tab>. This patch only works in the telnet CLI, the next patch adds vtysh support. Included completions: - interface names - route-map names - prefix-list names Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15lib: parser: add pre-merge varname propagation stepDavid Lamparter
Fills token->varname based on context. WORD tokens use the WORD - if it isn't actually "WORD". Other than that, a preceding constant token is used as name. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15lib: parser: split off & rename graph handlingDavid Lamparter
Put core CLI graph stuff in lib/command_graph.[ch] and consistently prefix all function names with "cmd_". Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15lib: parser: add named variables in CLIDavid Lamparter
struct cmd_token now has a "varname" field which is derived from the DEFUN's string definition. It can be manually specified with "$name" after some token, e.g. "foo WORD$var". A later commit adds code to automatically fill the value if nothing is specified. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-13lib, vtysh: Add bits and pieces to allow vtysh to understand babelDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-13lib: Cleanup command parsing a tiny bitDonald Sharp
The CLI changes now make it impossible for numbers outside the range specified in the cli to make it to this code. No need to check for it again. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-10- Solve the Coverity Scan PW.ASSIGN_WHERE_COMPARE_MEANTHung-Weic Chiu
- Minor refactoring Signed-off-by: Hung-Weic Chiu <sppsorrg@gmail.com>
2017-05-09Merge pull request #468 from qlyoung/fix-list-permDavid Lamparter
lib: fix 'list permutations'
2017-05-05lib: fix 'list permutations'Quentin Young
Cyclic graphs ftw Also remove graph pretty printer from permutations.c 'cause it's not really needed anymore Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-02Merge branch 'master' into EIGRPDonald Sharp
2017-04-06bgpd: labeled unicast configDon Slice
Implement support for activating the labeled-unicast address family in BGP and relevant configuration for this address family. Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2017-04-05Merge remote-tracking branch 'origin/master' into EIGRPDonald Sharp
2017-04-04Merge branch 'stable/2.0'David Lamparter
Fixed minor conflicts from "defaults" change on stable. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-30Rename: FreeRangeRouting FRRoutingLou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2017-03-28*: track version & "defaults" in configsDavid Lamparter
[CF]: Move default name to autoconf and update tests Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-09Revert "lib: Fix tab completions memleak, memory stats corruption"David Lamparter
This reverts commit 039dc61292de5f3ed5f46316b1940ab6bb184c3f. The patch actually made the situation worse since the return value from cmd_complete_command_real() was now inconsistently allocated from different memory stat pools. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08eigrp: Initial CommitDonald Sharp
Please Note, I will be redoing this commit message with more information. Additionally I will rework the lib/* changes into their own commits. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-08lib: hide away logging internalsDavid Lamparter
... no need to have struct zlog generally-exposed. A few files get to include log_int.h because they use zlog/vzlog. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08lib: remove remaining struct zlog * argsDavid Lamparter
These don't serve any purpose either. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08lib: simplify protocol/log namingDavid Lamparter
The protocols enum serves no purpose other than adding potential for bugs and making it complicated to add a new protocol... nuke. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08lib: ditch struct zlog * argument on zlog/vzlog()David Lamparter
It's completely useless... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07*: add frr_init() infrastructureDavid Lamparter
Start centralising startup & option parsing into the library. FRR_DAEMON_INFO is a bit weird, but it will become useful later (e.g. for killing the ZLOG_* enum, and having the daemon name available) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-03lib: Cleanup missing help strings for 'show commandtree..'Donald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-14lib: define BGP_EVPN_NODEPhilippe Guibert
This define introduces bgp sub node address-family evpn. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-11Merge pull request #195 from opensourcerouting/cli_mergeDonald Sharp
CLI: independent merge step
2017-02-10lib: parser: rewrite token deduplicationDavid Lamparter
Merge the parsed graph into the existing one as a separate step. This makes it possible to merge identical subgraphs, which is used e.g. in bgpd for <A.B.C.D|X:X::X:X|WORD> neighbor names. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-10lib: fix remaining coverity issuesDavid Lamparter
Reported-by: Coverity Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-09Merge pull request #189 from opensourcerouting/config-write-syncDonald Sharp
lib: use fsync() for config writes, plug fd leak
2017-02-09lib: use fsync() for config writes, plug fd leakDavid Lamparter
sync() has a HUGE impact on systems that perform actual I/O, i.e. real servers... Also, we were leaking a fd on each config write ever since c5e69a0 "lib/vty: add separate output fd support to VTYs" (by myself :( ...) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-09lib: use fsync() for config writes, plug fd leakDavid Lamparter
sync() has a HUGE impact on systems that perform actual I/O, i.e. real servers... Also, we were leaking a fd on each config write ever since c5e69a0 "lib/vty: add separate output fd support to VTYs" (by myself :( ...) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-08lib: fix some coverity NULL check warningsDavid Lamparter
Reported-by: Coverity Scan Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-08lib: remove unused cmd_concat_strvec()David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-31lib/tests: add cmd_hostname_set()David Lamparter
To make it possible for testcli to get a clean memory management bill. (Note: XFREE() is NULL-safe, just like free().) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>