summaryrefslogtreecommitdiff
path: root/lib/grammar_sandbox.c
AgeCommit message (Collapse)Author
2023-05-19lib: Fix overlapping memory typeDonald Sharp
Make a unique memory type so we are not overlapping another one. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-31lib: Add missing enum's to switch statementDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-06lib: make cmd_element->attr a bitmask & clarifyDavid Lamparter
It already "looks" like a bitmask, but we currently can't flag a command both YANG and HIDDEN at the same time. It really should be a bitmask. Also clarify DEPRECATED behaviour (or the absence thereof.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-18vtysh: defer CLI tree buildingDavid Lamparter
We don't need the CLI tree until we actually enter the node. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-03-17*: require semicolon after DEFINE_MTYPE & coDavid Lamparter
Back when I put this together in 2015, ISO C11 was still reasonably new and we couldn't require it just yet. Without ISO C11, there is no "good" way (only bad hacks) to require a semicolon after a macro that ends with a function definition. And if you added one anyway, you'd get "spurious semicolon" warnings on some compilers... With C11, `_Static_assert()` at the end of a macro will make it so that the semicolon is properly required, consumed, and not warned about. Consistently requiring semicolons after "file-level" macros matches Linux kernel coding style and helps some editors against mis-syntax'ing these macros. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: move CLI node names to cmd_node->nameDavid Lamparter
And again for the name. Why on earth would we centralize this, just so people can forget to update it? Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-14lib: random unused bits cleanupDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-06lib: rename memory_vty.c to lib_vty.cDavid Lamparter
And memory_init() to lib_cmd_init(). Signed-off-by: David Lamparter <equinox@diac24.net>
2019-04-03lib: reduce exported var symbolsQuentin Young
Don't need these in our DSO tables Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-10-02*: list_delete_and_null() -> list_delete()David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-12lib vtysh zebra: variable shadowing fixesF. Aragon
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-08*: fix config.h/zebra.h include orderDavid Lamparter
config.h (or, transitively, zebra.h) must be the first include file listed for autoconf things like _GNU_SOURCE and _POSIX_C_SOURCE to work correctly. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-04-22lib: add ability to dump cli mode graphQuentin Young
The grammar sandbox has had the ability to dump individual commands as DOT graphs, but now that generalized DOT support is present it's trivial to extend this to entire submodes. This is quite useful for visualizing the CLI space when debugging CLI errors. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-06*: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2018-01-11lib, bgpd: fixup use of of CMD_ARGC_MAXQuentin Young
The constant to limit # of allowed cli tokens on any one line was defined in multiple places, all inconsistent with each other. Fix. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-10-05*: Convert list_delete(struct list *) to ** to allow nullingDonald Sharp
Convert the list_delete(struct list *) function to use struct list **. This is to allow the list pointer to be nulled. I keep running into uses of this list_delete function where we forget to set the returned pointer to NULL and attempt to use it and then experience a crash, usually after the developer has long since left the building. Let's make the api explicit in it setting the list pointer to null. Cynical Prediction: This code will expose a attempt to use the NULL'ed list pointer in some obscure bit of code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24lib: better warnings for install_elementDavid Lamparter
Also fixes misuse of vector_slot() - that one doesn't check for access beyond end of vector... And print node names in grammar sandbox "printall". Fixes: #543 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-11lib: add CLI token for 48-bit mac addressesQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-17*: reindentreindent-master-afterwhitespace / reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14*: remove vty_outln againDavid Lamparter
(PRs merged to master added another few vty_outln() calls) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14Merge remote-tracking branch 'frr/master' into newline-reduxDavid Lamparter
Lots of conflicts from CMD_WARNING_CONFIG_FAILED... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14*: remove VTYNL, part 6 of 6David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14*: remove VTYNL, part 1 of 6David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13vtysh: return non-zero for configuration failuresDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> This allows frr-reload.py (or anything else that scripts via vtysh) to know if the vtysh command worked or hit an error.
2017-07-13*: ditch vty_outln(), part 1 of 2David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-11lib: grammar_sandbox: don't pre-setup nodegraphDavid Lamparter
This shows up as still reachable allocation on exit, which is somewhat misleading. Note this only affects --enable-dev-build. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
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-21*: simplify log message lookupQuentin Young
log.c provides functionality for associating a constant (typically a protocol constant) with a string and finding the string given the constant. However this is highly delicate code that is extremely prone to stack overflows and off-by-one's due to requiring the developer to always remember to update the array size constant and to do so correctly which, as shown by example, is never a good idea.b The original goal of this code was to try to implement lookups in O(1) time without a linear search through the message array. Since this code is used 99% of the time for debugs, it's worth the 5-6 additional cmp's worst case if it means we avoid explitable bugs due to oversights... Signed-off-by: Quentin Young <qlyoung@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-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-12lib: use %p specifier for pointersQuentin Young
Fixes builds on ARM Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-03-28lib: sandbox: print vtysh daemon targetsDavid Lamparter
This is very useful to check whether a command disappeared from a specific daemon (by comparing against an earlier output of "grammar find-ambiguous printall nodescan") Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-11Merge pull request #195 from opensourcerouting/cli_mergeDonald Sharp
CLI: independent merge step
2017-02-10grammar_sandbox: count ambiguous commandsDavid Lamparter
... and make the return value useful (for vtysh) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-10grammar_sandbox: add ambiguous-command finderDavid Lamparter
Best run in vtysh. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
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-01-24grammar_sandbox: detabDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23grammar_sandbox: add into daemons if DEV_BUILDDavid Lamparter
Also adds "grammar access <node>" to test/dump an existing command node (e.g. BGP_NODE). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23grammar_sandbox: add .dot file writing capabilityDavid Lamparter
Writing a .dot graphviz file is very useful to get a graphical representation of the command graph. This code is intended solely for testing & development, it uses some fixed-size array and may unexpectedly crash. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23lib: parser: simplify OPTION_TKN & SELECTOR_TKNDavid Lamparter
These are functionally identical as "fork" tokens. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-15lib: parser: refresh grammar_sandboxDavid Lamparter
This makes grammar_sandbox a workable tool again, updating it for the recent changes. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-09-30all: scrubbed some argc CHECK MEsDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-29all: added CHECK ME for DEFUNs that look at argcDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-13lib: Fix memory leak in ipv6_prefix_matchQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-13lib: Fix various memory leaksQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>