summaryrefslogtreecommitdiff
path: root/lib/command.c
AgeCommit message (Collapse)Author
2016-09-30all: added some missing <>s within []sDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
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-25Expand #defines in command stringsDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25Expand #defines in command stringsDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: Sam Tannous <stannous@cumulusnetworks.com> Ticket:
2016-09-25Expand #defines in command stringsDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23lib: lib compilesQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-23lib: add 'int idx_foo' argv index variablesDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23lib: Implement removed ALIAS into DEFUNQuentin Young
N.B.: some of these are de-facto ALIAS resurrections that are necessary due to some parser limitations; these are marked with ALIAS_FIXME so I can go back and add capability to the parser to handle these special cases. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-23convert <1-255> to (1-255), ()s to <>s, etcDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23ldpd: adapt the code for QuaggaRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-23ALIAS removal for bgp, ospf, pim, isis, rip, ripng, lib and zebraDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-22lib: argv fixes, XFREE -> free, rm decl in matcherQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-22Revert "lib: Fixup more files"Daniel Walton
This reverts commit f68cec764abf50b35945b907a2e005bc50c50831.
2016-09-20lib: Fixup more filesDonald Sharp
2016-09-21lib: Update copyright headersQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-20Merge remote-tracking branch 'origin/cmaster-next' into vtysh-grammarDonald Sharp
2016-09-21Merge branch 'cmaster-next' into vtysh-grammarQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: lib/.gitignore lib/command.c lib/command.h
2016-09-19lib: Initial refactor pass on CLI backendQuentin Young
Shotgun commit: * Remove shim sources from Makefile.am * Move new types to command.c / command.h * Rewrite command.c / command.h * Refactor shim types to real types in matcher and parser * Initial refactor pass on vty.c Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-19*: split & distribute memtypes and stop (re|ab)using lib/ MTYPEsDavid Lamparter
This is a rather large mechanical commit that splits up the memory types defined in lib/memtypes.c and distributes them into *_memory.[ch] files in the individual daemons. The zebra change is slightly annoying because there is no nice place to put the #include "zebra_memory.h" statement. bgpd, ospf6d, isisd and some tests were reusing MTYPEs defined in the library for its own use. This is bad practice and would break when the memtype are made static. Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> [CF: rebased for cmaster-next] Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-09-09lib: Fix tab completions memleak, memory stats corruptionQuentin Young
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-09lib, vtysh: support multiple VRFs by using linux netnsFeng Lu
We realize VRFs with linux netns by default. The main job is to associate a VRF with a netns. Currently this is done by the configuration: [no] vrf N netns <netns-name> This command is also available in vtysh and goes to only zebra, because presently only zebra supports multiple VRF. A file descriptor is added to "struct vrf". This is for the associated netns file. Once the command "vrf N netns NAME" is executed, the specified file is opened and the file descriptor is stored in the VRF N. In this way the association is formed. In vrf_socket(), we first switch to the specified VRF by using the stored file descriptor, and then can allocate a socket which is working in the associated netns. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> (cherry picked from commit 55cfa2f190620f7c711944637659bc208970324d)
2016-09-07lib: Continue matching system refactorQuentin Young
Most things back to working, all CLI units refactored to use improved graph implementation. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-03Update Traffic Engineering Support for OSPFDOlivier Dugeon
NOTE: I am squashing several commits together because they do not independently compile and we need this ability to do any type of sane testing on the patches. Since this series builds together I am doing this. -DBS This new structure is the basis to get new link parameters for Traffic Engineering from Zebra/interface layer to OSPFD and ISISD for the support of Traffic Engineering * lib/if.[c,h]: link parameters struture and get/set functions * lib/command.[c,h]: creation of a new link-node * lib/zclient.[c,h]: modification to the ZBUS message to convey the link parameters structure * lib/zebra.h: New ZBUS message Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add support for IEEE 754 format * lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to safely convert between big-endian IEEE-754 single and double binary format, as used in IETF RFCs, and C99. Implementation depends on host using __STDC_IEC_559__, which should be everything we care about. Should correctly error out otherwise. * lib/network.[c,h]: Add ntohf and htonf converter * lib/memtypes.c: Add new memeory type for Traffic Engineering support Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add link parameters support to Zebra * zebra/interface.c: - Add new link-params CLI commands - Add new functions to set/get link parameters for interface * zebra/redistribute.[c,h]: Add new function to propagate link parameters to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering. * zebra/redistribute_null.c: Add new function zebra_interface_parameters_update() * zebra/zserv.[c,h]: Add new functions to send link parameters Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add support of new link-params CLI to vtysh In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue to use the ordered version for adding line i.e. config_add_line_uniq() to print Interface CLI commands as it completely break the new LINK_PARAMS_NODE. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Update Traffic Engineering support for OSPFD These patches update original code to RFC3630 (OSPF-TE) and add support of RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support of RFC6827 (ASON - GMPLS). * ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering * ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392 * ospfd/ospf_packet.c: Update checking of OSPF_OPTION * ospfd/ospf_vty.[c,h]: Update ospf_str2area_id * ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get Link Parameters information from the interface to populate Traffic Engineering metrics * ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN) * ospfd/ospf_te.[c,h]: Major modifications to update the code to new link parameters structure and new RFCs Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> tmp
2016-08-17Fix for CM-12450 Ensure quagga logs at startup are sent to syslog (until log ↵Sid Khot
configuration is processed) Ticket: CM-12450 Reviewed By: CCR-5112 Testing Done: Manual
2016-08-10lib: Remove debug fprintf for cmd_element copyQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-07-29lib: Cleanup some memory issues in CLIQuentin Young
Various memory leaks have been fixed and the quagga memory macros are in use. Also consolidated the argv and matching code into one graph traversal. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-07-28lib: 'show commandtree' is not a CLI commandDonald Sharp
The 'show commandtree' command was added to the CONFIG_NODE. We have a basic assumption that CONFIG_NODE commands actually change state. 'show commandtree' doesn't meet this requirement. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-24Revert "lib: Rewrite ipv4 address and prefix validator"David Lamparter
This reverts commit d4dc41b6a23d5156b0d9068006a1eeb3ba32e301. The rewritten parser fails to recognise "1.2." as partial input for an IPv4 address, which causes "make check" to fail. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-26lib: Free memory correctly when braces used in parserDon Slice
When braces (optional parameters) are used in the quagga parser, there was a small leak on every iteration. Since this construct is primarily used in the configuation process rather than show commands, it was not readily apparent. With the addition of the "show ip bgp {json}" form of the commands, each time one was run, memory was leaked. Ticket: CM-11435 Signed-off-by: Don Slice Reviewed By: Donald Sharp Testing Done: Manual testing, bgp-min and bgp-smoke successful
2016-07-22lib: Modify 'banner motd file <X>'Donald Sharp
Modify the banner motd file X command to do these things differently: 1) Only allow the file <X> to be in SYSCONFDIR 2) Only allow the user to use a file that exists. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
2016-07-19lib: Break up functions, begin matcherQuentin Young
Moved test hook out of command.c into vtysh.c, renamed graph modules, added matching code Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-07-12lib: Cleanup cmd_execute_commandQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-07-12Add grammar sandbox frameworkQuentin Young
2016-07-12lib: Rewrite ipv4 address and prefix validatorQuentin Young
Simplify ipv4 prefix and address matcher / validator to use standard Linux networking functions instead of a state machine. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-07-12lib: Disallow % in IPv6 addresses and prefixesQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-07-12lib: Rewrite ipv6 prefix matcherQuentin Young
Simplify ipv6 prefix matcher / validator to use standard Linux networking functions instead of a state machine. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-06-23lib: Add documentation to internal command format parser functionsQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-06-16lib: Clean command.cQuentin Young
Removed dead code paths and fixed a typo. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-06-11bgpd, lib, vtysh: hook up bgp ENCAP CLI nodeLou Berger
Signed-off-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit a3fda886cdd48b6d8c421ebb1401142fa9ee93b0) Conflicts: bgpd/bgp_vty.c bgpd/bgpd.c vtysh/vtysh_config.c
2016-06-08lib/vty: add separate output fd support to VTYsDavid Lamparter
to be used with stdin/stdout terminals, this adds support for writing to a different FD than we're reading from. Also fixes error messages from config load being written to stdin. [v2: fixed config write] Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 4715a53b4d390e72a06c864a6a505971841e3dc9)
2016-06-08lib: assert(0) still needs a returnDavid Lamparter
assert(0) is not guaranteed to not return since assert() in general can be optimised out when building without debug / with optimisation. This breaks the build in clang, which warns/errors about the missing return. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit f1fc327c7eb00634d2c2b08c2a6f6e44a626ef04)
2016-06-08lib: fix "reduce strcmp in CLI" fallout (10bac801)David Lamparter
In "lib/cli: reduce strcmp in CLI hot paths", I failed to notice that CMD_VARIABLE as a boolean test covers a superset of the other types of variables. Thus, the patch broke processing of IP/IPv6/Integer range parameters in the CLI. Fix by some reordering and introducing TERMINAL_RECORD macro (which marks whether a given terminal type is a parameter) to be used in places where the check is really for all kinds of variables. Reported-by: Timo Teräs <timo.teras@iki.fi> Tested-by: Martin Winter <mwinter@netdef.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-06-08lib/cli: reduce strcmp in CLI hot pathsDavid Lamparter
Er, no idea how anyone could ever have thought that it would be a good idea to have a zillion of strcmp() calls in the CLI's active paths, just to compare against things like "A.B.C.D". Reduces 40k prefix list load time from 1.65s to 1.23s (1.34:1). Acked-by: Paul Jakma <paul@jakma.org> [v2: killed CMDS_* macros] Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 10bac80195cf5a781da6e4415e6580fd7080f734)
2016-06-07*: add/cleanup initialisersDavid Lamparter
There were some (inconsequential) warnings about uninitialised use of variables. Also, in one case, sub-structs were mixed in initialisation, which doesn't quite work as intended. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-06-06bgpd, lib, vtysh: hook up bgp VPNv6 CLI nodevivek
Signed-off-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 13c378d96a57017f5995b2e0df46cfc31123f0e8) Conflicts: bgpd/bgp_vty.c bgpd/bgpd.c vtysh/vtysh_config.c
2016-06-06lib: add "show commandtree" CLI commandLou Berger
Signed-off-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit f9ec4190f1eaf2dba355a9808bca8d7148bc8a55)
2016-06-06lib: fix bookkeeping for libreadline malloc()sLou Berger
When libreadline is used, we mistakenly mix in strdup() done in libreadline with Quagga's lib/memory bookkeeping/counting, leading to counter underflows on MTYPE_TMP. Signed-off-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 672900382d47137638086bd8351b2678f589a546) Conflicts: lib/command.c
2016-05-29Quagga: Fix code to use srandom/randomDonald Sharp
Quagga was using a mix of srand/rand and srandom/random. Consolidate to use srandom/random which are the POSIX versions of random number generators Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-03build: track config argsDavid Lamparter
Record the ./configure arguments used and make them user-visible. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Paul Jakma <paul@jakma.org>