Commit Graph

603 Commits

Author SHA1 Message Date
Donald Sharp
5a3cf85391 lib, zebra: Add ability to read kernel notice of TRAP/OFFLOAD
The linux kernel is getting RTM_F_TRAP and RTM_F_OFFLOAD for
kernel routes that have an underlying asic offload.  Write the
code to receive these notifications from the linux kernel and
to store that data for display about the routes.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-09-22 15:57:43 -04:00
Donald Sharp
4c56ce1cea zebra: Add basic knowledge of asic offload available
Some linux kernels are starting to support the idea of knowledge
about the underlying asic.  Add a boolean that we can set/unset
to track whether or not we think the router has this functionality
available.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-09-22 15:57:43 -04:00
Christophe Gouault
d58b6f7568 zebra: always display vrf in show ip route json
In route json outputs, always display the vrf even if it is the
default vrf.

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2020-09-21 10:07:56 +02:00
Christophe Gouault
6ac9404177 zebra: simplify and optimize vrf display in show ip route
In all outputs (text and json): simplify and optimize the vrf name
display, use the vrf_id_to_name() handler.

Note: vrf_id_to_name() has a safeguard system that prevents from
crashing when the vrf cannot be found because it changed in some
(unexpected) manner, it returns "n/a".

Note: "vrf n/a" will now be displayed instead of "vrf UNKNOWN" in this
case, like in most other frr components.

This safeguard was missing for show ip route json, so this
optimization also fixes a potential crash.

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2020-09-21 10:07:56 +02:00
Christophe Gouault
8277d4b796 zebra: fix show ip route output
Variable "show ip route" commands invoke the same helper
(do_show_ip_route), potentially several times.

When asking to dump a non-default vrf, all vrfs or all tables, the
output is messy, the header summarizing abbreviations is repeated
several times, excess line feeds appear, the default table of default
VRF is concatenated to the previous table output...

Normalize the output:

- whatever the case, display the common header at most once, if there
  is at least an entry to dump.

- when using a "vrf all" or "table all" command, prepend a line with
  the VRF and table (even for the default vrf or table).

- when dumping a specific vrf or table, prepend a line with the VRF
  and table.

Example (vrf all)
=================

router# show ip route vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF main:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:09
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:09
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:26

VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:00:29
C>* 10.125.0.0/24 is directly connected, loop0, 00:00:42

Example (main vrf)
==================

router# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:41
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:41
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:58

Example (specific vrf)
======================

router# show ip route vrf private
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:01:23
C>* 10.125.0.0/24 is directly connected, loop0, 00:01:36

Example (all tables)
====================

router# show ip route table all
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:01:51

VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:34
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:34
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:01:51

Example (all vrf, all table)
============================

router# show ip route table all vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:02:15

VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:58
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:58
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:02:15

VRF private table 200:
S>* 2.2.2.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18

VRF private table 254:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
C>* 10.125.0.0/24 is directly connected, loop0, 00:02:31

Example (specific table)
========================

router# show ip route table 200
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:05:26

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2020-09-21 10:07:56 +02:00
Donald Sharp
659d56e13f
Merge pull request #6755 from xThaid/dplane_batching
zebra: dataplane batching
2020-08-11 13:59:12 -04:00
Mark Stapp
ceb71630ed
Merge pull request #6870 from donaldsharp/test_fixups
Test fixups
2020-08-11 12:40:52 -04:00
Jakub Urbańczyk
531c92b82f tests: zebra netlink testcases
Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
2020-08-10 21:57:12 +02:00
Sebastien Merle
31f937fb43 lib, zebra: Add SR-TE policy infrastructure to zebra
For the sake of Segment Routing (SR) and Traffic Engineering (TE)
Policies there's a need for additional infrastructure within zebra.
The infrastructure in this PR is supposed to manage such policies
in terms of installing binding SIDs and LSPs. Also it is capable of
managing MPLS labels using the label manager, keeping track of
nexthops (for resolving labels) and notifying interested parties about
changes of a policy/LSP state. Further it enables a route map mechanism
for BGP and SR-TE colors such that learned BGP routes can be mapped
onto SR-TE Policies.

This PR does not introduce any usable features by now, it is just
infrastructure for other upcoming PRs which will introduce 'pathd',
a new SR-TE daemon.

Co-authored-by: Renato Westphal <renato@opensourcerouting.org>
Co-authored-by: GalaxyGorilla <sascha@netdef.org>
Signed-off-by: Sebastien Merle <sebastien@netdef.org>
2020-08-07 11:08:49 +02:00
Donald Sharp
a5897c41e4 zebra: Fix off by one error in no vni command
Commit: e2bcfa3946

