Commit Graph

749 Commits

Author SHA1 Message Date
Quentin Young
7d3ffd35ea
lib: remove MASC_NODE
Unused

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-30 17:45:41 -04:00
Quentin Young
f108d4873d
lib: remove SERVICE_NODE
Unused

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-30 16:29:51 -04:00
Quentin Young
16d6ea59d3
lib, vtysh: vrf walkup bugfix
Static route commands are now installed inside the VRF nodes. This has
quietly broken top-level static routes in certain scenarios due to
walkup logic resolving a static route configuration command inside
VRF_NODE first if the command is issued while in a CLI node lower than
VRF_NODE. To fix this VRF_NODE needs a special exit command, as has been
done for many other nodes with the same issue, to explicitly change the
vrf context to the default VRF so that when walkup resolves against the
VRF node it will configure against the default VRF as desired.

Of course this is a hack on top of a hack and the CLI walkup
implementation needs to be rewritten.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-30 13:14:34 -04:00
Russ White
d989640c0a
Merge pull request #1978 from qlyoung/fix-debug-all-vtysh-node
vtysh: fix node install of `[no] debug all`
2018-03-30 10:44:14 -04:00
Philippe Guibert
e7d78d0f2c vtysh: add flowspec address family cmd support
add flowspec v4 and flowspec v6 address family support for BGP.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-30 14:01:06 +02:00
Quentin Young
eb68fbc613
vtysh: fix node install of [no] debug all
Command belongs in ENABLE_NODE, not VIEW_NODE.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-28 10:57:52 -04:00
Lou Berger
186f6af280 vtysh: move user_mode to header file, keep checkpatch happy
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-28 10:47:34 -04:00
Lou Berger
86b286101b vtysh: add -u/--user flag to run commands without enable
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-28 10:47:34 -04:00
Quentin Young
d7c0a89a3a
*: use C99 standard fixed-width integer types
The following types are nonstandard:
- u_char
- u_short
- u_int
- u_long
- u_int8_t
- u_int16_t
- u_int32_t

Replace them with the C99 standard types:
- uint8_t
- unsigned short
- unsigned int
- unsigned long
- uint8_t
- uint16_t
- uint32_t

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-27 15:13:34 -04:00
Quentin Young
470bc61919
watchfrr, vtysh: do not write config during crash
If a daemon is restarting, crashed, or otherwise in the process of
reconnecting to watchfrr and a user issues "write memory" or "write
file" the resulting config will not include the configuration of that
daemon. This is problematic because this output will overwrite the
previous config, potentially causing unintentional loss of configuration
stored only in the config file based upon timing.

This patch remedies that by making watchfrr check that all daemons are
up before attempting a configuration write, and updating vtysh so that
its failsafe respects this condition as well.

Note that this issue only manifests when using integrated config.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-21 03:11:02 -04:00
G. Paul Ziemba
b9c7bc5ab0 bgpd: new vpn-policy CLI
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-19 22:13:43 -07:00
paulzlabn
3f1224cd1a
Merge branch 'master' into working/master/bgp-vpn-vrf-leaking 2018-03-14 13:31:58 -07:00
Lou Berger
b86543b804 vtysh: restore some DEFUNs that should not have been reformated by indent.py 2018-03-13 05:46:03 -04:00
G. Paul Ziemba
fd9b55a2b7 vtysh: add bgpd vpn-policy nodes
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-09 16:42:40 -05:00
Donald Sharp
dba32923eb lib, vtysh: Start cli for nexthop-group
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09 11:07:41 -05:00
Renato Westphal
c67667e74c
Merge pull request #1808 from qlyoung/debug-mt-safe
MT-safe debug facilities
2018-03-09 11:25:37 -03:00
Lou Berger
996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
Quentin Young
ce08776d95
Merge pull request #1833 from opensourcerouting/fix-vtysh-output-init
vtysh: initialize vty structure correctly for output to terminal
2018-03-06 11:47:47 -05:00
Philippe Guibert
6dfe83b8f7
Merge pull request #1728 from mkanjari/evpn-bug-fixes
Evpn bug fixes
2018-03-06 17:27:10 +01:00
Christian Franke
4a9746fdd0 vtysh: initialize vty structure correctly for output to terminal
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-03-06 01:37:49 +01:00
Quentin Young
aea03ad6e8
lib: add mt-safe debugging facilities
The current strategy for fine-grained debugging across FRR is to use
static long int bitfields, in combination with helper macros that are
copy-pasted between daemons, to hold state on what debugging information
should be collected at any given time. This has a couple of problems:

* These bitfields are generally extern'd and accessed everywhere, so
  they are not MT-safe or easy to make MT-safe
* Lots of code duplication from copy-pasting the DEBUG_* macros...
* Code duplication because of the "term" vs "conf" debugging concept

This patch aims to remedy that by providing some infrastructure to work
with debugs. The core concept of using bitfields has been retained, but
the number of these for each debug has been reduced to 1. This allows
easy use of lock-free methods for synchronizing access to debugging
info.

The helper macros have also been retained but they are now collected in
one place and perform exclusively atomic operations.

Finally there is a bit of code that allows daemons to register
callbacks, which I used to implement a command that will toggle all
debugging for any daemons that use these facilities.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-01 15:01:25 -05:00
Christian Franke
546067dfb1 vtysh: Fix missing \n at end of desc string 2018-02-27 15:34:23 +01:00
Christian Franke
1753f727b7 vtysh: pass route-map & prefix-list commands to isisd and sharpd
Use VTYSH_RMAP in extract.pl instead of having two lists,
and add isisd and sharpd to VTYSH_RMAP.
2018-02-27 15:34:21 +01:00
Mitesh Kanjariya
00cbfad6de
Merge branch 'master' into evpn-bug-fixes 2018-02-27 02:47:36 -08:00
Philippe Guibert
f5d20fdb4e vtysh: change logical router node name
The logical router node goes from NS_NODE to LOGICALROUTER_NODE.
Vty commands are renamed accordingly.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-02-27 11:11:24 +01:00
Quentin Young
ddb3dcc733
vtysh: .history_quagga --> .history_frr
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-02-23 12:40:57 -05:00
Mladen Sablic
4d9ad5dcd0 pimd: Multicast traceroute client and router
This commit is the implementation of weak multicast traceroute.
It consists of IGMP module dealing with mtrace type IGMP messages
and client program mtrace/mtracebis for initiating mtrace queries.

Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2018-02-19 23:13:55 +01:00
Mitesh Kanjariya
3b103fec6b vtysh/lib: write domainname to config file
Ticket: CM-19626
Review: CCR-7170
Testing: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-02-08 23:04:05 -08:00
Philippe Guibert
8e71b98f72
Merge pull request #1654 from mkanjari/evpn-symm-routing-enhancements
Evpn symmetric routing enhancements
2018-02-08 11:46:29 +01:00
Donald Sharp
cfb8a47f81
Merge pull request #1653 from Orange-OpenSource/SR-Routing
OSPFD: Add Experimental Segment Routing support
2018-02-06 11:32:51 -05:00
Renato Westphal
a7ce0ad1da *: silence '-Wchar-subscripts' warnings on NetBSD
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-02-02 16:31:20 -02:00
Olivier Dugeon
dab8b7a81c Merge remote-tracking 'frr/master' into SR-Routing 2018-01-30 11:43:25 +01:00
vivek
1d72e48aff lib: Display configured VRFs
Ensure that configured VRFs are displayed in the running configuration.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Mitesh Kanjariya <mkanjariya@cumulusnetworks.com>

Ticket: CM-10139
Reviewed By: CCR-7012
Testing Done: Verify failed test scenario
2018-01-23 16:24:39 -08:00
Olivier Dugeon
cf9b9f77f6 OSPFD: Add Experimental Segment Routing support
This is an implementation of draft-ietf-ospf-segment-routing-extensions-24
and RFC7684 for Extended Link & Prefix Opaque LSA.
Look to doc/OSPF_SR.rst for implementation details & known limitations.

New files:

 - ospfd/ospf_sr.h: Segment Routing structure definition (SubTLVs + SRDB)
 - ospfd/ospf_sr.c: Main functions for Segment Routing support
 - ospfd/ospf_ext.h: TLVs and SubTLVs definition for RFC7684
 - ospfd/ospf_ext.c: RFC7684 Extended Link / Prefix implementation
 - doc/OSPF-SRr.rst: Documentation

