summaryrefslogtreecommitdiff
path: root/lib/command.c
AgeCommit message (Collapse)Author
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-09-05lib: Hash creation cleanupDonald Sharp
1) Some hash key functions where converting pointers directly to a 32 bit value via downcasting. Pointers are 64 bit on a majority of our platforms. 2) Some hashes were being created with 256 entries, downsize the hash creation size to more appropriate values. 3) Add hash names to hash creation so we can watch the hash via 'show debugging hashtable' Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-30*: fix styleQuentin Young
Fixes style nits introduced by recent pull requests. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-28Merge branch 'master' into dev-masterMitesh Kanjariya
2017-08-28lib: new APIs for get/set system hostname/domainnameMitesh Kanjariya
1. Change hostname_get to cmd_hostname_get 2. Change domainname_get to cmd_domainname_get 3. New API to set domainname 3. Provide a CLI command to set domainname Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-25Handle hostname/domainname properly for FreeBSDMitesh Kanjariya
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-25Fix compilation errors for domainnameMitesh Kanjariya
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-25lib: Fix make check failuresMitesh Kanjariya
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-24lib/bgpd: provide/use API to get hostname/domainnameMitesh Kanjariya
Signed-off-by: Mitesh Kanjariya <mitesh@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-24lib: centralized memstats-at-exitDavid Lamparter
adds a new all-daemon "debug memstats-at-exit" command. Also saves memstats to a file in /tmp, useful if a long-running daemon is having weird issues (e.g. in a user install). Fixes: #437 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-10lib: Fix multi instance ospfChirag Shah
ospfd crashes upon configuring multi-instance ospf i.e 'router ospf x'. ospfd can return CMD_NOT_MY_INSTANCE which is not supported in lib/commands Support two of the error codes CMD_NOT_MY_INSTANCE and CMD_WARNING_CONFIG_FAILED Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-08-09Merge branch 'frr/pull/822' ("EVPN fixes")David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-09zebra: add support for static pseudowiresRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-08bgpd, lib, vtysh: Added support for mac filtering in route-mapsMitesh Kanjariya
1. Added support to create mac filters 2. Enabled route-map commands for EVPN address family 3. Provision to add mac filters under match clause in route-maps Ticket: CM-16349 Review: CCR-6190 Unit-test: Manual (logs attached to ticket) Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-07-31lib: s/leychain/keychainQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-27lib: correct some node name typosQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-26lib, vtysh: add `find COMMAND`Quentin Young
Substring search through all defined commands in all nodes. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-26lib: add CLI node namesQuentin Young
Adds an array of descriptive names for each CLI node, plus a runtime check to make sure folks don't forget to update it. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-22Revert "*: reindent pt. 2"David Lamparter
This reverts commit c14777c6bfd0a446c85243d3a9835054a259c276. clang 5 is not widely available enough for people to indent with. This is particularly problematic when rebasing/adjusting branches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17*: reindent pt. 2whitespace / reindent
w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
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-14Merge remote-tracking branch 'origin/master' into evpn_plus_struct_attrDonald Sharp
2017-07-14Merge remote-tracking branch 'origin/master' into evpn_plus_struct_attrDonald Sharp
2017-07-14lib, vtysh: remove now-useless newline argDavid Lamparter
It's always \n now, hooray. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14Merge remote-tracking branch 'frr/master' into newline-reduxDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14Merge pull request #808 from qlyoung/vtysh-termcolsRuss White
lib, vtysh: pretty-print variable autocompletions
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 3 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-13lib, vtysh: pretty-print variable autocompletionsQuentin Young
Pretty-prints variable autocompletions by breaking them up into multiple lines, indenting them consistently and respecting the column width of the terminal. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-12bgpd: Additional configuration for EVPNvivek
Implement configuration options for EVPN. The configuration options include VNI configuration with RD and Import and Export Route Targets. Also, display the EVPN configuration. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-07-06lib: fix more docstringsQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-01*: update hash_create(), hash_create_size()Quentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-01lib, vtysh: hashtable statisticsQuentin Young
Adds the ability to name hash tables, and a new cli command that will show various summary statistics for named hash tables. Statistics computed are - load factor - full load factor (see comments) - stddev of full load factor Standard deviation is computed by storing the sum of squares of bucket lengths. This is somewhat susceptible to overflow. On platforms where a double is 32 bits, placing 65535 or more elements into a hash table opens up the potential for overflow, depending on how they are arranged in buckets (which depends on the hash function). For example, placing 65535 elements into one hash bucket would cause ssq overflow, but distributing 40000000 elements evenly among 400000 buckets (100 elements per bucket) would not. These cases are extremely degenerate, so the vague possibility of overflow in an informational command is deemed an acceptable tradeoff for constant time calculation of variance without locks or compromising efficiency of actual table operations. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-01lib: add statistics for hash tablesQuentin Young
Adds a function that calculates various statistics on our implementation of a hash table. These are useful for evaluating performance. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
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>