Introduced a off by one error in the `no vni XXX` command:
@@ -2337,12 +2336,10 @@ DEFUN (no_vrf_vni_mapping,
        "VNI-ID\n"
        "prefix-routes-only\n")
 {
-       int ret = 0;
        int filter = 0;
-       char err[ERR_STR_SZ];
-       vni_t vni = strtoul(argv[2]->arg, NULL, 10);

        ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
+       vni_t vni = strtoul(argv[1]->arg, NULL, 10);

        assert(vrf);
        assert(zvrf);

Fix it.

Fixes: #6867
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-06 16:31:06 -04:00
Anuradha Karuppiah
374b316c1c zebra: CLI commands to display ethernet segments
1. ES sample display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# show evpn es
Type: L local, R remote
ESI                            Type ES-IF                 VTEPs
00:00:00:00:00:00:00:00:00:00       -
03:00:00:00:00:01:11:00:00:01  LR   hostbond1             27.0.0.16
03:00:00:00:00:01:22:00:00:02  LR   hostbond2             27.0.0.16
03:00:00:00:00:01:22:00:00:03  LR   hostbond3             27.0.0.16
03:00:00:00:00:02:11:00:00:01  R    -                     27.0.0.17,27.0.0.18
03:00:00:00:00:02:22:00:00:02  R    -                     27.0.0.17,27.0.0.18
03:00:00:00:00:02:22:00:00:03  R    -                     27.0.0.17,27.0.0.18
torm-11#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

2. ES-EVI sample display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# show evpn es-evi
Type: L local, R remote
VNI      ESI                            Type
1005     03:00:00:00:00:01:11:00:00:01  L
1005     03:00:00:00:00:01:22:00:00:02  L
1005     03:00:00:00:00:01:22:00:00:03  L
1002     03:00:00:00:00:01:11:00:00:01  L
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-05 06:46:12 -07:00
Russ White
996b789193
Merge pull request #6758 from chiragshah6/yang_nb6
EVPN northbound conversion for vrf l3vni mapping command
2020-07-28 07:22:24 -04:00
Renato Westphal
790953a387
Merge pull request #6765 from mjstapp/backup_nhg_netlink
lib,zebra: support multiple backup nexthops
2020-07-27 12:49:36 -03:00
Chirag Shah
e2bcfa3946 zebra: evpn l3vni map to vrf nb changes
The set of northbound changes for l3vni configuration
command under vrf.

vrf x
 vni 1000 prefix-routes-only

{
  "frr-vrf:lib": {
    "vrf": [
      {
        "name": "vrf1",
        "frr-zebra:zebra": {
          "l3vni-id": 4001
        }
      },
      {
        "name": "vrf2",
        "frr-zebra:zebra": {
          "l3vni-id": 4002,
          "prefix-only": true
        }
      }
    ]
  }
}

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-07-20 18:33:38 -07:00
Mark Stapp
3c0e16228d zebra: improve vty, simplify some primary/backup code
Improve vty output for routes and lsps with backups, including
json. Simplify or correct some code that uses both primary and
backup nexthops in dplane, nht.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-07-20 15:09:04 -04:00
Mark Stapp
e95f6d21d6 zebra: improve show output for routes with backups
Improve/clarify some show output for routes with backup
nexthops, esp. multiple backups.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-07-17 13:12:33 -04:00
Mark Stapp
474aebd939 lib,sharpd,zebra: initial support for multiple backup nexthops
Initial changes to support a nexthop with multiple backups. Lib
changes to hold a small array in each primary, zapi message
changes to support sending multiple backups, and daemon
changes to show commands to support multiple backups. The config
input for multiple backup indices is not present here.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-07-17 13:12:33 -04:00
Renato Westphal
2d1ddebc8b
Merge pull request #6706 from donaldsharp/router_id_bullshit
Router id vrf subnode configuration
2020-07-16 18:09:38 -03:00
David Lamparter
6cde4b4552 *: remove PRI[udx](8|16|32)
These are completely pointless and break coccinelle string replacements.

Scripted commit, idempotent to running:
```
python3 tools/stringmangle.py --pri8-16-32 `git ls-files | egrep '\.[ch]$'`
```

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-07-14 10:43:40 +02:00
Donald Sharp
03fba42ebb zebra: Allow router-id to be part of the vrf sub node
Modify zebra to accept router-id's as part of the
vrf subnode.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-07-09 11:57:22 -04:00
Mark Stapp
65d413f4a0 zebra: revise vty output for backup nexthops
Include backup nexthops in json output; function-ify the json
output for nexthops; revise the display of backup nexthops to
use the 'b' character.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-07-07 13:14:01 -04:00
Stephen Worley
e3dafc2580
Merge pull request #6227 from pguibert6WIND/show_nexthop_group_permit_netns
zebra: permit usage of show nexthop-group with namespace based vrfs
2020-05-13 10:53:52 -04:00
Philippe Guibert
2f90b900c8 zebra: permit usage of show nexthop-group with namespace based vrfs
namespace based vrfs can be used along with show nexthop-group command.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-05-13 14:24:36 +02:00
Donald Sharp
630d596249 zebra: Remove typedef rib_table_info_t from system
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-05-08 08:10:49 -04:00
Donald Sharp
f921557186 zebra: Remove typedef rnh_type_t from system
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-05-08 08:10:49 -04:00
Donald Sharp
a83014ccd6
Merge pull request #6247 from FRRouting/nb_conversions
Merge nb_converions branch to master
2020-04-16 19:39:14 -04:00
Chirag Shah
d36228c956 zebra: convert clear evpn dup addr command to nb
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-04-16 08:17:59 -07:00
Chirag Shah
e20755b23e zebra: clear dup detect cleanup for nb conversion
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-04-16 08:13:15 -07:00
David Lamparter
f4b8291fcb *: move CLI node names to cmd_node->name
And again for the name.  Why on earth would we centralize this, just so
people can forget to update it?

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:59 +02:00
David Lamparter
612c2c15d8 *: remove second parameter on install_node()
There is really no reason to not put this in the cmd_node.

And while we're add it, rename from pointless ".func" to ".config_write".

[v2: fix forgotten ldpd config_write]

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
249a771b63 *: remove cmd_node->vtysh
The only nodes that have this as 0 don't have a "->func" anyway, so the
entire thing is really just pointless.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
62b346eefa *: clean up cmd_node initializers
... and use named assignments everywhere (so I can change the struct.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
vivek
ae0eaca5ce zebra: Display next hop's weight (if any) in route brief output
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2020-03-30 20:12:32 -07:00
vivek
09bdb655f7 zebra: Display next hop weight via JSON key
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2020-03-30 20:12:31 -07:00
Mark Stapp
accf6280fc zebra: include backup info in show ip route
Add backup nexthop info to the show output (if present).

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-27 11:50:03 -04:00
Mark Stapp
eeafa8cd43 zebra: include backup nexthops in nhe/nhg show output
Include backup nexthops (if any) in the output of 'show
nexthop-group xxx'.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-27 11:50:03 -04:00
Mark Stapp
d0636ead31 lib, *: add a common time interval formatting api
Add a common api that formats a time interval into a string
with different output for short and longer intervals. We do
this in several places, for cli/ui output.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-09 11:12:32 -04:00
Donatas Abraitis
0d6f7fd6fd *: Replace sizeof something to sizeof(something)
Satisfy checkpatch.pl requirements (check for sizeof without parenthesis)

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-08 21:44:53 +02:00
Quentin Young
5d2724ec25
Merge pull request #5916 from mjstapp/fix_gmtime
*: use gmtime_r exclusively
2020-03-05 17:38:13 -05:00
Mark Stapp
a2700b5071 *: use gmtime_r, localtime_r exclusively
Stop using gmtime() or localtime() everywhere.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-05 13:26:16 -05:00
Mark Stapp
c5babc8c60 zebra: clean up an SA warning in show_ip_route_all
SA reports a redundant NULL check; remove it.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-05 08:35:55 -05:00
Mark Stapp
890b3450ea
Merge pull request #5859 from donaldsharp/clang_latest
Clean up clang latest SA warnings
2020-02-28 07:51:52 -05:00
Stephen Worley
f16e992d37
Merge pull request #5857 from mjstapp/embed_nhg_in_nhe
zebra,lib: Embed lib nexthop-group in zebra hash entry
2020-02-27 18:43:59 -05:00
Mark Stapp
c415d89528 zebra: Embed lib nexthop-group in zebra hash entry
Embed nexthop-group, which is just a pointer, in the zebra
nexthop-hash-entry object, rather than mallocing one.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-02-27 15:49:31 -05:00
Donald Sharp
2acf1ad1dd zebra: Cleanup set but unused variables
There existed some variables set but never used.  Clean this up.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-27 09:41:58 -05:00
Thibaut Collet
7e0f48c75d vty: add command to get route with table, vrf and protocol
Today vtysh can show the ip/ip6 routes through several commands:
- show_route_cmd
- show_route_detail_cmd
- show_route_summary_cmd
- show_route_table_cmd
- show_route_table_vrf_cmd
- show_route_all_table_vrf_cmd

Each command has its own set of filter rules:
- show_route_cmd can filter by vrf, protocol, tag, ... but not by table
- show_route_table_cmd always filter by table
- show_route_table_vrf_cmd always filter by table and can filter by vrf
too
- show_route_all_table_vrf_cmd show all route in any table for a vrf (or
all)

To reduce the number of commands and provide a possibility to filter by
any key add possibility for the show_route_cmd to filter by table with a
specific value or all to get route in all tables.

Then the show_route_table_cmd, show_route_table_vrf_cmd and
show_route_all_table_vrf_cmd functions can be removed as they are covered
by the generic show_route_cmd function.

It is to be noted that when zebra is started by default, it is possible
to execute show ip route command with both vrf and table parameters,
whereas before the command was not displayed. This is due to the fact
that this combination is only permitted when zebra is launched with vrf
network namespace mode. There, if zebra is configured with vrf-lite
backend, then a vty error message informs the user that the combination
of both table and vrf is not possible.

Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
2020-02-11 17:07:47 +01:00
Renato Westphal
b2ce558967
Merge pull request #5739 from mjstapp/nhg_show_ordered
zebra: show zebra nexthop-groups without copying
2020-02-04 13:37:24 -03:00
Mark Stapp
b5e02d19dc zebra: show zebra nexthop-groups without copying
Use a hash walker/iterator instead of a temporary list to
show zebra's nexthop-groups/nexthop-hash-entries.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-02-04 08:39:41 -05:00
Russ White
05d0c66d8f
Merge pull request #5737 from mjstapp/zebra_disable_kern_nhs
zebra: add config to disable use of kernel nexthops
2020-02-04 08:12:34 -05:00
Donald Sharp
88cafda739 zebra: nexthop groups vrf's are only a function of namespaces
Nexthop groups as a whole do not make sense to have a vrf'ness
As that you can have a arbitrary number of nexthops that point
to separate vrf's.

Modify the code to make this distinction, by clearly delineating
the line between the nhg and the nexthop a bit better.
Nexthop groups having a vrf_id only make sense if you are using
network namespaces to represent them.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-01-31 08:45:51 -05:00
Donald Sharp
417f01b751 zebra: Modify 'show nexthop-group rib ip|ipv6'
The zebra implementation of nexthop groups has
two types of nexthops groups currently.  Singleton
objects which have afi's and combined nexthop groups
that do not.  Specifically call this out in the code
to make this distinction.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-01-31 08:26:39 -05:00
Mark Stapp
7c99d51beb zebra: add config to disable use of kernel nexthops
Add a config that disables use of kernel-level nexthop ids.
Currently, zebra always uses nexthop ids if the kernel supports
them.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-01-28 11:00:42 -05:00
Mark Stapp
2553fde18d zebra: make current show nexthop-group cli zebra-specific
There's confusion between the nexthop-group configuration and a
zebra-specific show command. For now, make the zebra show
command string RIB-specific until we're able to unify these
paths.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-01-08 09:01:19 -05:00
Quentin Young
6498fc458d
Merge pull request #5508 from ton31337/feature/show_ip_route_summary_json
zebra: Print json output for show_route_summary_cmd
2019-12-17 10:05:13 -05:00
Donatas Abraitis
e7deb7e791 zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
  "routes":[
    {
      "fib":1,
      "rib":1,
      "type":"kernel"
    },
    {
      "fib":11,
      "rib":11,
      "type":"connected"
    },
    {
      "fib":2,
      "rib":2,
      "type":"ebgp"
    },
    {
      "fib":1,
      "rib":1,
      "type":"ibgp"
    }
  ],
  "routesTotal":15,
  "routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
  "routes":[
    {
      "fib":7,
      "rib":7,
      "type":"connected"
    }
  ],
  "routesTotal":7,
  "routesTotalFib":7
}
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-12 17:20:11 +02:00
Donald Sharp
bd054c1aa2 lib, zebra: Allow for encode/decode of nexthop weight in pass down
Add code to encode/decode the nexthop weight when we pass it down
into zebra.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-09 13:37:37 -05:00
Donald Sharp
e302caaa81
Merge pull request #5416 from mjstapp/re_nhe_pointer
lib,zebra: use shared nexthop-group in route_entry
2019-12-04 14:11:04 -05:00
Mark Stapp
0eb97b860d lib,zebra: use nhg_hash_entry pointer in route_entry
Replace the existing list of nexthops (via a nexthop_group
struct) in the route_entry with a direct pointer to zebra's
new shared group (from zebra_nhg.h). This allows more
direct access to that shared group and the info it carries.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-04 08:13:52 -05:00
Lakshman Krishnamoorthy
06931fdb12 zebra: "show evpn vni details json" prints incorrect JSON format
edge-2> show evpn vni detail json
{
  "vni":79031,
  "type":"L3",
  ...,
  ...
}                                       <<<<<< no comma

{
  "vni":79021,
  "type":"L3",
  ...,
  ...
}                                       <<<<<< no comma

{
}                                       <<<<<< blank
edge-2>

The fix is to pack json info into json_array before printing it.

Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-11-21 16:18:04 -08:00
Stephen Worley
c7c0b007a4 zebra: separate zebra_vrf_lookup_table_with_id()
We were creating `other` tables in rib_del(), vty commands, and
dataplane return callback via the zebra_vrf_table_with_table_id()
API.

Seperate the API into only a lookup, never create
and added another with `get` in the name (following the standard
we use in other table APIs).

Then changed the rib_del(), rib_find_rn_from_ctx(), and show route
summary vty command to use the lookup API instead.

This was found via a crash where two different vrfs though they owned
the table. On delete, one free'd all the nodes, and then the other tried
to use them. It required specific timing of a VRF existing, going away,
and coming back again to cause the crash.

=23464== Invalid read of size 8
==23464==    at 0x179EA4: rib_dest_from_rnode (rib.h:433)
==23464==    by 0x17ACB1: zebra_vrf_delete (zebra_vrf.c:253)
==23464==    by 0x48F3D45: vrf_delete (vrf.c:243)
==23464==    by 0x48F4468: vrf_terminate (vrf.c:532)
==23464==    by 0x13D8C5: sigint (main.c:172)
==23464==    by 0x48DD25C: quagga_sigevent_process (sigevent.c:105)
==23464==    by 0x48F0502: thread_fetch (thread.c:1417)
==23464==    by 0x48AC82B: frr_run (libfrr.c:1023)
==23464==    by 0x13DD02: main (main.c:483)
==23464==  Address 0x5152788 is 104 bytes inside a block of size 112 free'd
==23464==    at 0x48369AB: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==23464==    by 0x48B25B8: qfree (memory.c:129)
==23464==    by 0x48EA335: route_node_destroy (table.c:500)
==23464==    by 0x48E967F: route_node_free (table.c:90)
==23464==    by 0x48E9742: route_table_free (table.c:124)
==23464==    by 0x48E9599: route_table_finish (table.c:60)
==23464==    by 0x170CEA: zebra_router_free_table (zebra_router.c:165)
==23464==    by 0x170DB4: zebra_router_release_table (zebra_router.c:188)
==23464==    by 0x17AAD2: zebra_vrf_disable (zebra_vrf.c:222)
==23464==    by 0x48F3F0C: vrf_disable (vrf.c:313)
==23464==    by 0x48F3CCF: vrf_delete (vrf.c:223)
==23464==    by 0x48F4468: vrf_terminate (vrf.c:532)
==23464==  Block was alloc'd at
==23464==    at 0x4837B65: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==23464==    by 0x48B24A2: qcalloc (memory.c:110)
==23464==    by 0x48EA2FE: route_node_create (table.c:488)
==23464==    by 0x48E95C7: route_node_new (table.c:66)
==23464==    by 0x48E95E5: route_node_set (table.c:75)
==23464==    by 0x48E9EA9: route_node_get (table.c:326)
==23464==    by 0x48E1EDB: srcdest_rnode_get (srcdest_table.c:244)
==23464==    by 0x16EA4B: rib_add_multipath (zebra_rib.c:2730)
==23464==    by 0x1A5310: zread_route_add (zapi_msg.c:1592)
==23464==    by 0x1A7B8E: zserv_handle_commands (zapi_msg.c:2579)
==23464==    by 0x19D689: zserv_process_messages (zserv.c:523)
==23464==    by 0x48F09F8: thread_call (thread.c:1599)

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-11-01 16:06:19 -04:00
Stephen Worley
c1da832a94 zebra: Change wording of duplicate kernel nhg flag
Change the wording of the flag indicating we have received
a nexthop group from the kernel with a different ID but
is fundamentally identical to one we already have.

It was colliding with a flag of similar name in the nexthop struct.

Change it from NEXTHOP_GROUP_DUPLICATE -> NEXTHOP_GROUP_UNHASHABLE
since it is in fact unhashable.

Also change the wording of functions and comments referencing the same
problem.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:44 -04:00
Stephen Worley
fec211ad95 zebra: Zebra nexthop group re-work checkpatch fixes
Checkpatch fixes for the zebra nexthop group re-work.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:43 -04:00
Stephen Worley
d7b5921c58 zebra: Update ip route show with nexthop_num API
Switch the nexthop_num dereferences to use the nexthop_group
API in `vty_show_ip_route()`.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:43 -04:00
Stephen Worley
61d9ffe168 zebra: Only show route nexthop group ID when asked
In lieu of the fact that we probably shouldn't change show
command output too much, changing this to only give nhe_id
output when the user explicitly asks for it. Probably only
going to be used for debugging for now anyway.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:43 -04:00
Stephen Worley
0ad40d1615 zebra: Add nhe_id to show ip route detailed
When querying for detailed route information, show the nexthop
group id for its nh_hash_entry in the output before listing the
nexthops.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:42 -04:00
Stephen Worley
df9069cd18 zebra: Add some more output to show nexthop-group
Add some more detailed output to `show nexthop-group`.
It closely resembles the output of `show ip routes`.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:42 -04:00
Stephen Worley
37c6708b93 zebra: Switch nhg_connected to use new RB tree
Switch the nhg_connected tree structures to use the new
RB tree API in `lib/typerb.h`. We were using the openbsd-tree
implementation before.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:41 -04:00
Stephen Worley
1e9aad82ba zebra: Add cli show NHE by ID and interface groups
Add cli to show nhg_hash_entry's by ID.

Add cli to show nhg_hash_entry info for interfaces and remove
just listing ID's in `show interface *`

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:40 -04:00
Stephen Worley
2d3c57e671 zebra: NHG checkpatch fixes
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:40 -04:00
Stephen Worley
a15d4c0089 zebra: Abstract the RB nodes/add dependents tree
Create a nhg_depenents tree that will function as a way
to get back pointers for NHE's depending on it.

Abstract the RB nodes into nhg_connected for both depends and
dependents. This same struct is used for both.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:39 -04:00
Stephen Worley
0c8215cbab zebra,lib: Refactor depends to RB tree
Refactor the depends to use an RB tree instead of a list.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:39 -04:00
Stephen Worley
8e401b251f zebra: Refactor nexthop group creation code to use allocated memory
Simplify the code for nexthop hash entry creation. I made nexthop
hash entry creation expect the nexthop group and depends to always
be allocated before lookup. Before, it was only allocated if it had
dependencies. I think it makes the code a bit more readable to go
ahead an allocate even for single nexthops as well.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:38 -04:00
Stephen Worley
cced3a2d29 zebra: Make show nexthop-group <null> list all nexthop hash entries
Add an option to not specify the afi in the show nexthop-group
command so that it shows all nexthops, including groups. This is
how iproute2 does it. If the afi is given, it will only show single
nexthops since groups are AF_UNSPEC.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:38 -04:00
Stephen Worley
77b76fc900 Revert "zebra: Remove afi field in nexthop hash entry"
This reverts commit be73fe9393aac58c7f4bdb5c8a98c24c6cda6d5d.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:38 -04:00
Stephen Worley
2614bf8764 zebra: Add ifp to zebra-side rib_add
Add an interface pointer for an nexthop group hash entry
when we are getting a rib_add for a new route.

Also, add the interface index to the `show nexthop-group` command.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:37 -04:00
Stephen Worley
a53a11f218 zebra: Make show nexthop-group command more readable
Put some whitespace into the command output so that
we can read it a little bit easier.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:37 -04:00
Stephen Worley
8b5bdc8bdf zebra: Remove afi field in nexthop hash entry
I do not believe we should be hashing based on AFI
in for our upper level nexthop group entries. These
should be ambiguous with regards to  address families since
an ipv4 or ipv6 address can have the same interface
nexthop. This can be seen in NEXTHOP_TYPE_IFINDEX.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:36 -04:00
Donald Sharp
6b46851168 zebra: Replace nexthop_group with pointer in route entry
In the route_entry we are keeping a non pointer based
nexthop group, switch the code to use a pointer for all
operations here and ensure we create and delete the memory.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25 11:13:36 -04:00
Donald Sharp
c8ee3cdb39 zebra: Add some basic flags to the zebra nexthop group
We need to track if a nexthop group is valid and installed,
so create some basic flags to track this.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25 11:13:35 -04:00
Donald Sharp
21be136402 zebra: Add show command to dump nexthop-group information for Zebra
Just a simple addition of a command to dump the nexthop group information.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25 11:13:35 -04:00
Donald Sharp
8f79e2cf65 zebra: zrt->table cannot crash here
If we have a zrt data structure then we have a table pointer
as well.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-16 13:38:29 -04:00
Donald Sharp
7e933bc159
Merge pull request #5058 from mjstapp/fix_dplane_config_handler
zebra: handle config write for dataplane values
2019-09-25 16:47:47 -04:00
Mark Stapp
f26730e17e zebra: handle config write for dataplane values
Add the (single) dataplane config value to the output of
config write, 'show run' - missed this during dplane development.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-09-25 14:05:50 -04:00
Kishore Aramalla
c1066ba002 zebra: Added vrfname to route prefix dictionary
Route prefix dictionary contains vrf ID only.
Added vrfName to the route prefix dictionary.

Signed-off-by: Kishore Aramalla <karamalla@vmware.com>
2019-09-19 14:28:11 -07:00
Donald Sharp
ae813e21a6 zebra: Modify show ip route summary to allow you to specify a table
Add a bit of extra command `show ip route summary table XXX`
To allow end user to specify a specific table that they want
summary information on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-11 08:16:18 -04:00
Donald Sharp
9d55926924
Merge pull request #4892 from pguibert6WIND/nhtresolvedefaultvrf
zebra: nht resolution default configurable per vrf
2019-09-03 15:40:43 -04:00
Philippe Guibert
5a0bdc782c zebra: nht resolution default configurable per vrf
even if vty commands were available, the default resolution command was
working only for the first vrf configured. others were ignored. Also,
for nexthop, resolution was working for all vrfs, and not the specific
one.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-08-28 16:19:34 +02:00
vdhingra
d4c7ac0105 zebra: Added a few more information in route_entry while dumping
re->nexthop_num and re->nexthop_active_num are calculated while rib
processing. Also It helps in encoding the ZAPI message.
It's good to dump these parameters also, when the system is in
abnormal state.

Signed-off-by: vishaldhingra<vdhingra@vmware.com>
2019-08-23 06:02:53 -07:00
Donald Sharp
94a01fb26e zebra: Allow v4 or v6 addresses to be optional after vrf X in show ip nht
The `show ip nht vrf EVA ...` command was not allowing you to only
specify the vrf anymore.  Fix this:

robot# show ip nht vrf EVA
  <cr>
  A.B.C.D   IPv4 Address
  X:X::X:X  IPv6 Address
robot# show ip nht vrf EVA 4.5.6.7
robot# show ip nht vrf EVA
robot#

Ticket: CM-25831
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-07 15:02:43 -04:00
Chirag Shah
155b4398b4 zebra: fix evpn dad clear cmd mac parsing
The changes came as part of PR #4730, checks
only variable mac, which is never null. Even
for ip version of cli hits "mac" case statement
and failing the clear cli.

Testing Done:

Before Fix:

VTEP-03# show evpn arp-cache vni 1002 duplicate
VNI 1002 #ARP (IPv4 and IPv6, local and remote) 1

IP                        Type   State    MAC               Remote VTEP
Seq #'s
11.11.11.11               remote active   aa:22:aa:aa:aa:aa 27.0.0.16
7/8

VTEP-03# clear evpn dup-addr vni 1002 ip 11.11.11.11
% Requested MAC does not exist in VNI 1002

Post fix:

VTEP-03# clear evpn dup-addr vni 1002 ip 11.11.11.11
VTEP-03#

VTEP-03# show evpn mac vni all duplicat
VNI 1002 #MACs (local and remote) 1

MAC               Type   Intf/Remote VTEP      VLAN  Seq #'s
aa:aa:aa:aa:aa:aa remote 27.0.0.16                   7/8

Post fix:

VTEP-03# clear evpn dup-addr vni 1002 mac aa:aa:aa:aa:aa:aa
VTEP-03#

VTEP-03# clear evpn dup-addr vni 1002 ip 11.11.11.11
VTEP-03#

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-07-31 14:09:08 -07:00
Russ White
0cd8c0ff11
Merge pull request #4650 from pguibert6WIND/show_ip_route_table_all
zebra: add show ip route all command to dump all unicast tables
2019-07-30 11:18:10 -04:00
Igor Ryzhov
f65d330cbc lib: fix missing M:A:C to X:X:X:X:X:X changes
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-07-25 17:15:27 +03:00
Philippe Guibert
e2256d2e87 zebra: show ip route all command displays all tables from all vrfs
initially, that command was dumping only tables from default vrfs.
the change here consists in dumping all the tables from all the vrfs.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-07-09 14:32:24 +02:00
Philippe Guibert
234963a589 zebra: display the table identifier along with table and entries
the table identifier is made visible. this permits to easily know which
table identifier is dumped, or which table that entry belongs to, when
one calls 'show ip route all' command.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-07-09 14:32:20 +02:00
Philippe Guibert
16c42fba57 zebra: add show ip route all command to dump all unicast tables
this vty command explores the routing tables available, and dumps the
routing entries. there is no need to pass a table identifier, since all
configured tables are dumped.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-07-09 12:16:28 +02:00
Donald Sharp
fe257ae733 zebra: Push VRF_DEFAULT outside of import table code
The import table code assumes that they will only work
in the default vrf.  This is ok, but we should push the
vrf_id and zvrf to be passed in instead of just using
VRF_DEFAULT.

This will allow us to fix a couple of things:

1) A bug in import where we are not creating the
route entry with the appropriate table so the imported
entry is showing up in the wrong spot.