Modified Files:

 - doc/ospfd.texi: Add new Segment Routing CLI command definition
 - lib/command.h: Add new string command for Segment Routing CLI
 - lib/mpls.h: Add default value for SRGB
 - lib/route_types.txt: Add new OSPF Segment Routing route type
 - ospfd/ospf_dump.[c,h]: Add OSPF SR debug
 - ospfd/ospf_memory.[c,h]: Add new Segment Routing memory type
 - ospfd/ospf_opaque.[c,h]: Add ospf_sr_init() starting function
 - ospfd/ospf_ri.c: Add new functions to Set/Get Segment Routing TLVs
Add new ospf_router_info_lsa_upadte() to send Opaque LSA to ospf_sr.c()
 - ospfd/ospf_ri.h: Add new Router Information SR SubTLVs
 - ospfd/ospf_spf.c: Add new scheduler when running SPF to trigger
update of NHLFE
 - ospfd/ospfd.h: Add new thread for Segment Routing scheduler
 - ospfd/subdir.am: Add new files
 - vtysh/Makefile.am: Add new ospf_sr.c file for vtysh
 - zebra/kernel_netlink.c: Add new OSPF_SR route type
 - zebra/rt_netlink.[c,h]: Add new OSPF_SR route type
 - zebra/zebra_mpls.h: Add new OSPF_SR route type

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2018-01-18 19:11:11 +01:00
Russ White
7c0c85a2eb
Merge pull request #1634 from qlyoung/vtysh-output-file
vtysh: add ability to output to file
2018-01-16 15:31:50 -05:00
Quentin Young
193a5a9579
vtysh: add ability to output to file
Add ability to set file destination for all vtysh output, with the
exception of tab-complete and similar meta output. This is useful for
inline recording of some information without exiting the shell.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-12 12:38:45 -05:00
Quentin Young
08ee8e2231
vtysh: optimize printout routine
When printing responses from a client, vtysh searches through every
response it receives twice. Once is to look for the terminating
sequence and the other is to translate \n to \0, which is used with the
line processing callback capability. However:

* There's no need to search all of the output for the terminator, we can
  just check the last 4 bytes.
* In most scenarios we won't have a callback. Therefore we don't need to
  process the output and can just dump it.

Together these optimizations have a significant impact on the total
runtime of talkative CLI commands, such as `sh ip bgp json` which runs
roughly 1000% faster when dumping 1,000,000 routes.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-08 16:55:36 -05:00
Renato Westphal
895352efd8
Merge pull request #1445 from donaldsharp/rpki_vtysh
vtysh: If RPKI is not compiled in don't let vtysh think it is.
2017-11-28 14:44:39 -02:00
Donald Sharp
8a71d93d85 sharpd: Add Super Happy Advanced Routing Protocol
Add a daemon that will allow us to test the zapi
as well as test route install/removal times from
the kernel.

The current commands are:

install route <starting ip address> nexthop <nexthop> (1-1000000)

This command starts installing at <starting ip address>/32
(1-100000) routes that it auto-increments by 1
Installation start time is noted in the log and finish
time is noted as well.

remove routes <starting ip address> (1-1000000)

This command removes routes at <starting ip address>/32
and removes (1-100000) routes created by the install route
command.

This code can be considered experimental and *is not*
something that should be run in a production environment.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-11-27 09:16:30 -05:00
Donald Sharp
23489cb09c vtysh: If RPKI is not compiled in don't let vtysh think it is.
The RPKI code can be turned on/off via configure switches.
If we have intentionally turned it off do not let vtysh
display that you can config it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-11-14 09:25:04 -05:00
Marcel Röthke
dabecd7c63 bgpd: Add RPKI/RTR support
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-11-10 14:37:52 +01:00
Quentin Young
9320658c0d
vtysh: protect null deref for cli completions
cmd_describe_command() returns NULL when there is no matched command, so
check the return value before trying to free it

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-02 11:53:24 -04:00
Renato Westphal
80c872f699 vtysh: properly fix memory leak
Commit 44f12f20 fixed the memory leak in the wrong way and introduced a
"uninitialized variable" warning.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-25 07:56:42 -02:00
Renato Westphal
cbb65f5ef5 *: fix coverity warnings - error handling issues
Ignore the return value of some functions in the places we know they
can't fail, and other small fixes.

Regarding the change in bgpd/rfapi/rfapi_rib.c, asserting that
rfapiRaddr2Qprefix() didn't fail is the common idiom inside the rfapi
code.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-24 19:30:30 -02:00
Renato Westphal
44f12f209f *: fix coverity warnings - resource leaks
These are mostly trivial fixes for leaks in the error path of some functions.

The changes in bgpd/bgp_mpath.c deserves a bit of explanation though. In
the bgp_info_mpath_aggregate_update() function, we were allocating memory
for the lcomm variable but doing nothing with it. Since the code for
communities, extended communities and large communities is pretty much
the same in this function, it's clear that this was a copy and paste
error where most of the ext. community code was copied but not all of
it as it should have been.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-24 19:30:30 -02:00
Vincent JARDIN
47402c0f91 vtysh: fix clang warning
cmd->line shall never be null for these sections.

Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-10-08 23:48:55 +02:00
Lou Berger
76ae8092db Merge pull request #1264 from donaldsharp/linklist
Linklist api cleanup
2017-10-05 14:57:05 -04:00
Donald Sharp
affe9e9983 *: Convert list_delete(struct list *) to ** to allow nulling
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-10-05 10:53:13 -04:00
Donald Sharp
a3c1db5e1d vtysh: Fix ordering of multicast boundary command
The multicast boundary command must be shown after
the `ip pim sm` command.  So add a new config_add_line_end
and make it the last one.

Signed-off-by: Donald Sharp <sharp@cumulusnetworks.com>
2017-10-05 10:33:42 -04:00
Chirag Shah
b5a8894de6 ospfd: OSPFv2 VRF Support
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-03 09:15:19 -07:00
Jafar Al-Gharaibeh
98e6d77f93 Merge pull request #1259 from qlyoung/vtysh-warn-mi
vtysh: 'x not running' redux
2017-10-02 15:19:21 -05:00
Quentin Young
91fd1b8d9c
vtysh: more multi-instance fixing
Preexisting code to detect commands targeted at wrong instance didn't
work because a command applied to a disconnected vtysh_client counted as
a successful run overriding wrong instance error message

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-09-28 14:01:05 -04:00
Quentin Young
2a19199407
vtysh: 'x not running' redux
when warning about daemons that are not running, make sure to handle the
multi instance case

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-09-27 11:36:22 -04:00
Quentin Young
e82314b1bf
vtysh: remove extra / in config path
before:

frrdev# do wr
Note: this version of vtysh never writes vtysh.conf
Building Configuration...
Integrated configuration saved to /etc/frr//frr.conf
[OK]
frrdev#

after:

frrdev# do wr
Note: this version of vtysh never writes vtysh.conf
Building Configuration...
Integrated configuration saved to /etc/frr/frr.conf
[OK]
frrdev#

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-09-26 22:41:47 -04:00
Donald Sharp
07d3f521d2 vtysh: Remove double display of daemon info for 'show debugging'
When entering 'show debugging' we were outputting a line
from vtysh and a line from an individual daemon to show
the fact we were debugging.  A bit overkill.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-26 16:28:08 -04:00
Quentin Young
cde69cc294
vtysh: warn on cli targeting non-running daemon
Presently CLI entered for daemons which are not running is accepted
quietly, which can be confusing for users. This patch warns about it
when possible.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-09-18 12:35:10 -04:00
David Lamparter
cbd1fec331 Merge pull request #1105 from qlyoung/fixup-hashtable-stats-aaa
vtysh: complete 40818cec
2017-09-07 11:34:18 +02:00
Quentin Young
bd29d4638b
vtysh: fix pathspace
It didn't work

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-09-06 17:33:40 -04:00
Quentin Young
44deef01e6
vtysh: complete 40818cec
I missed this in review; the old vtysh command should have been removed
when adding the new one.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-09-05 11:52:49 -04:00
Quentin Young
60466a63f2
*: fix style
Fixes style nits introduced by recent pull requests.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-30 11:27:11 -04:00
Donald Sharp
32592ffb4f Merge pull request #1056 from opensourcerouting/oldbits-0
"pathspace" options, vtysh-suid-cleanups, "vty_frame()"
2017-08-29 17:48:36 -04:00
Mitesh Kanjariya
09fdc88c8c Merge branch 'master' into dev-master 2017-08-28 18:19:03 -07:00
Mitesh Kanjariya
6b3ee3a0b0 lib: new APIs for get/set system hostname/domainname
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-28 17:16:52 -07:00
David Lamparter
8bd33a03b5 vtysh: add -N/--pathspace option
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-28 23:50:42 +02:00
David Lamparter
9b8a82496a vtysh: simplify path handling
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-28 23:50:40 +02:00
David Lamparter
32f3268f51 vtysh: cleanup SUID handling
Eliminate several more SUID problems (VTYSH_LOG, history file) and make
the whole SUID approach more robust.  Still possibly unsafe to use, but
much better.

