summaryrefslogtreecommitdiff
path: root/lib/command.c
AgeCommit message (Collapse)Author
2016-10-07lib: add "qobj" object-ID infrastructureDavid Lamparter
This adds 64-bit random identifiers as "safe pointers" which are also type-tracked / can have type-specific extension methods. This will be used by both the CLI (to keep safe references while in config editing mode) as well as the Cap'n Proto code (to hand out pointers to the user in a safe way and add per-type handlers) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-10-06lib: Log invalid/unknown commands to log fileQuentin Young
Ticket: CM-6855 Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-06lib: Make <cr> appear first in completionsQuentin Young
When a command is complete and <cr> appears in tab- or ?-completions, make sure it appears first Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-05lib: Invalid commands are errors, fix msg formattingQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-04lib: Add logging for invalid commandsQuentin Young
Ticket: CM-6855 Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-04lib: fix password and enable password syntaxQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-03lib: Clean up completions code, fix segfault on no matchQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-03bgpd: add L3/L2VPN Virtual Network Control featureLou Berger
This feature adds an L3 & L2 VPN application that makes use of the VPN and Encap SAFIs. This code is currently used to support IETF NVO3 style operation. In NVO3 terminology it provides the Network Virtualization Authority (NVA) and the ability to import/export IP prefixes and MAC addresses from Network Virtualization Edges (NVEs). The code supports per-NVE tables. The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2 (L2) forwarding information between NVAs and NVEs is referred to as the Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For general background on NVO3 and RFP concepts see [1]. For information on Openflow see [2]. RFPs are integrated with BGP via the RF API contained in the new "rfapi" BGP sub-directory. Currently, only a simple example RFP is included in Quagga. Developers may use this example as a starting point to integrate Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code also supports the ability import/export of routing information between VNC and customer edge routers (CEs) operating within a virtual network. Import/export may take place between BGP views or to the default zebera VRF. BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN information between NVAs. BGP based IP VPN support is defined in RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659, BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use of both the Encapsulation Subsequent Address Family Identifier (SAFI) and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation Subsequent Address Family Identifier (SAFI) and the BGP Tunnel Encapsulation Attribute, are supported. MAC address distribution does not follow any standard BGB encoding, although it was inspired by the early IETF EVPN concepts. The feature is conditionally compiled and disabled by default. Use the --enable-bgp-vnc configure option to enable. The majority of this code was authored by G. Paul Ziemba <paulz@labn.net>. [1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req [2] https://www.opennetworking.org/sdn-resources/technical-library Now includes changes needed to merge with cmaster-next.
2016-10-02lib: Null-terminate tab completions char*[]Quentin Young
vtysh expects the result of a tab completion to have a null pointer as the last element Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-01lib: Fix command execution npeQuentin Young
Caller may pass NULL if it does not care about what command was matched. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-30lib, vtysh: refactor vtysh.c, allow parser continuanceQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-30lib: initialize cmd_vector and add a root node to graphQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
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>