2) In the future allow `ip import-table X` to become
vrf aware very easily.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-25 17:47:41 -04:00
Donald Sharp
a36898e755
Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
Donald Sharp
a12bb225a6
Merge pull request #3775 from pguibert6WIND/ospf_missing_interface_handling_2
Ospf missing interface handling 2
2019-06-22 13:35:45 -04:00
David Lamparter
b41b3f7bf1 lib/clippy: expand some macros
At least the "easy" cases of macros work.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-12 19:23:00 +02:00
Philippe Guibert
ac6c2a11a6 lib: create interface upon accessing interface NB API.
Upon accessing interface NB API, the interface is created, if the vrf
is available. the commit does not change the behaviour, since at this
commit, this is not yet possible to have vrf contexts, while zebra did
not connect to daemons. However, that commit adds some work, so that it
will be possible to work on a vrf context, without having the vrf_id
completely resolved. for instance, if we suppose a vrf is created by
command 'vrf TOTO' in the starting configuration of a daemon, then 'interface
TITI vrf TOTO' will permit to create interface TITI within vrf TOTO.

the macro VRF_GET_INSTANCE will return the vrf context, if available or
not.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 08:37:58 +02:00
Mark Stapp
941e261c97 zebra: share rib processing of updates and notifications
Use some common handling for both route update results
processing and dataplane notification processing. Use the
fib-specific nexthop-group if the update to a route results
in different nexthop status than the default rib-provided
nexthop-group.