[v2: wrap seteuid/setegid calls]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-28 23:49:58 +02:00
Nigel Kukard
344d9016be vtysh: Fix for the ordering of large-community lists in config output
Signed-off-by: Nigel Kukard <nkukard@lbsd.net>
2017-08-28 19:27:23 +00:00
Mitesh Kanjariya
419cd5a03f lib/bgpd: provide/use API to get hostname/domainname
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-24 16:37:16 -07:00
David Lamparter
40818cec85 lib: move hashstats under debug, show per-daemon
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-21 14:41:02 +02:00
David Lamparter
add57540ba Merge pull request #1009 from donaldsharp/show_cmds
Show cmds
2017-08-21 14:30:41 +02:00
Donald Sharp
87f6dc504d *: Add 'show debugging' command from vtysh
Allow vtysh to query every daemon about its
debugging status in one go.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-21 07:23:59 -04:00
Donald Sharp
7292d8510f vtysh: Convert 'show logging' to use helper function.
The 'show logging' command was not using the 'show_per_daemon'
function for some reason.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-21 07:21:50 -04:00
Daniel Walton
596074af62 vtysh: vtysh -f FOO should exit non-zero if it hits an error
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

Today if we hit an error while apply the contents of file FOO that error
does not bubble up to a non-zero exit.
2017-08-16 20:22:59 +00:00
David Lamparter
a23587faac vtysh: don't collect config from watchfrr
This results in some hardcoded watchfrr logging config ending up in the
integrated config otherwise.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-15 13:43:50 +02:00
David Lamparter
695bb8f0d1 Merge branch 'frr/pull/822' ("EVPN fixes")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-09 21:34:10 +02:00
Renato Westphal
2dd0d72624 zebra: add support for static pseudowires
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-09 13:03:36 +02:00
Daniel Walton
5014d96f0f bgpd, tools, vtysh: Handle config migration from 'address-family evpn' to 'address-family l2vpn evpn'
Ticket: CM-16747
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-08 10:28:50 -04:00
Mitesh Kanjariya
d37ba5499e bgpd, lib, vtysh: Added support for mac filtering in route-maps
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-08-08 10:09:37 -04:00
David Lamparter
b4e197b521 vtysh: add missing \n on warning message
Oops, missed this in review.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-06 04:17:13 +02:00
Chirag Shah
ac28e4ecaf ospfd: Fix MI-OSPF CLIs
Handle all instance base clis calling ospf_lookup_instance()
to return CMD_NOT_MY_INSTANCE in case of ospf is not found.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-08-04 18:03:45 -07:00
Chirag Shah
a3d826f0ea ospfd: Fix MI-OSPF configuraton clis
Multi-Instance OSPF configuration CLI would fail because
first client return error upon seeing qobj_index being 0.
With new marco generate new error code to return from each
instance (vtysh client) and if the command is intended for given
instance, its qobj_index would be nonzero and process the command
and push correct ospf context. Other instance would return the error.
On vtysh end, check all instance return an error log a message to a
file.

Testing Done:
Verfied various MI-OSPF configuration CLI with multi instances.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-08-04 07:47:45 -07:00
Donald Sharp
0ecfe5bf38 Merge branch 'master' into PIM_VRF 2017-08-02 09:39:38 -04:00
David Lamparter
84d5286a9f Merge pull request #881 from donaldsharp/ping_traceroute
vtysh: Fix shell executed commands
2017-07-31 20:06:57 +02:00
David Lamparter
812ff999ca Merge pull request #865 from qlyoung/find
Find
2017-07-31 19:58:20 +02:00
Donald Sharp
137a1684e0 vtysh: Fix shell executed commands
Pretty much all shell executed commands from vtysh were
not behaving correctly due to errors introduced in
switching to the new cli.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-31 08:52:10 -04:00
Quentin Young
cf6c83e712
lib, vtysh: add find COMMAND
Substring search through all defined commands in all nodes.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-26 22:58:52 -04:00
Renato Westphal
a701f7eaa2 vtysh: fix markfile output for ldpd
Put the "end" marker in the right places. This should fix the
frr-reload.py script because it depends on the output of vtysh -m.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-26 19:44:49 -03:00
Renato Westphal
983bd6f71c ldpd: add the exit-address-family command
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-26 19:37:33 -03:00
David Lamparter
533450e4b9 Merge pull request #837 from qlyoung/fix-eigrp-routemap-cli
eigrpd, vtysh: add dummy route-map cli
2017-07-25 16:15:54 +02:00
Donald Sharp
6f2f0be832 vtysh: Allow vtysh to pass through vrf commands to pim
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:33 -04:00
David Lamparter
9d303b37d7 Revert "*: reindent pt. 2"
This reverts commit c14777c6bf.

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-22 14:52:33 +02:00
Quentin Young
a72730d34a
eigrpd, vtysh: add dummy route-map cli
eigrpd will successfully accept `(conf)# route-map foo ...` because it
is not sent to eigrpd from vtysh, but of course, this is the classic
node sync syndrome.

Since eigrpd apparently doesn't support proper routemaps yet just add
the cli so we can suppress the vtysh errors.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-20 12:51:57 -04:00
whitespace / reindent
c14777c6bf
*: reindent pt. 2
w/ clang 5

* reflow comments
* struct members go 1 per line
* binpack algo was adjusted
2017-07-17 15:26:02 -04:00
whitespace / reindent
d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
Donald Sharp
1ea6b3f237 Merge remote-tracking branch 'origin/master' into evpn_plus_struct_attr 2017-07-14 08:24:46 -04:00
Donald Sharp
da571b7a6c Merge remote-tracking branch 'origin/master' into evpn_plus_struct_attr 2017-07-14 08:11:05 -04:00
David Lamparter
28b672fcd3 lib, vtysh: remove now-useless newline arg
It's always \n now, hooray.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 13:18:14 +02:00
David Lamparter
84a98309de Merge remote-tracking branch 'frr/master' into newline-redux
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 13:15:55 +02:00
Russ White
79af1cb338 Merge pull request #808 from qlyoung/vtysh-termcols
lib, vtysh: pretty-print variable autocompletions
2017-07-14 07:10:13 -04:00
David Lamparter
2d8270596a Merge remote-tracking branch 'frr/master' into newline-redux
Lots of conflicts from CMD_WARNING_CONFIG_FAILED...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 13:07:30 +02:00
Russ White
905c150793 Merge pull request #815 from dwalton76/CMD_WARNING_take2
vtysh: return non-zero for configuration failures
2017-07-14 06:24:01 -04:00
David Lamparter
61b7d449bd *: remove VTYNL, part 3 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
6d3c2ed4ed *: remove VTYNL, part 1 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
Daniel Walton
f1a05de982 vtysh: return non-zero for configuration failures
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 19:56:08 +00:00
Quentin Young
ac74942cfb
vtysh: fixup password commands
`password` and `enable password` commands got a bit broken in an earlier
commit, fix 'em up.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-13 15:28:41 -04:00
David Lamparter
5c7571d43f *: ditch vty_outln(), part 1 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13 20:29:22 +02:00
Quentin Young
1a0f614dd2
lib, vtysh: pretty-print variable autocompletions
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-13 10:59:13 -04:00
vivek
90e60aa7c9 bgpd: Additional configuration for EVPN
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-12 15:07:27 -04:00
Daniel Walton
dfd8121281 Merge branch 'master' of https://github.com/dwalton76/frr into bgpd-ipv4-plus-label-misc3
Conflicts:
	bgpd/bgp_route.c
	bgpd/bgp_zebra.c
