summaryrefslogtreecommitdiff
path: root/lib/command.c
AgeCommit message (Collapse)Author
2018-08-14*: rename zlog_fer -> flog_errQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14lib: Add LIB_ERR_SYSTEM_CALL and convert VRF_SOCKET to SOCKETDonald Sharp
Add a new error code LIB_ERR_SYSTEM_CALL to the ferr subsystem. Additionally convert LIB_ERR_VRF_SOCKET to a more generic LIB_ERR_SOCKET. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14Merge branch 'master' into bfd-finalDonald Sharp
2018-08-11*: ALLOC calls cannot failDonald Sharp
There is no need to check for failure of a ALLOC call as that any failure to do so will result in a assert happening. So we can safely remove all of this code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-08bfdd: add vty shell commandsRafael Zalamena
Implement vty shell integration and allow `bfdd` to be configured through FRR's vtysh. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-06-26Merge pull request #2503 from ↵Quentin Young
pacovn/Coverity_1469898_Uninitialized_scalar_variable lib: uninitialized variable (2) (Coverity 1469898)
2018-06-25*: remove deprecated 'log trap' commandsQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-22lib: null check (Coverity 1470150)paco
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-22lib: uninitialized variable (2) (Coverity 1469898)paco
Previous correction (2c2d5cb397c140c05ad81e8c79273bd3af13b595) was not enough, so now it is ensured that the argument shift is not negative nor zero. Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-19lib: Add --log-level to daemonsDonald Sharp
Add the ability to specify the designated log level at startup. --log-level <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-19lib: Add new cli to specify where to output logs on startupDonald Sharp
When we are starting a daemon, allow the user to specify: --log <stdout|syslog|file:file_name> This can be used on early startup to put the log files where the end user wants them to show up. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-12lib: null return value check (Coverity 1469894)paco
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-06lib: fix output mangling with | includeQuentin Young
Sometimes output would be mangled when filtering with include as a result of the following bugs: * Filters were applied per each call to vty_out() instead of buffering until a line break and then applying * Long output would sometimes be cut due to using the wrong buffer pointer Also remove the trailing \n as it should no longer be necessary to ensure the vty prompt ends up on a new line. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06lib: add vector_compact(), use after str splitsQuentin Young
* Add function to move all data to the start of a vector by shifting over contiguous empty slots * Use this function to remove empty slots leftover after frrstr_filter_vec Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06lib: fix static analysis issues, use regfree()Quentin Young
* Fix potential NULL dereference * Fix use of uninitialized value * Fix leaking memory by not freeing regex_t * Fix extra \n when using empty regex filter * Clean up still-reachable hook memory * Handle nonexistent pager Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06lib: add vector_remove() to vector.[ch]Quentin Young
An optimized version of this has already been implemented within graph.c that assumes some specialized constraints for that code. It's generally useful so this change implements a general purpose version of it. This fixes cmd_make_strvec() that was broken by some code shuffling in previous commits. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06*: style for | supportQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06vtysh: add | supportQuentin Young
* Rewrite pager implementation * Replace fprintf() with vty_out() * Modify vty_out() for better vtysh support * Remove static global outputfile var * Remove fp argument from many vtysh functions * Add some docs for stuff along the way Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06lib: add cli preprocessor for `|` actionsQuentin Young
This patch adds a CLI preprocessor function that activates when `|` is found in the command. This is the start of adding support for some text processing utilities intended for inline use. The first one implemented here is `| include`, which provides grep-like filtering of command output. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06lib: add hook for preprocessing commandsQuentin Young
This patch adds a hook point intended to allow subscribers to modify the raw text of a CLI command before it is passed to the rest of the CLI pipeline. To give access to the raw text of the command, a new function for executing CLI has been defined whose only difference from `cmd_execute_command` is that it accepts the command to execute as a string rather than as a string vector. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06lib: add string utilitiesQuentin Young
I see lots of the same code being copy-pasted and slightly tweaked for string processing all over the codebase. Time to start aggregating these pieces into something consistent and correct. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-05-13lib: Moved no-password warnings into header filePascal Mathis
The warning string which appears when the users executes 'no (enable) password' was moved into command.h and declared as a constant named 'NO_PASSWD_CMD_WARNING'. This avoids duplicate code and makes it easy to change the warning message in all places at once. Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-12lib: Improved warnings for 'no (enable) password'Pascal Mathis
When the user executes one of the commands 'no password' or 'no enable password', a warning message gets shown to inform the user of the security implications. While the current implementation works, a warning message gets printed once for each daemon, which can lead to seeing the same message many times. This does not affect functionality, but looks like an error to the user as it can be seen within issue #1432. This commit only prints the warning message inside lib when vtysh dispatch is not being used. Additionally, the warning message was copied into the vtysh command handlers, so that they get printed exactly once. Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-12Merge pull request #2132 from donaldsharp/missed_stuffRuss White
Missed stuff
2018-05-11lib: Ported 'no (enable) password' from stable/3.0Pascal Mathis
The pull request #1545 from @donaldsharp introduced the command 'no password' to remove an existing terminal connection password. Additionally, warnings have been added to both 'no password' and 'no enable password' to make the user aware of any security implications. It seems that this specific pull request was never merged against master and got lost. This commit is a cherry-pick of d4961273cb with fixed conflicts and updated documentation. Thanks to @donaldsharp and @pogojotz for the original PR. Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-08lib: Fix bad functionDonald Sharp
Fix the decleration of a function to be better. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-08bgpd, lib, zebra: Cleanup formatting issues foundDonald Sharp
Cleanup the formating issues found. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-08watchfrr always writes 'log syslog informational' to the configDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Dave Olson <olson@cumulusnetworks.com> Ticket: CM-16501
2018-05-08lib: move ip node above vrf node for config orderQuentin Young
VRF static route commands adopt global static config if static config is placed after a vrf context with no separator, workaround by always writing static route config before vrf config Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-05-01lib: allow hostname to begin with a letter or numberDon Slice
Customers have requested the ability to name their devices starting with a number instead of a letter. This fix changes the check for hostname to allow either a letter or a number. Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
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-04-06pbrd: Add PBR to FRRDonald Sharp
This is an implementation of PBR for FRR. This implemenation uses a combination of rules and tables to determine how packets will flow. PBR introduces a new concept of 'nexthop-groups' to specify a group of nexthops that will be used for ecmp. Nexthop-groups are specified on the cli via: nexthop-group DONNA nexthop 192.168.208.1 nexthop 192.168.209.1 nexthop 192.168.210.1 ! PBR sees the nexthop-group and installs these as a default route with these nexthops starting at table 10000 robot# show pbr nexthop-groups Nexthop-Group: DONNA Table: 10001 Valid: 1 Installed: 1 Valid: 1 nexthop 192.168.209.1 Valid: 1 nexthop 192.168.210.1 Valid: 1 nexthop 192.168.208.1 I have also introduced the ability to specify a table in a 'show ip route table XXX' to see the specified tables. robot# show ip route table 10001 Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, P - PIM, E - EIGRP, N - NHRP, T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR, > - selected route, * - FIB route F>* 0.0.0.0/0 [0/0] via 192.168.208.1, enp0s8, 00:14:25 * via 192.168.209.1, enp0s9, 00:14:25 * via 192.168.210.1, enp0s10, 00:14:25 PBR tracks PBR-MAPS via the pbr-map command: ! pbr-map EVA seq 10 match src-ip 4.3.4.0/24 set nexthop-group DONNA ! pbr-map EVA seq 20 match dst-ip 4.3.5.0/24 set nexthop-group DONNA ! pbr-maps can have 'match src-ip <prefix>' and 'match dst-ip <prefix>' to affect decisions about incoming packets. Additionally if you only have one nexthop to use for a pbr-map you do not need to setup a nexthop-group and can specify 'set nexthop XXXX'. To apply the pbr-map to an incoming interface you do this: interface enp0s10 pbr-policy EVA ! When a pbr-map is applied to interfaces it can be installed into the kernel as a rule: [sharpd@robot frr1]$ ip rule show 0: from all lookup local 309: from 4.3.4.0/24 iif enp0s10 lookup 10001 319: from all to 4.3.5.0/24 iif enp0s10 lookup 10001 1000: from all lookup [l3mdev-table] 32766: from all lookup main 32767: from all lookup default [sharpd@robot frr1]$ ip route show table 10001 default proto pbr metric 20 nexthop via 192.168.208.1 dev enp0s8 weight 1 nexthop via 192.168.209.1 dev enp0s9 weight 1 nexthop via 192.168.210.1 dev enp0s10 weight 1 The linux kernel now will use the rules and tables to properly apply these policies. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: Don Slice <dslice@cumulusnetworks.com> Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-03lib: remove IRDP_NODEQuentin Young
Unused Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-02Merge pull request #2005 from qlyoung/remove-masc-nodeRafael Zalamena
lib: remove MASC_NODE
2018-03-30lib: remove MASC_NODEQuentin Young
Unused Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-30lib: remove SERVICE_NODEQuentin Young
Unused Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-30bgpd: add flowspec featurejaydom
This work is derived from a work done by China-Telecom. That initial work can be found in [0]. As the gap between frr and quagga is important, a reworks has been done in the meantime. The initial work consists of bringing the following: - Bringing the client side of flowspec. - the enhancement of address-family ipv4/ipv6 flowspec - partial data path handling at reception has been prepared - the support for ipv4 flowspec or ipv6 flowspec in BGP open messages, and the internals of BGP has been done. - the memory contexts necessary for flowspec has been provisioned In addition to this work, the following has been done: - the complement of adaptation for FS safi in bgp code - the code checkstyle has been reworked so as to match frr checkstyle - the processing of IPv6 FS NLRI is prevented - the processing of FS NLRI is stopped ( temporary) [0] https://github.com/chinatelecom-sdn-group/quagga_flowspec/ Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: jaydom <chinatelecom-sdn-group@github.com>
2018-03-19bgpd: new vpn-policy CLIG. Paul Ziemba
PR #1739 added code to leak routes between (default VRF) VPN safi and unicast RIBs in any VRF. That set of changes included temporary CLI including vpn-policy blocks to specify RD/RT/label/&c. After considerable discussion, we arrived at a consensus CLI shown below. The code of this PR implements the vpn-specific parts of this syntax: router bgp <as> [vrf <FOO>] address-family <afi> unicast rd (vpn|evpn) export (AS:NN | IP:nn) label (vpn|evpn) export (0..1048575) rt (vpn|evpn) (import|export|both) RTLIST... nexthop vpn (import|export) (A.B.C.D | X:X::X:X) route-map (vpn|evpn|vrf NAME) (import|export) MAP [no] import|export [vpn|evpn|evpn8] [no] import|export vrf NAME User documentation of the vpn-specific parts of the above syntax is in PR #1937 Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-09lib: add new BGP VPN policy command nodeG. Paul Ziemba
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-09lib, vtysh: Start cli for nexthop-groupDonald Sharp
Signed-off-by: Donald Sharp <sharpd@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-03-06Merge pull request #1728 from mkanjari/evpn-bug-fixesPhilippe Guibert
Evpn bug fixes
2018-02-27lib: split logicalrouter and vrf netns featurePhilippe Guibert
This split is introducing logicalrouter.[ch] as the file that contains the vty commands to configure logical router feature. The split has as consequence that the backend of logical router is linux_netns.c formerly called ns.c. The same relationship exists between VRF and its backend which may be linux_netns.c file. The split is adapting ns and vrf fiels so as to : - clarify header - ensure that the daemon persepctive, the feature VRF or logical router is called instead of calling directly ns. - this implies that VRF will call NS apis, as logical router does. Also, like it is done for default NS and default VRF, the associated VRF is enabled first, before NETNS is enabled, so that zvrf->zns pointer is valid when NETNS discovery applies. Also, other_netns.c file is a stub handler that will be used for non linux systems. As NETNS feature is only used by Linux, some BSD systems may want to use the same backend API to benefit from NETNS. This is what that file has been done. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-02-08vtysh/lib: write domainname to config fileMitesh Kanjariya
Ticket: CM-19626 Review: CCR-7170 Testing: Manual Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-02-02*: silence '-Wchar-subscripts' warnings on NetBSDRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-01-30lib, pimd: Remove PIM_NODE as it is not neededDonald Sharp
The PIM_NODE command is only being used to display default vrf configuration. Move this into the vrf display and remove PIM_NODE. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-11-13Merge pull request #1436 from rtrlib/rpkiDonald Sharp
bgpd: Add RPKI/RTR support
2017-11-12lib: Fix command `copy running-config startup-config` to alias `write file`pogojotz
Fixes: #1412 Signed-off-by: Juergen Werner <pogojotz@gmx.net>
2017-11-10bgpd: Add RPKI/RTR supportMarcel Röthke
This commit adds support for the RTR protocol to receive ROA information from a RPKI cache server. That information can than be used to validate the BGP origin AS of IP prefixes. Both features are implemented using [rtrlib](http://rtrlib.realmv6.org/). Signed-off-by: Marcel Röthke <marcel.roethke@haw-hamburg.de>
2017-10-24*: add missing \n in some help stringsRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>