Use the fib-specific nexthop-group, if present, to provide
the output of 'show ip fib'.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-05-28 08:34:21 -04:00
Donald Sharp
543c749625
Merge pull request #4296 from adharkar/frr-master-fib_prefix
Zebra: Add "show ip/ipv6 fib <prefix> [json]" CLI
2019-05-14 21:46:38 -04:00
Donald Sharp
98572489ea zebra: Switch to using monotime(NULL) for re->uptime
The re->uptime usage of time(NULL) leaves it open to
timing changes from outside influence.  Switching
to monotime allows us to ensure that we have a timestamp
that is always increasing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-11 01:44:42 -04:00
Ameya Dharkar
ad2e7233a4 Zebra: "show ip/ipv6 route/fib prefix" prefix not found cases
1. If prefix not found, print "{}" for json
2. Print "Network not in table" for route option
3. Print "Network not in FIB" for fib option
4. Take care of "show ip route/fib vrf all prefix" command.

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2019-05-10 12:12:44 -07:00
Ameya Dharkar
3a3be633cc Zebra: Add "show ip/ipv6 fib <prefix> [json]" CLI - review comments 1
According to the review comments, added "Network not in FIB" message when we do
not have a FIB route present for given prefix.

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2019-05-09 14:23:23 -07:00
Ameya Dharkar
6a794a7e83 Zebra: Add "show ip/ipv6 fib <prefix> [json]" CLI
"show ip/ipv6 route <prefix> [json]" uses a different parser chain from
"show ip/ipv6 route [json]".
"show ip/ipv6 route <prefix> [json]" CLI does not support "fib" option.