2017-07-10 13:06:19 +00:00
Daniel Walton
b83c95ce27 Merge branch 'master' of https://github.com/dwalton76/frr into bgpd-ipv4-plus-label-misc3 2017-07-05 19:41:51 +00:00
Quentin Young
7111c1a0cd
*: fix excess docstring
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-05 15:33:00 -04:00
Quentin Young
e703a0f3af
lib, vtysh: rebase hashstats
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-01 19:18:39 -04:00
Quentin Young
6f6f00107e
lib, vtysh: hashtable statistics
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-01 19:18:35 -04:00
Daniel Walton
1161690b93 Merge branch 'master' of https://github.com/dwalton76/frr into bgpd-ipv4-plus-label-misc3
Conflicts:
	bgpd/bgp_route.c
2017-06-30 17:52:56 +00:00
Daniel Walton
ab782c96f8 bgpd: Make SAFI-1 and SAFI-4 use the same table
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-06-30 14:24:58 +00:00
Quentin Young
e31b6333f4 *: vty_outln (vty, "") --> vty_out (vty, VTYNL)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:56 +00:00
Quentin Young
1318e7c841 *: s/VTY_NEWLINE/VTYNL/g
Should be able to fit more vty_out onto one line now

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:54 +00:00
Quentin Young
96ade3ed77 *: use vty_outln
Saves 400 lines

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:31:28 +00:00
Jafar Al-Gharaibeh
5ce1d8b118 Merge pull request #757 from donaldsharp/extract_sort
vtysh: Sort ordering of vtysh_cmd.c
2017-06-27 10:56:56 -05:00
Donald Sharp
74818bb1cd vtysh: Sort ordering of vtysh_cmd.c
When we created the vtysh_cmd.c file the vtysh_cmd.c output
is slightly different for every run, even when none of the
inputs have changed.

Add the ability to sort the output so that the output is
the same for every build.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-06-27 08:15:45 -04:00
Quentin Young
b2e266663b vtysh: fix various show commands
need 'do' to force ENABLE_NODE

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-21 18:42:17 +00:00
Quentin Young
c25c61370f vtysh: fix stack buffer overflow
VARIABLE accepts arbitrary input

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-19 20:37:43 +00:00
Renato Westphal
c740f7d367 ldpd: convert cli and get rid of the xml interface
The xml2cli.pl script was useful years ago when the vty code was very
rudimentary. This is not the case anymore, so convert all ldpd CLI
commands to use DEFUNs directly and get rid of the XML interface.

The benefits are:
* Consistency with the other daemons;
* One less build dependency (the LibXML perl module);
* Easier to add new commands.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-06-16 14:43:42 -03:00
Quentin Young
b170d66a78 lib: allow 'do' commands in ENABLE_NODE
'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-16 14:46:08 +00:00
David Lamparter
97bd5c48de Merge remote-tracking branch 'frr/master' into pull-624 2017-06-13 09:18:14 +02:00
David Lamparter
326452238a Merge branch 'stable/3.0'
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-06 17:37:41 +02:00
Donald Sharp
9a7aa8be43 vtysh: Cleanup some stuff(tm)
1) vtysh_config_dump was not properly indented.  Fix

2) Add VRF_NODE to be line_uniq when parsing return from sub-daemons

3) Fix 'no log monitor' to be line_uniq as well

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-06-02 13:43:57 -04:00
Donald Sharp
293067f086 Merge remote-tracking branch 'origin/master' into babel 2017-05-30 10:58:03 -04:00
Donald Sharp
3c5211b4c9 vtysh: Add back some missing bgp commands
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-30 09:30:04 -04:00
Jafar Al-Gharaibeh
9e8df9882c vtysh: fix a compile error when user/group are disabled
If FRR is configured explicilty with --disable-user and
--disable-group, FRR_USER and FRR_GROUP will not be defined
and can be safely skipped in vtysh.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2017-05-26 12:53:08 -05:00
Donald Sharp
1ac33779aa vtysh: Add back some missing bgp commands
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-25 13:53:50 -04:00
Lou Berger
1ec1afd6cb bgpd: remove encap safi vty related files bgp_encap.h|c
Signed-off-by: Lou Berger <lberger@labn.net>
2017-05-23 15:58:50 -04:00
Lou Berger
ddb2927dff vtysh: remove BGP_ENCAP(V6)_NODE
Signed-off-by: Lou Berger <lberger@labn.net>
2017-05-23 15:40:23 -04:00
Lou Berger
26a4b7c3c3 bgpd: remove encap safi vty related files bgp_encap.h|c
Signed-off-by: Lou Berger <lberger@labn.net>
2017-05-23 15:34:43 -04:00
Lou Berger
b61410ebd5 vtysh: remove BGP_ENCAP(V6)_NODE
Signed-off-by: Lou Berger <lberger@labn.net>
2017-05-23 15:01:09 -04:00
David Lamparter
1d6664e090 vtysh: fix autocompletion API misuse
I forgot to update this call when I changed
cmd_variable_handler_register to take an array...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-21 20:37:34 -04:00
David Lamparter
57463530f3 Merge branch 'stable/3.0'
Conflicts:
	ospf6d/ospf6_lsa.c
	ospfd/ospf_vty.c
	zebra/interface.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 12:28:12 +02:00
David Lamparter
92eedda1fb Merge branch stable/2.0 into stable/3.0
Conflicts:
	bgpd/bgp_fsm.c
	ospf6d/ospf6_lsa.c
	ospfd/ospf_vty.c
	zebra/redistribute.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 12:23:13 +02:00
Quentin Young
f14b7abf4f vtysh: fix ldpd vtysh
ldpd needs a special case to execute the correct exit command for walkup
when using vtysh

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-17 17:34:30 +00:00
Daniel Walton
825be4c27b tools: frr-reload.py should exit non-zero when "set src x.x.x.x" fails
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-17 00:14:37 +00:00
David Lamparter
896014f4bc *: make consistent & update GPLv2 file headers
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-15 16:37:41 +02:00
David Lamparter
7f059ea614 vtysh: autocomplete variables
This asks the connected daemons for their variable completions through a
hidden CLI command.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 10:27:43 -04:00
Donald Sharp
56afaa8bcb Merge remote-tracking branch 'origin/stable/3.0' 2017-05-14 21:19:33 -04:00
Donald Sharp
32d095b834 vtysh: Add knob for babel execution
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-13 23:43:07 -04:00
Donald Sharp
a616ea5f24 lib, vtysh: Add bits and pieces to allow vtysh to understand babel
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-13 23:38:14 -04:00
Donald Sharp
ca10883edc *: Initial Import of Babeld into FRR
This is a direct copy of:
https://github.com/boutier/quagga-merge

From the branch babel-merge

I copied the babeld directory into FRR and then fixed up everything to
compile.

Babeld at this point in time when run will more than likely crash and burn
in it's interfactions with zebra.

I might have messed up the cli, which will need to be looked at

extract.pl.in and vtysh.c need to be fixed up.  Additionally we probably
need to work on DEFUN_NOSH conversion in babeld as well