Fix:
Add "fib" option to the above command.
The new command is: "show ip/ipv6 <route/fib> <prefix> [json]"
If "fib" option is specified, we will show only the selected routes
(Similar to "show ip/ipv6 fib")

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2019-05-08 14:26:49 -07:00
Donald Sharp
c447ad08b2 doc, zebra: Remove "table X" command
This command is broken and has been broken since the introduction
of vrf's.  Since no-one has complained it is safe to assume that
there is no call for this specialized linux command.  Remove
from the system with extreme prejudice.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-06 13:42:23 -04:00
Donald Sharp
d2f5903b84 zebra: Add hidden 'show frr' command
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-12 10:27:52 -04:00
Donald Sharp
dbeca4841b zebra: Allow specification of v[4|6] addrs on some commands
The `show ipv[4|6] <nht|import-check> ...` commands are starting
to produce a bunch of output due to multiple daemons now
using the code.  Allow the specification of a v4 or v6 address
to allow the show command to only display the interesting nht.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-05 11:34:22 -04:00
Tuetuopay
d074383c62
Merge branch 'master' into evpn-session-vrf 2019-03-28 18:41:38 +01:00
Donald Sharp
13551afd80
Merge pull request #4017 from mjstapp/fix_summary_installed_flag
zebra: use the INSTALLED flag consistently in route summary
2019-03-27 08:40:12 -04:00
Mark Stapp
6f875a362a zebra: use the INSTALLED flag consistently in route summary
The 'sho ip route summary' and 'sho ip route summary <prefix>'
paths used different definitions of a 'fib' route. Use
the route-entry 'INSTALLED' flag in both places.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-03-25 13:35:02 -04:00
Philippe Guibert
41533022a2 zebra: remove duplicated json information
the metric information is already present for connected routes. so
remove that line.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-03-25 15:02:52 +01:00
Tuetuopay
8f2ff1b5b0 zebra/vty: Don't hide VNI config for default VRF
Since the EVPN session and underlay can be in a non-default VRF, the
default VRF can be an overlay VRF.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:25 +01:00
Tuetuopay
530db8dc03 bgpd, zebra: Scope EVPN commands to EVPN VRF
If the EVPN VRF is not the default one (i.e. with advertise-all-vni),
this allows showing its information with `show bgp l2evpn evpn ...`
commands. They do not require adding `vrf VRFNAME` since we only
support a single EVPN VRF. The same is true for zebra-specific commands
(e.g. `show evpn ...`).

Configuration commands are not restricted to the default VRF but to
the EVPN one, that is to the one bearing `advertise-all-vni`.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:25 +01:00
Donald Sharp
1e03ae0dc7 zebra: Allow json output to give a bit more data
The dest->selected_fib should be reported in json output
so that we can debug subtle conditions a bit better in the
future.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-09 20:28:49 -05:00
Donald Sharp
e625a783ed zebra: Do not display recursive nexthops as installed
Recursive nexthops should not be marked as installed

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-05 15:21:26 -05:00
Renato Westphal
3524352154
Merge pull request #3698 from donaldsharp/netlink_is_serious_business
Netlink is serious business
2019-02-05 11:52:33 -02:00
Donald Sharp
5ec5a7160a zebra: Move packets_to_process to zrouter
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31 09:20:46 -05:00
Donald Sharp
489a961429 zebra: Move ribq from zebrad to zrouter
The zrouter should own this data structure and it should not
be defined in zserv.h

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31 09:20:46 -05:00
Donald Sharp
b3d43ff471 zebra: Move rtm_table_default to zrouter
The zrouter should own this particular piece of data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31 09:20:46 -05:00
Donald Sharp
b0538fc8b7 lib, zebra: Fix 'show ip route' char collision
Apparently 'f' means both OpenFabric and a Failed kernel
route installation.