This code comes from:
Matthieu Boutier <boutier@irif.fr>
Juliusz Chroboczek <jch@irif.fr>

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-13 14:59:41 -04:00
Quentin Young
6500e013db vtysh: add \n to 'router rip[ng]' docstrings
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-10 19:49:18 +00:00
Donald Sharp
08c369bda9 *: Allow configure to control VTYSH_PAGER used
Signed-off-by: Donald Sharp
2017-05-10 11:16:26 -04:00
Donald Sharp
62ff928b37 *: Allow agentx to be displayed as part of vtysh
Modify code so that that vtysh can now accept the
agentx command for snmp support

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-09 10:16:06 -04:00
Russ White
ba2d7123d5 Merge pull request #409 from donaldsharp/EIGRP
Eigrp
2017-05-07 19:48:33 -04:00
Donald Sharp
090ba7ca15 vtysh: Fix _ instead of - usage for labeled_unicast
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-03 10:24:04 -04:00
Donald Sharp
05ba625af7 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-02 15:52:09 -04:00
Donald Sharp
b46be72b4a Merge branch 'master' into EIGRP 2017-05-02 11:38:06 -04:00
Donald Sharp
7c680483e5 vtysh: Add back in some missing ospf6 commands
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-28 10:55:45 -04:00
Donald Sharp
2a23cf9503 vtysh: remove unused compilation file
Remove eigrp_routemap.c from consideration at the
moment for vtysh inclusion.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-26 22:27:28 -04:00
Daniel Walton
39530dfe75 Problem with DEFUNSH in vtysh, issue #358
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-04-26 22:39:10 +00:00
Donald Sharp
352a10a999 Merge remote-tracking branch 'origin/master' into mpls2 2017-04-26 14:18:22 -04:00
Donald Sharp
6aa210418e Merge remote-tracking branch 'origin/master' into EIGRP 2017-04-26 08:03:54 -04:00
Donald Sharp
c05f73e0f4 Merge remote-tracking branch 'origin/master' into mpls2 2017-04-26 07:50:02 -04:00
Martin Winter
3d7746c340 Merge pull request #400 from dwalton76/default-frr-conf
vtysh: "Command incomplete: log syslog"
2017-04-24 20:11:11 -07:00
Daniel Walton
27821f6a5a vtysh: "Command incomplete: log syslog"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

Before
======
root@spine-1[~]# cat /etc/frr/frr.conf
no log monitor
!
service integrated-vtysh-config
!
log syslog
!
log syslog informational
!
line vty
!
root@spine-1[~]#
root@spine-1[~]# vtysh -m -f /etc/frr/frr.conf
no log monitor
!
service integrated-vtysh-config
!
line 5: % Command incomplete: log syslog

root@spine-1[~]#

After
=====
root@spine-1[~]# vtysh -m -f /etc/frr/frr.conf
no log monitor
!
service integrated-vtysh-config
!
log syslog
!
log syslog informational
!
line vty
!
end
root@spine-1[~]#
2017-04-24 18:22:29 +00:00
Philippe Guibert
d2c1e06d83 vtysh: remove deprecated HAVE_EVPN flag
This flag prevents from entering into evpn address-family node, when
calling command from vtysh.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-04-19 09:40:08 +02:00
Don Slice
f51bae9cf9 bgpd: labeled unicast config
Implement support for activating the labeled-unicast address family in
BGP and relevant configuration for this address family.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2017-04-06 10:30:03 -04:00
Donald Sharp
97133f7915 Merge remote-tracking branch 'origin/master' into EIGRP 2017-04-05 20:52:32 -04:00
Donald Sharp
be0f843102 vtysh: Fix build for non-snmp case
The snmp code is being included in the build of the vtysh_cmd.c
irrelevant of whether or not it is needed.  Be a bit smarter
about what files to include.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-04-04 21:28:14 +02:00
David Lamparter
422f8d0ca9 Merge branch 'master' 2017-04-04 20:04:07 +02:00
David Lamparter
3e7c8d040c Merge branch 'stable/2.0'
Fixed minor conflicts from "defaults" change on stable.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-04-04 19:01:47 +02:00
Donald Sharp
b3cfe637a6 Merge pull request #294 from opensourcerouting/modules
Loadable module support
2017-04-04 11:55:00 -04:00
David Lamparter
2a8e27afb8 vtysh: handle "show modules" like "show memory"
Preface with line identifying which daemon it applies to.
[Also fixes a missed "plugin" -> "module" replace.]

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-04-04 16:12:59 +02:00
Renato Westphal
308252d06d ldpd: remove the interface vty node
ldpd uses a hierarchical configuration model where all commands are
defined inside the "mpls ldp" node and its subnodes. The idea is to keep
all LDP configuration in a single place to keep things simple. With that
said, we can remove the "config-if" node from ldpd because we already
have a separate node ("config-ldp-af-if") for LDP-related interface
specific commands.