Let's switch the 'f' for the failed kernel route installation
to 'r - rejected route'.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-29 20:41:36 -05:00
Donald Sharp
677c1dd5cb zebra: Use ROUTE_ENTRY_INSTALLED as decision for route is installed
zebra is using NEXTHOP_FLAG_FIB as the basis of whether or not
a route_entry is installed.  This is problematic in that we plan
to separate out nexthop handling from route installation.  So modify
the code to keep track of whether or not a route_entry is installed/failed.

This basically means that every place we set/unset NEXTHOP_FLAG_FIB, we
actually also set/unset ROUTE_ENTRY_INSTALLED on the route_entry.
Additionally where we check for route installed via NEXTHOP_FLAG_FIB
switch over to checking if the route think's it is installed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-25 20:16:15 -05:00
Donald Sharp
4a2f796f2e lib, zebra: Abstract character selection for nexthop display
When we are selecting nexthops for disply, abstract the notion
of what character we display to the end user about the status
of the nexthop.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-25 20:14:38 -05:00
Anuradha Karuppiah
059c79ba30 zebra: display metric for connected routes
In a VRR/VRRP setup we can have connected routes with different costs.
So this change eliminates suppressing metric display for connected routes.

Sample output -
root@TORC11:~# vtysh -c "show ipv6 route vrf vrf1"
Codes: K - kernel route, C - connected, S - static, R - RIPng,
       O - OSPFv3, I - IS-IS, B - BGP, N - NHRP, T - Table,
       v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR,
       > - selected route, * - FIB route

VRF vrf1:
K * ::/0 [255/8192] unreachable (ICMP unreachable), 00:00:36
C * 2001:aa:1::/64 [0/100] is directly connected, vlan1002-v0, 00:00:36
C>* 2001:aa:1::/64 [0/90] is directly connected, vlan1002, 00:00:36

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-01-25 14:19:26 -05:00
Renato Westphal
7004c67b35 zebra: merge four "show ip nht" commands into a single DEFPY
This is mostly to be consistent with the "show ip import-check"
command, which is very similar.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-21 13:26:54 -02:00
Renato Westphal
73bf60a06b zebra: consolidate how we indentify address-families in the NHT code
Favor usage of the afi_t enumeration to identify address-families
over using the classic AF_INET[6] constants for that. The choice to
use either of the two seems to be mostly arbitrary throughout our
code base, which leads to confusion and bugs like the one fixed by
commit 6f95d11a1. To address this problem, favor usage of the afi_t
enumeration whenever possible, since 1) it's an enumeration (helps
the compilers to catch some bugs), 2) has a safi_t sibling and 3)
can be used to index static arrays. AF_INET[6] should then be used
only when interfacing with the kernel or external libraries like
libc. The family2afi() and afi2family() functions can be used to
convert between the two different representations back and forth.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-21 13:26:36 -02:00
Renato Westphal
6f95d11a17 zebra: fix the "show ip import-check" command
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-18 14:21:42 -02:00
Donald Sharp
ac5aa23f93 zebra: Add a dump table information command to zebra
Allow zebra to dump the table information it has from a router perspective.

This table looks like this:
donna.cumulusnetworks.com# show zebra router table summary
VRF             NS ID    VRF ID     AFI            SAFI    Table      Count
---------------------------------------------------------------------------
default             0         0    IPv4         unicast       49          1
default             0         0    IPv4         unicast      254          7
default             0         0    IPv4       multicast      254          9
default             0         0    IPv6         unicast      254          1
default             0         0    IPv6       multicast      254          1
BLUE                0        31    IPv4         unicast     1005          0
BLUE                0        31    IPv4       multicast     1005          0
BLUE                0        31    IPv6         unicast     1005          0
BLUE                0        31    IPv6       multicast     1005          0

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04 09:48:40 -05:00
Philippe Guibert
b85c827591 zebra: add command show ip/ipv6 import-check table
Add the ability to dump import check nexthop table.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-12-17 12:19:28 +01:00
Donald Sharp
9e7cd6fdca zebra: show ip route A.B.C.D json would only show last route entry
The `show ip route A.B.C.D json` command was only displaying
the last route entry looked at and we would drop the data
associated with other route entries.  This fixes the issue:

robot# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route