Example:
vtysh(config)# mpls ldp
vtysh(config-ldp)# address-family ipv4
vtysh(config-ldp-af)# interface eth1
vtysh(config-ldp-af-if)# discovery hello ?
  holdtime  Hello holdtime
  interval  Hello interval

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-31 12:57:25 -03:00
David Lamparter
16807aab5c vtysh: remove ignore list
With DEFUN_NOSH in place everywhere, this is useless.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-28 15:48:07 -04:00
David Lamparter
8efe88eacf *: track version & "defaults" in configs
[CF]: Move default name to autoconf and update tests

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-28 19:18:42 +02:00
Donald Sharp
c6972d6601 vtysh: Rehook lib/command.c:cmd_init
Vtysh was not running lib/command.c commands for eigrp

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-10 20:44:22 -05:00
Donald Sharp
49feff1ad5 vtysh: Fix eigrp ordering in 'show run'
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-10 19:19:42 -05:00
Donald Sharp
5ffc9780fb vtysh: Fix misplaced (
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-10 18:59:43 -05:00
Martín Beauchamp
685e701ef3 Lowercase frr.conf 2017-03-09 09:45:00 -05:00
Donald Sharp
7f57883ee6 eigrp: Initial Commit
Please Note, I will be redoing this commit message with
more information.

Additionally I will rework the lib/* changes into their
own commits.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-08 23:07:46 -05:00
David Lamparter
eb05883f3e *: add frr_config_fork()
Centralise read_config/daemonize/dryrun/pidfile/vty_serv into libfrr.

This also makes multi-instance pid/config handling available as part of
the library.  It's only wired up in ospfd, but the code is in lib/.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:36 +01:00
David Lamparter
09e61a383f vtysh: fix completion
The return value from cmd_complete_command is a VECTOR_INDEX, not TMP.
Use the appropriate vector_only_index_free().

Fixes #223.

Reported-by: https://github.com/k0ste
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 19:20:05 +01:00
Timo Teräs
2fb975da77 nhrpd: implement next hop resolution protocol
This provides DMVPN support and integrates to strongSwan. Please read
README.nhrpd and README.kernel for more details.

[DL: cherry-picked from dafa05e65fe4b3b3ed5525443f554215ba14f42c]
[DL: merge partially resolved, this commit will not build.]
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 16:20:29 +01:00
Donald Sharp
6093e48238 vtysh: Fix cli help string to have only 1 mention of vty_socket
When you run 'vtysh -h' the option '--vty_socket' is listed twice.
Fixes issue #253

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-06 19:49:05 -05:00
Martín Beauchamp
e20dc2ba06 Lowercase frr.conf 2017-02-27 13:26:20 -05:00
Donald Sharp
3f3169a2e6 Merge remote-tracking branch 'origin/stable/2.0' 2017-02-24 09:32:47 -05:00
Philippe Guibert
b194703e9c bgpd: remove old address-family vty command for evpn
old vty format to configure evpn: address-family evpn
is no longer supported.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:59 +01:00
Philippe Guibert
61a5196233 bgpd: add support for evpn subnode by using afi/safi parameter
Added the possibility to enter in evpn address-family in bgp node, by
using 'address-family l2vpn evpn' command.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:58 +01:00
Philippe Guibert
14a227b873 vtysh: add support for bgp evpn address-family
Add support for evpn address-family on vty shell.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:57 +01:00
David Lamparter
cd2726408a vtysh: make -c useful with -C (dryrun)
-c was previously ignored when -C (dryrun/config-check) was present.
Change so that -C -c creates an useful dry-run mode.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-10 17:22:53 +01:00
Martin Winter
fa389c272f vtysh: Fix Coverity Warning CID 1399479 (#1 of 1): Destination buffer too small (BUFFER_SIZE)
Coverity: buffer_size: You might overrun the 108 byte destination string addr.sun_path by writing the maximum 4095 bytes from path.
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-02-10 16:51:57 +07:00
Donald Sharp
305e9740ff Merge remote-tracking branch 'origin/stable/2.0' 2017-02-09 09:53:46 -05:00
Donald Sharp
0dca233ec0 *: Found some instances of Quagga.conf
Cleanup Quagga.conf -> Frr.conf

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-07 13:44:09 -05:00
Donald Sharp
7df2e1c379 Merge remote-tracking branch 'origin/stable/2.0' 2017-02-07 13:20:12 -05:00
David Lamparter
9da3dd3bc5 Merge pull request #161 from donaldsharp/stableMcLibrary
Stable mc library
2017-02-07 17:17:12 +01:00
David Lamparter
ace5a8a17e Merge branch 'frr/pull/157' ("Fixinator")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-07 16:38:03 +01:00
Quentin Young
a0b4b67e80 vtysh: Quagga.conf -> Frr.conf
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-02-03 18:48:04 +00:00
Donald Sharp
fd420a3275 bgpd, vtysh: Fix vtysh able to handle some safi modes for bgp
This adds the ability for vtysh to handle v4 and v6
safi modes besides unicast and multicast.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com.
2017-02-03 10:29:53 -05:00
Donald Sharp
55c7280315 *: Convert libzebra -> libfrr
The library libzebra that is installed with FRR will
conflict with Quagga.  So let's rename it to libfrr.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-03 08:29:13 -05:00
Donald Sharp
1a35e2e565 Merge remote-tracking branch 'origin/stable/2.0' 2017-02-02 10:42:51 -05:00
David Lamparter
ff1c42fb9f *: fix warning fallout from set_socket_path
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-01 13:12:16 +01:00
David Lamparter
66d29a54a1 lib: clean up tab-completion memory counting
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-31 15:28:19 +01:00
Donald Sharp
fd6ab73ea6 vtysh: Add 'vrf-policy NAME' and 'exit-vrf-policy' to ignore list.
vtysh needs to ignore these two commands or we'll get duplicate warnings

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-25 22:04:49 -05:00
Donald Sharp
c7f1274bad bgpd, vtysh: Allow bgp and vtysh to work together again
Harmony is restored to the world as bgp and vtysh
can now, again, stay in sync with each other.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-25 21:51:28 -05:00
Martin Winter
ce2e9ec3ad vtysh: Add --config_dir option to override compiled in location for vtysh.conf and Quagga.conf
Only allow the override if vtysh is not run with setuid()

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-01-26 00:44:55 +07:00
Martin Winter
f38e9e49f5 vtysh: Use HOME environment variable to get homedir and only fallback to passed entry if no HOME is defined
Snap packages have a local HOME defined inside the SNAP container, but don't get access to passwd entry.

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-01-26 00:44:31 +07:00
Martin Winter
87d79a9f79 vtysh: Add vty_socket cli option to override the compiled-in location for the VTY daemon sockets
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-01-26 00:43:58 +07:00
Lou Berger
5ff06872e9 bgpd: add vrf-policy config using existing vnc code
add add/clear vrf prefix
      + Modified for FRR master parser

Signed-off-by: Lou Berger <lberger@labn.net>
2017-01-22 20:54:57 -05:00
Lou Berger
794a2e0ba0 bgpd: use address-family <afi> <safi> in show running for vpn&encap (Issue #80)
Signed-off-by: Lou Berger <lberger@labn.net>
2017-01-18 18:27:04 -05:00
David Lamparter
eb3d20d398 Merge pull request #59 from donaldsharp/cli_cleanup
Cli cleanup, largely VNC related, minor bgpd/ospfd/lib fixes.
2017-01-17 21:36:07 +01:00
Lou Berger
24d3752405 bgpd: use address-family <afi> <safi> in show running for vpn&encap (Issue #80)
Signed-off-by: Lou Berger <lberger@labn.net>
2017-01-17 14:59:10 -05:00
David Lamparter
7758fe9f60 build: fix several ldpd XML-CLI build issues
- the location of ldp_vty_cmds.c can be either in srcdir or builddir,
  depending on whether a premade file from a dist tarball is used
- perl libxml support is only needed if that file is absent
- the actual perl script wasn't even included in the dist tarball
- the include location doesn't work when srcdir != builddir

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-17 19:00:10 +01:00
Donald Sharp
56c1f7d852 frr: Remove HAVE_IPV6 from code base
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-13 08:05:50 -05:00
Donald Sharp
1634b1bd1f vtysh: Add 'vnc l2-group NAME' to exclusion list
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-09 15:35:28 -05:00
Quentin Young
b84aadae44 Merge branch 'master' into fix-proto_redistnum 2017-01-06 19:44:46 -05:00
Donald Sharp
ff74b033d3 Merge pull request #30 from qlyoung/fix-cli-nits
vtysh: add `logical-router ...` to extract.pl ignore list
2017-01-06 19:37:28 -05:00
Donald Sharp
3b14d86eed Merge remote-tracking branch 'origin/stable/2.0' 2017-01-06 09:58:21 -05:00
Donald Sharp
9473e34052 watchfrr: Rename watchquagga -> watchfrr
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-03 20:13:02 -05:00
Quentin Young
6e2e5d4108 vtysh: add logical-router ... to extract.pl ignore list
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-12-23 01:58:29 +00:00
David Lamparter
ae435b1972 build: replace some hardcoding with ./configure
Several places have paths and names that can change hardcoded, e.g. the
package name and the /var/run path.  This fixes a few of them, there's
still some to do.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-20 18:18:44 +01:00
David Lamparter
b2f361571b build: rename (1 of ?): configure.ac + preproc
This replaces Quagga -> FRR in most configure.ac settings as well as
a handful of preprocessor macros in the source code.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-20 17:57:47 +01:00
Quentin Young
6d681bd874 all: use ->text when parsing protocol argument
and match on full protocol name in proto_redistnum()

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-12-16 05:39:44 +00:00
Donald Sharp
c43ac31c18 vtysh: Fix static compilation
When compiling vtysh with --enable-static and --disasble-shared
we get linker errors with duplicate function names.

This commit addresses this issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit dd2ecdedf8)
2016-12-09 15:48:56 +01:00
Donald Sharp
dd2ecdedf8 vtysh: Fix static compilation
When compiling vtysh with --enable-static and --disasble-shared
we get linker errors with duplicate function names.

This commit addresses this issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-08 14:52:37 +01:00
David Lamparter
d7d73ffc8f *: fix up DEFUNs without install_element calls
These now generate warnings which will break the build with -Werror.

Note this may have enabled commands that should be disabled, or the
other way around...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-05 20:28:24 +01:00
David Lamparter
0b84f29490 *: make DEFUN installations file-local
This moves all install_element calls into the file where the DEFUNs are
located.  This fixes several small related bugs:

- ospf6d wasn't installing a "no interface FOO" command
- zebra had a useless copy of "interface FOO"
- pimd's copy of "interface FOO" was not setting qobj_index, which means
  "description LINE" commands would fail with an error

The next commit will do the actual act of making "foo_cmd" static.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-01 17:25:56 +01:00
David Lamparter
030204c7b0 *: fix CLI copypasta mixups
Nice clang catch:  ospfd/ospf_vty.c:6710:1: error: all paths through
this function will call itself [-Werror,-Winfinite-recursion]

(same in vtysh/vtysh.c)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-29 14:15:05 +01:00
David Lamparter
28c2525098 Merge commit '34d5ef459140ee7e'
(some build fixups for vtysh-grammar)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-28 18:10:21 +01:00
David Lamparter
82992fed8c Merge branch 'vtysh-grammar'
Conflicts:
	isisd/isisd.c
	lib/Makefile.am
	lib/thread.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-28 17:56:29 +01:00
David Lamparter
cdf7612649 Merge remote-tracking branch 'cmaster-next' into cmaster-next-releng 2016-11-28 17:35:08 +01:00
David Lamparter
a7c36d8552 vtysh: initialise readline before binding key
when libreadline initialises itself, it also reads .inputrc, which may
result in keybindings being set up.  This means the builtin help on the
'?' key can be overridden by that.  Consistent availability of '?'
behaviour trumps .inputrc setup here, so let's initialise readline
first before binding that key (which means our keybinding wins).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-23 08:32:30 +01:00
Quentin Young
3bd20d8460 Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	zebra/interface.c
2016-11-22 21:36:54 +00:00
Donald Sharp
03f99d9a4d vtysh, zebra: Fix link-params to use exit-link-params
Fix the link-params submode to use the 'exit-link-params'
to indicate we are exiting a submode.

Fixup all the relevant bits.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-11-18 15:42:41 -05:00
David Lamparter
095f8fae64 isisd: remove topology generator
Licensing is unclear and the tool is a testbed-only half-broken pile of
goo.  Remove.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-14 11:28:04 +09:00
David Lamparter
95c2af68ea zebra: fix link-params CLI handling
vtysh was breaking in a rather ugly way, and some "no" forms were
missing too.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-12 17:45:11 +09:00
Quentin Young
07321a065d Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	lib/command.c
	lib/vty.c
2016-11-12 05:17:37 +00:00
Quentin Young
17aca20bfb lib, vtysh: Fix memory leaks, change cmd_element to const
Fix a few memory issues:

* Not freeing tab-completions upon input match failure
* Invalid write when null-terminating tab-completions
* Not freeing argv[] itself in additinon to elements
* Use XFREE() instead of free() as appropriate
* Not freeing final token of an [option] during parsing

Make a few minor changes to CLI internals:

* Improve documentation on matching & completion functions
* Only make one copy of cmd_token's when building argv,
  instead of three
* Don't make a copy of the matching cmd_element

Make one major(ish) change to CLI internals:

* Change all pointers to struct cmd_element to const

Code outside of the core CLI units should never have an
occasion to modify the internal state of the command system.
Doing so could easily amount to having a CLI interface that
changes during runtime, and could conceivably lead to security
issues. Explicitly disallowing this removes any chance of
confusion.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-12 01:06:32 +00:00
David Lamparter
9f1f8df328 vtysh: fix config write 2016-11-10 14:01:15 +01:00
David Lamparter
c10c5926cb vtysh: improve config-write error reporting
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-10 10:15:30 +01:00
David Lamparter
1f8df88720 Revert "vtysh: Make vtysh run as quagga user"
This reverts commit 5dd58b0829.

Changing vtysh uid/gid is now actually counterproductive.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-09 14:29:45 +01:00
David Lamparter
e10ca9b6b8 vtysh: funnel integrated write through watchquagga
Running vtysh as normal user won't have permissions to write
Quagga.conf.  If we're connected to watchquagga, try "write integrated"
first.  In all cases if something fails, try directly.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-09 14:29:45 +01:00
David Lamparter
4a96e94474 vtysh: add watchquagga to target list
Also tag some commands as VTYSH_REALLYALL; these are absolutely
neccessary for correct vtysh operation and will cause "interesting"
breakage if not present on all daemons.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-09 14:29:45 +01:00
David Lamparter
95c4aff294 watchquagga: add "write integrated"
This new command - available for internal use by vtysh and explicit
usage by users - calls "vtysh -w" from watchquagga.  This ensures vtysh
is run with privileges to actually write the integrated-config file.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-09 14:29:39 +01:00
David Lamparter
367988eeb3 vtysh: set config file permissions
As vtysh may hopefully be running as root from watchquagga here, let's
try to fix up ownership and permissions for Quagga.conf.  Doing
chown/chmod instead of changing the process's user/group IDs has the
advantage of fixing up preexisting misconfigurations.

Note errors in chmod/chown will print a message but the config is
already written at that point.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-09 13:55:23 +01:00
David Lamparter
a68f861653 vtysh: add -w option for integrated-config write
This new option is intended to be used both by watchquagga as well as
directly by users.  It performs the collect-configuration operation and
writes out Quagga.conf, regardless of whether integrated-config is
enabled or not.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-09 13:43:33 +01:00
David Lamparter
cb947ba3ae vtysh: detangle configuration writes
vtysh has a very convoluted and confusing setup where it isn't even
clear which files are written where (since some filenames come
indirectly from loading config).  Detangle.

This also removes writing vtysh.conf.  The file is intended to be
manually edited since it has some vague security concerns (if PAM is
used).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-09 13:41:40 +01:00
Quentin Young
4c4ff4c136 bgpd, vtysh: Fix failing bgp cli
* bgp bestpath as-path multipath-relax
* address-family encap
* address-family encapv4

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-09 07:24:51 +00:00
Quentin Young
16cedbb01f all: Fix underfull doc strings, part 1
Add missing docstrings and separating \n.
Also eat some low-hanging refactoring fruit.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-04 23:03:03 +00:00
Quentin Young
fa496b0a2e vtysh: Add address-family stomps
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-03 23:06:59 +00:00
Quentin Young
843d75b1a8 vtysh: Condense a few address-family commands
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-03 23:02:21 +00:00
Quentin Young
e9e190f245 Merge branch 'cmaster-next' into vtysh-grammar
Conflicts:
	vtysh/vtysh.c
	zebra/zebra_vty.c
2016-10-25 19:38:04 +00:00
Donald Sharp
87ab4aec50 vtysh: Allow vtysh to not know about enabled daemons/features
With the way that vtysh works, it compiles in cli even
if there is no support in the protocols.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-25 08:26:09 -04:00
Quentin Young
fd8503f557 Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	bgpd/bgp_vty.c
2016-10-21 19:49:16 +00:00
Quentin Young
39e92c066f Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	bgpd/bgp_encap.c
	bgpd/bgp_route.c
	lib/command.c
	lib/command.h
	ospf6d/ospf6d.c
	vtysh/vtysh.c
2016-10-21 19:27:49 +00:00
Donald Sharp
9d2ea60802 vtysh: Fix 'show run' output of bgp
The code in vtysh was incorrectly handling
sub-modes for a bgp config when doing a 'show run'

This commit:
commit 65efcfce42
Author: Lou Berger <lberger@labn.net>
Date:   Sat May 7 14:18:56 2016 -0400

    bgpd: add L3/L2VPN Virtual Network Control feature

Added vnc support to the bgp daemon.  In addition
it modified vtysh_config.c to help vtysh understand
bgp sub-modes.  This caused the output of the show
run bgp command to be displayed incorrectly:

router bgp 65001
 !
 address-family ipv4 unicast
  maximum-paths 4
 exit-address-family
 !
!
 address-family ipv6 unicast
  maximum-paths 3
 exit-address-family
!

Backing out this change allows vtysh to have the
correct display of bgp now.

Ticket: CM-13136
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: David Lamparter <equinox@opensourcerouting.org>
2016-10-21 10:39:14 -04:00
Christian Franke
ce01a2ca3f vtysh: handle case if there is no match in "write terminal $daemon"
While the DEFUN should match the list of clients registered in
vtysh, it seems better to handle the case explicitly instead of
relying on the client list and the DEFUN signature being in sync.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-20 20:28:26 -04:00
Quentin Young
0a538fc98f Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	isisd/isis_routemap.c
	zebra/rt_netlink.c
2016-10-20 16:31:49 +00:00
David Lamparter
2d35a720b9 vtysh: fix oversight in vtysh buffer rewrite
end can be NULL and shouldn't be adjusted in that case.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-10-19 22:28:45 -04:00
David Lamparter
7526a1820e vtysh: refactor vtysh_client_{config,execute}
Triggered by a bugreport / patch by Gautam Kumar <gauta@amazon.com>,
this is a full rewrite vtysh_client_{config,execute}.  (The patch didn't
quite apply anymore.)

vtysh_client_run() now has a buffering implementation that can be read
without losing one's sanity and/or requiring alcoholic beverages.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-10-18 10:35:11 -04:00
Quentin Young
e52702f29d Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	bgpd/bgp_route.c
	bgpd/bgp_routemap.c
	bgpd/bgp_vty.c
	isisd/isis_redist.c
	isisd/isis_routemap.c
	isisd/isis_vty.c
	isisd/isisd.c
	lib/command.c
	lib/distribute.c
	lib/if.c
	lib/keychain.c
	lib/routemap.c
	lib/routemap.h
	ospf6d/ospf6_asbr.c
	ospf6d/ospf6_interface.c
	ospf6d/ospf6_neighbor.c
	ospf6d/ospf6_top.c
	ospf6d/ospf6_zebra.c
	ospf6d/ospf6d.c
	ospfd/ospf_routemap.c
	ospfd/ospf_vty.c
	ripd/rip_routemap.c
	ripngd/ripng_routemap.c
	vtysh/extract.pl.in
	vtysh/vtysh.c
	zebra/interface.c
	zebra/irdp_interface.c
	zebra/rt_netlink.c
	zebra/rtadv.c
	zebra/test_main.c
	zebra/zebra_routemap.c
	zebra/zebra_vty.c
2016-10-17 23:36:21 +00:00
Daniel Walton
3d3c3cbd11 vtysh: fix build failure in vtysh_writeconfig_integrated()
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-13 13:48:02 +00:00
Renato Westphal
6694f68c3f lib/vtysh: fix duplicate installation of some vty commands
This is a followup to commits 735e62 and 0b1442, where we forgot to apply
the same VIEW/ENABLE consolidation logic to vtysh. Also, we can't call
install_default() for the ENABLE node because some of the vty commands
installed by this function were already installed in the VIEW node before.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-10-12 19:33:56 -04:00
Christian Franke
039eaca367 vtysh: infer integrated config usage from existence of Quagga.conf
Only write to integrated config if integrated config is configured
explicitly or it is already in use.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-10-12 07:42:25 -04:00
Quentin Young
d2aaa2e556 vtysh: Add missing stomps
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-12 04:21:18 +00:00
Quentin Young
2de8b19c5a vtysh: Update extract.pl.in
CLI stomps updated. Need to be eliminated.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-12 01:44:50 +00:00
Quentin Young
066242b5c6 lib: Fix show running-config and write terminal
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-07 02:33:37 +00:00
Daniel Walton
82f97584fb all: removed all DEFUN command stomps
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-06 19:56:13 +00:00
Daniel Walton
56158e1235 vtysh: extract.pl <0-255> to (0-255) changes
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-10-06 13:51:52 +00:00
Lou Berger
65efcfce42 bgpd: add L3/L2VPN Virtual Network Control feature
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-03 08:17:02 -04:00
Quentin Young
e83a94147f all: fix sundry syntax errors
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-01 04:20:30 +00:00
Quentin Young
c3f24f0653 lib: Fix '?'-completion dereferences in vtysh
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-01 01:03:24 +00:00
Quentin Young
a98d33ab20 lib, vtysh: refactor vtysh.c, allow parser continuance
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-30 23:03:05 +00:00
Daniel Walton
bfbc035bd0 vtysh: fixed compile errors
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-30 16:10:28 +00:00
Daniel Walton
4fb25c53b8 bgpd: combine special cases for vrf "all"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-30 14:27:04 +00:00
Daniel Walton
abddf07563 all: scrubbed some argc CHECK MEs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-29 19:51:56 +00:00
Daniel Walton
67656e9b65 all: added CHECK ME for DEFUNs that look at argc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-29 17:48:57 +00:00
Daniel Walton
e961923c72 bgpd, etc: changed .LINE to LINE...
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-27 00:07:46 +00:00
Daniel Walton
199d90a10e Expand #defines in command strings
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25 16:49:39 +00:00
David Lamparter
8d9e99a691 vtysh: make extract.pl more whitespace-robust
"DEFUN (" could only match with exactly one space between DEFUN and
opening brace.  Allow any amount of space.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-09-23 12:12:16 -04:00
Daniel Walton
6147e2c694 convert <1-255> to (1-255), ()s to <>s, etc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 13:47:20 +00:00
Renato Westphal
598a7bcb8b vtysh: relax error condition on build
If the number of CLI collisions is smaller than the expected one,
there's a good chance that Quagga is being built with one or more
daemons disabled. In this case, just print a warning and don't abort
the compilation to allow partial builds.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-23 09:31:26 -04:00
Renato Westphal
41675b4c5e zebra: install MPLS CLI commands only if MPLS is enabled.
To keep things simple, zebra's code should be the same whether MPLS
is enabled or not. Then, when MPLS is not enabled, we just disable all
MPLS CLI commands. This way we don't need to add a lot of #ifdef cruft
in zebra's core, improving code readability.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-23 09:31:20 -04:00
Renato Westphal
4fcbf6e2d9 ldpd: add vtysh support
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-23 09:31:11 -04:00
vivek
7758e3f313 Quagga: Static LSP configuration
Add support for statically configuring MPLS transit LSPs. This allows the
configuration of ILM to one or more NHLFE, as defined in RFC 3031. The
currently supported nexthop types are IPv4 or IPv6.

The two label operations supported are swap and PHP; the latter is configured
by specifying the out-label as "implicit-null". Note that the operation is
against the label, so it should be the same for all NHLFEs.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-4804, ...
Reviewed By: CCR-3085
Testing Done: In combination with other patches
2016-09-23 09:30:54 -04:00
Donald Sharp
460a768914 Merge remote-tracking branch 'origin/cmaster-next' into vtysh-grammar 2016-09-20 21:17:34 -04:00
Quentin Young
844ec28cee Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	lib/.gitignore
	lib/command.c
	lib/command.h
2016-09-21 22:11:53 +00:00
David Lamparter
4a1ab8e405 *: split & distribute memtypes and stop (re|ab)using lib/ MTYPEs
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-19 16:31:04 -04:00
David Lamparter
fc7948fafe lib: migrate to new memory-type handling
Move over to the new allocation counting added in the previous commit.

(This commit is mostly mechanical.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
2016-09-19 18:35:50 +02:00
Donald Sharp
49d41a26c6 isisd, lib, vtysh: Allow extract.pl to fully work
The regular expression for finding DEFUN/ALIAS in
extract.pl looks for "DEFUN (" or "ALIAS (" if
the *.c file does not have this then it will just
silently ignore the cli.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-09-17 07:25:35 -04:00
Donald Sharp
3176e70c10 isisd, vtysh: Fix isis routemaps
Apparently extract.pl requires in it's regular expression
a space after the DEFUN or ALIAS before the opening (
or it completely skips the command.  Brilliant?

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-09-17 07:11:19 -04:00
Quentin Young
039dc61292 lib: Fix tab completions memleak, memory stats corruption
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-09 21:58:33 +00:00
Daniel Walton
28b0c6b377 Unable to remove route-map from quagga
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-12816

pim was missing route-map hooks
2016-09-09 20:24:31 +00:00
Nicolas Dichtel
c253dcb5d8 vrf: add a runtime check before playing with netns
This patch adds a runtime check to determine if netns are available. Some
systems like OpenWRT have the system call setns() but don't have the kernel
option CONFIG_NET_NS enabled.

Reported-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Tested-by: Christian Franke <chris@opensourcerouting.org>
(cherry picked from commit 04a3aabf58d95d01c4c8168eeff43cf9d9892eee)
2016-09-09 12:15:14 -04:00
Feng Lu
13460c44a2 lib, vtysh: support multiple VRFs by using linux netns
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-09 12:15:14 -04:00
Olivier Dugeon
16f1b9ee29 Update Traffic Engineering Support for OSPFD
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-09-03 11:05:50 -04:00
Jafar Al-Gharaibeh
6d128e1d78 vtysh: Fix, guard against NULL pointer dereference
getpwuid() may fail returning a null value leaving subsequent
code vulnerable to a null pointer dereference.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
Tested-by: NetDEF CI System <cisystem@netdef.org>
2016-09-03 07:29:21 -04:00
Donald Sharp
810a8dfc93 Merge remote-tracking branch 'origin/cmaster' into cmaster-next 2016-08-19 12:18:35 -04:00
Daniel Walton
a5b89524bc vtysh --markfile needs to ignore the "end" lines
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-12515
2016-08-18 17:47:01 +00:00
Donald Sharp
ac01cff9ec Merge remote-tracking branch 'origin/cmaster' into cmaster-next 2016-08-17 20:52:04 -04:00
Sid Khot
8ca1689f19 bgpd: Fix for CM-11777 Need Quagga.conf created at quagga install
Ticket: CM-11777
Reviewed By: CCR-5110
Testing Done: Manual
2016-08-16 16:27:34 -07:00
Donald Sharp
039f3a3495 lib, bgpd, tests: Refactor FILTER_X in zebra.h
lib/zebra.h has FILTER_X #define's.  These do not belong there.
Put them in lib/filter.h where they belong.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 0490729cc033a3483fc6b0ed45085ee249cac779)
2016-08-16 11:00:22 -04:00
Donald Sharp
9994130f1d vtysh: Do not run extract.pl over protocols that are not configured
Dynamically figure out the list of .c files that we need to scan
based upon whether or not the daemon is --enabled via configure.

Ticket: CM-12081
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-07-28 14:28:22 -04:00
David Lamparter
c66f9c6186 *: get rid of "MTYPE 0"
A few places are using 0 in place of the MTYPE_* argument.  The
following rewrite of the alloc tracking won't deal with that, so let's
use MTYPE_TMP instead.

Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
[DL: v2: fix XFREE(0, foo) calls too]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28 07:27:48 -04:00