K>* 0.0.0.0/0 [0/100] via 192.168.201.1, enp3s0, 00:13:31
C>* 4.50.50.50/32 is directly connected, lo, 00:13:31
D   10.0.0.1/32 [150/0] via 192.168.201.1, enp3s0, 00:09:46
S>* 10.0.0.1/32 [1/0] via 192.168.201.1, enp3s0, 00:10:04
C>* 192.168.201.0/24 is directly connected, enp3s0, 00:13:31
robot# show ip route 10.0.0.1 json
{
  "10.0.0.1\/32":[
    {
      "prefix":"10.0.0.1\/32",
      "protocol":"sharp",
      "distance":150,
      "metric":0,
      "internalStatus":0,
      "internalFlags":1,
      "uptime":"00:09:50",
      "nexthops":[
        {
          "flags":1,
          "ip":"192.168.201.1",
          "afi":"ipv4",
          "interfaceIndex":2,
          "interfaceName":"enp3s0",
          "active":true
        }
      ]
    },
    {
      "prefix":"10.0.0.1\/32",
      "protocol":"static",
      "selected":true,
      "distance":1,
      "metric":0,
      "internalStatus":0,
      "internalFlags":2064,
      "uptime":"00:10:08",
      "nexthops":[
        {
          "flags":3,
          "fib":true,
          "ip":"192.168.201.1",
          "afi":"ipv4",
          "interfaceIndex":2,
          "interfaceName":"enp3s0",
          "active":true
        }
      ]
    }
  ]
}
robot#

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-05 15:12:50 -05:00
Sri Mohana Singamsetty
ad31e8d398
Merge pull request #3372 from nitinsoniism/show_evpn_mac_vni_all_detail
zebra: Add "show evpn mac vni all detail" command
2018-12-04 10:19:18 -08:00
David Lamparter
21e2819dbf
Merge pull request #3340 from nitinsoniism/show_evpn_vni_detail
zebra: Add "show evpn vni detail" command
2018-12-04 17:29:50 +01:00
Chirag Shah
1883de666f zebra: dup addr detect clear cmd non-zero return
Clear dup address vni needs to return non-zero value
in case of command is not successful.

Ticket:CM-23122
Testing Done:
run clear command and check upon failure return code is non-zero.

root@TORS1:~# vtysh -c "clear evpn dup-addr vni 1000 ip 45.0.1.26"
% Requested IP's associated MAC 00:01:02:03:04:05 is still in duplicate
% state
root@TORS1:~# echo $?
1

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-12-03 16:56:00 -08:00
Nitin Soni
e3fac9195d zebra: Add "show evpn arp-cache vni all detail" command
Change helps display detailed output for all possible VNI neighbors
without specifying VNI and ip. It helps in troubleshooting as a single
command can be fired to capture detailed info on all VNIs.

Ticket: CM-22832
Signed-off-by: Nitin Soni <nsoni@cumulusnetworks.com>
Reviewed-by: CCR-8034
2018-11-27 05:56:56 -08:00
Nitin Soni
cffe7580fd zebra: Add "show evpn mac vni all detail" command
Change helps display detailed output for all possible VNI MACs without
specifying VNI or mac. It helps in troubleshooting - a single
command can be fired to capture detailed info on all VNIs.
Also fixed and existing json related bug where json object is created by
a parent function and freed in child function.

Ticket: CM-22832
Signed-off-by: Nitin Soni <nsoni@cumulusnetworks.com>
Reviewed-by: CCR-8028
2018-11-27 05:44:48 -08:00
Nitin Soni
09af6961d4 zebra: Add "show evpn vni detail" command
Change helps display detailed output for all possible VNIs without
specifying VNI. It helps in troubleshooting - a single command can
be fired to capture detailed info on all VNIs.

Ticket: CM-22831
Signed-off-by: Nitin Soni <nsoni@cumulusnetworks.com>
Reviewed-by: CCR-8013
2018-11-21 08:13:01 -08:00
Chirag Shah
09de9258a9 zebra: dup addr detect clear command
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-11-17 19:22:17 -08:00
Chirag Shah
1374d4dbc2 zebra: dup addr detect operation commands
Display duplicate detected list of MACs and VNIs.
- Per VNI
- Across all VNIs

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-11-17 19:22:17 -08:00
Russ White
2379dbecbd
Merge pull request #3202 from donaldsharp/evpn_dump
Evpn dump
2018-11-08 18:13:27 -05:00
Russ White
7c32c1dc10
Merge pull request #3255 from dslicenc/show_evpn_mac_json
zebra: add json support to show evpn mac vni <num> mac <mac>
2018-10-31 21:47:18 -04:00
Donald Sharp
093e3f23f6 bgpd, lib, vtysh, zebra: Convert to using CMD_VNI_RANGE
For the vni range use a macro to keep track of it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-31 06:23:32 -04:00
Don Slice
24cdbd0d8b zebra: add json support to show evpn mac vni <num> mac <mac>
Added the json output capability in order to improve troubleshooting
capabilities.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-10-29 13:09:31 +00:00
Donald Sharp
69c19e1def
Merge pull request #2946 from mjstapp/dplane_2
Zebra: async dataplane, phase 1
2018-10-28 16:10:45 -04:00
David Lamparter
00b7a9ddfe
Merge pull request #2926 from donaldsharp/router
zebra_ns split up
2018-10-26 22:24:15 +02:00
David Lamparter
0437e10517 *: spelchek
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-25 20:10:57 +02:00
Mark Stapp
91f1681258 zebra: limit queued route updates
Impose a configurable limit on the number of route updates
that can be queued towards the dataplane subsystem.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Mark Stapp
1d11b21f33 zebra: add dplane show commands
Add first pass at show commands for the zebra dplane. Add some stats
counters to show. Start prep for correct shutdown processing, and for
multiple providers.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Donald Sharp
89272910f7 zebra: Start breakup of zns into zrouter and zns
The `struct zebra_ns` data structure is being used
for both router information as well as support for
the vrf backend( as appropriate ).  This is a confusing
state.  Start the movement of `struct zebra_ns` into
2 things `struct zebra_router` and `struct zebra_ns`.

In this new regime `struct zebra_router` is purely
for handling data about the router.  It has no knowledge
of the underlying representation of the Data Plane.

`struct zebra_ns` becomes a linux specific bit of code
that allows us to handle the vrf backend and is allowed
to have knowledge about underlying data plane constructs.

When someone implements a *bsd backend the zebra_vrf data
structure will need to be abstracted to take advantage of this
instead of relying on zebra_ns.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-24 06:52:07 -04:00
vishaldhingra
7cf16e19c5 zebra: vrf aware routmap is missing in Zebra #2802(Part 4 of 4)
The new cli for show output

Signed-off-by: vishaldhingra vdhingra@vmware.com
2018-10-11 10:49:34 -07:00