Commit Graph

567 Commits

Author SHA1 Message Date
Donatas Abraitis
08edf9c6af zebra: Replace inet_ntop to %pI4/6 for JSON outputs
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18 18:45:41 +02:00
Quentin Young
0c124f75db
Merge pull request #9440 from dlqs/dplanehook2 2021-10-26 15:26:32 -04:00
Donald Sharp
d9654571f9
Merge pull request #9316 from ton31337/fix/send_best_path_reason_for_zebra
bgpd: Send BGP best path reason to Zebra
2021-10-25 11:09:20 -04:00
Russ White
4dfa838afa
Merge pull request #9656 from chiragshah6/mdev
zebra: add resolver flag for nexthop in json
2021-10-19 19:16:14 -04:00
Donald Lee
310dd2b362 zebra: Add vty cmd zebra on-rib-process script SCRIPT
Signed-off-by: Donald Lee <dlqs@gmx.com>
2021-10-20 00:56:00 +08:00
Donatas Abraitis
1d7260a1b5 bgpd: Send BGP best path reason to Zebra
```
exit1-debian-9# show ip route 172.16.16.1/32
Routing entry for 172.16.16.1/32
  Known via "bgp", distance 20, metric 0, best
  Last update 00:00:28 ago
  * 192.168.0.2, via eth1, weight 1
    AS-Path          : 65003
    Communities      : first 65001:2 65001:3
    Large-Communities: 65001:1:1 65001:1:2 65001:1:3
    Selection reason : First path received
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-14 16:52:47 +03:00
David Lamparter
c5726f0314
Merge pull request #9676 from donaldsharp/import_register 2021-10-13 22:28:03 +02:00
Russ White
99497bc4ee
Merge pull request #9471 from pguibert6WIND/table_manager_alloc2
zebra: extend table manager per vrf, add vty configuration
2021-10-08 13:49:54 -04:00
Chirag Shah
1b3ac4c7ca zebra: add nhg id to show ip route json
Add json field nexthop group id to
'show ip route json'.

Testing Done:
{
  "27.0.0.14\/32":[
    {
      "prefix":"27.0.0.14\/32",
      "protocol":"bgp",
      "selected":true,
      "destSelected":true,
      "distance":20,
      "metric":0,
      "installed":true,
      "table":254,
      "internalStatus":16,
      "internalFlags":8,
      "internalNextHopNum":2,
      "internalNextHopActiveNum":2,
      "nexthopGroupId":103,     <---- New field
      "uptime":"00:04:37",
      "nexthops":[
        {
          "ip":"fe80::202:ff:fe00:11",
          "interfaceName":"uplink-1",
        },
        {
          "ip":"fe80::202:ff:fe00:1d",
          "interfaceName":"uplink-2",
        }
      ]
    }
  ]
}

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-10-03 16:20:46 -07:00
Chirag Shah
6ba578ef29 zebra: add resolver for nexthop in json
zebra rib 'show ip route json' lists all nexthops in a flat list.
To identify the recursively resolved
nexthops relation adding a flag "resolver" as delimiter
to identify recursively resolved nexthop in the list.

Testing Done:
{
  "1.1.1.0\/24":[
    {
      "prefix":"1.1.1.0\/24",
      "protocol":"static",
       ....
      "nexthops":[
        {
          "flags":5,
          "ip":"27.0.0.14",
          "afi":"ipv4",
          "active":true,
          "recursive":true,
          "weight":1
        },
        {
          "flags":3,
          "fib":true,
          "ip":"fe80::202:ff:fe00:11",
          "afi":"ipv6",
          "interfaceIndex":12,
          "interfaceName":"uplink-1",
          "resolver":true,  <-- Resolver for recursive true flag nh
          "active":true,
          "weight":1
        },
      ]
    }
  ]
}

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-09-27 16:05:08 -07:00
Donald Sharp
d597533a9d zebra: Start carrying safi for rnh processing
PIM is going to need to be able to send down the address it is
trying to resolve in the multicast rib.  We need a way to signal
this to the end developer.  Start the conversion by adding the
ability to have a safi.  But only allow SAFI_UNICAST at the moment.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp
6071e5e96e zebra: remove 'enum rnh_type' from system
This code is now dead code since there are not two
nexthop resolution types.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp
7272e2a461 zebra: remove import check resolution from zebra
The entirety of the import checking no longer needs to be
in zebra as that no-one is calling it.  Remove the code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp
4aabcba0f1 zebra: Being able to use the default route is a boolean not an int
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Philippe Guibert
42d4b30e00 zebra: extend table manager per vrf, add vty configuration
Because vrf backend may be based on namespaces, each vrf can
use in the [16-(2^32-1)] range table identifier for daemons that
request it. Extend the table manager to be hosted by vrf.

That possibility is disabled in the case the vrf backend is vrflite.
In that case, all vrf context use the same table manager instance.

Add a configuration command to be able to configure the wished
range of tables to use. This is a solution that permits to give
chunks to bgp daemon when it works with bgp flowspec entries and
wants to use specific iptables that do not override vrf tables.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-09-21 18:37:30 +02:00
Donald Sharp
321f8e0d84 zebra: Fix case default usage w/ enum's
We should not be using `case default` with an enumerated type
This prevents the developer of new cases from knowing where
they need to fix by just compiling.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-14 13:28:00 -04:00
Kantesh Mundaragi
0789eb69e5 bgpd: VRF-Lite fix nexthop type
Description:
Change is intended for fixing the following issues related to vrf route leaking:

Routes with special nexthops i.e. blackhole/sink routes when imported,
are not programmed into the FIB and corresponding nexthop is set as 'inactive',
nexthop interface as 'unknown'.

While importing/leaking routes between VRFs, in case of special nexthop(ipv4/ipv6)
once bgp announces route(s) to zebra, nexthop type is incorrectly set as
NEXTHOP_TYPE_IPV6_IFINDEX/NEXTHOP_TYPE_IFINDEX
i.e. directly connected even though we are not able to resolve through an interface.
This leads to nexthop_active_check marking nexthop !NEXTHOP_FLAG_ACTIVE.
Unable to find the active nexthop(s), route is not programmed into the FIB.

Whenever BGP leaks routes, set the correct nexthop type, so that route gets resolved
and correctly programmed into the FIB, in the imported vrf.

Co-authored-by: Kantesh Mundaragi <kmundaragi@vmware.com>
Signed-off-by: Iqra Siddiqui <imujeebsiddi@vmware.com>
2021-09-07 01:50:06 -07:00
Donatas Abraitis
24447a70d0 zebra: Show prefixLen in show ip route json output additionally
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-03 14:21:06 +03:00
Donatas Abraitis
45c8ba8fb3 zebra: Do not escape forward slashes for show ip route json
Basically, this is handled by JSON-C library. I've compiled with the
latest release of json-c and it works well.

Didn't test with various distribution versions, but this change is kinda
dependend from the json-c lib version the distra has.

Before:
```
  "192.168.100.1\/32":[
    {
      "prefix":"192.168.100.1\/32",
```

After:
```
  "192.168.100.1/32":[
    {
      "prefix":"192.168.100.1/32",
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-03 14:19:48 +03:00
Hiroki Shirokura
2ba6be5b24 bgpd,sharpd,zebra: fix code style
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:48 -04:00
Hiroki Shirokura
eab0f8f0a2 lib,sharpd,zebra: update nexthop object with nh_srv6
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:48 -04:00
Hiroki Shirokura
76fb7ae4de zebra: ZEBRA_ROUTE_ADD supports seg6 route (step3)
With this patch, zclient can intall seg6 rotues when
they set properties "nh_seg6_segs" on struct nexthop
and set ZEBRA_FLAG_SEG6_ROUTE on zapi_route's flag.

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:48 -04:00
Hiroki Shirokura
8689b25a08 zebra: ZEBRA_ROUTE_ADD supports seg6local route (step1)
With this patch, zclient can intall seg6local rotues whem
they set properties nh_seg6local_{action,ctx} on struct nexthop
and set ZEBRA_FLAG_SEG6LOCAL_ROUTE on zapi_route's flag.

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:47 -04:00
Rafael Zalamena
6c1a2a6538
Merge pull request #6317 from rgirada/fix_route_dump
zebrad: Added a command to dump routes in support bundle
2021-05-28 18:12:17 -03:00
Stephen Worley
7d4651cc9c
Merge pull request #8174 from mjstapp/backup_nht
zebra: hide backup-nexthop activations in nht
2021-05-27 09:49:41 -04:00
Donatas Abraitis
94effaf032 zebra: Send more OPAQUE data from BGP
This includes community and large-community data.

```
exit1-debian-9# show ip route 172.16.16.1/32
Routing entry for 172.16.16.1/32
  Known via "bgp", distance 20, metric 0, best
  Last update 00:00:23 ago
  * 192.168.0.2, via eth1, weight 1
    AS-Path          : 65030
    Communities      : 65001:1 65001:2 65001:3 65001:4 65001:5 65001:6
    Large-Communities: 65001:123:1 65001:123:2
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-05-14 22:12:33 +03:00
Donatas Abraitis
638fc64c64 zebra: Format changes for evpn_mh_neigh_holdtime_cmd
Just to avoid fixing all the time manually this stuff after not relevant
changes.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-05-14 22:12:33 +03:00
rgirada
d29fd1b72e zebrad: Added a command to dump routes in support bundle
Description:
Added a new show command("show ip zebra route dump") to dump all routes
with detailed information including nexthops,flags, status ..etc.
This helps for dubugging and added to support_bundle_command.conf.
Defined this command as a hidden command.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-05-06 02:40:12 -07:00
Stephen Worley
45691de9a0 zebra: add uptime to NHEs
Add uptime for use with NHEs to keep track of how
long we have had this NHE in our rib without an update.

This is treated exactly the same as the re->uptime for
routes. When we get an update for a route, we reset the
uptime.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
2021-04-22 17:25:15 -04:00
Mark Stapp
aef1d5404f zebra: add config control to hide backup nh events in nht
Add a config that can control hiding of backup-nexthop activation
changes in nexthop-tracking.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-04-07 15:38:09 -04:00
Rafael Zalamena
b9f1b4d3d3
Merge pull request #8078 from idryzhov/fix-zebra-vni
zebra: fix vni configuration in default vrf
2021-03-24 13:32:44 +00:00
David Lamparter
224ccf29d9 zebra: kill zebra_memory.h, use MTYPE_STATIC
This one also needed a bit of shuffling around, but MTYPE_RE is the only
one left used across file boundaries now.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-22 20:02:17 +01:00
Mark Stapp
aa45883818 zebra: add ui control for use of backup nexthops in resolution
Add a control and api for the use of backup nexthops in
recursive resolution. With 'no', we won't try to use installed
backup nexthops when resolving a recursive route.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-03-16 12:14:53 -04:00
Jafar Al-Gharaibeh
d532dd6d6a Revert "zebra: Remove first_p which is never used"
This reverts commit 8617eb7c5f.
2021-03-12 01:02:25 -06:00
Donald Sharp
8617eb7c5f zebra: Remove first_p which is never used
Remove dead code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-03-11 21:22:53 -05:00
Igor Ryzhov
9082b3eb3d zebra: fix vni configuration in default vrf
VNI configuration is done without NB layer in default VRF. It leads to
the following problems:

```
vtysh -c "conf" -c "vni 1"
vtysh -c "conf" -c "vrf default" -c "no vni"
```
Second command does nothing, because the NB node is not created by the
first command.

```
vtysh -c "conf" -c "vrf default" -c "vni 1"
vtysh -c "conf" -c "no vni 1"
```
Second command doesn't delete the NB node created by the first command.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-02-24 14:51:00 +03:00
Mark Stapp
86723fe89b zebra: nht resolve-via-default doesn't need force
We don't need to use the 'force' flag when processing the
resolve-via-default clis for ip and ipv6: we can just do normal
nht processing.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-12-17 11:22:09 -05:00
Russ White
101ad544fa
Merge pull request #7678 from donaldsharp/aspath_to_zebra
Aspath to zebra
2020-12-10 10:38:14 -05:00
Donald Sharp
dda33b6e0c zebra, tests: Fix show ip nht
The `show ip nht` and `show ipv6 nht` commands were broken.
This is because recent code commit: 0154d8ce45

assumed that p must not be NULL and this is not the case.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-08 15:50:46 -05:00
Donald Sharp
e46723a50e bgpd, zebra: Add ability for bgp to send AS-Path information to zebra
Add a bit of code to allow bgp to send the AS-Path associated with
the route being installed to zebra so it can be displayed and
used as part of the `show ip route A` command in zebra.

eva# show ip route 20.0.0.0/11
Routing entry for 20.0.0.0/11
  Known via "bgp", distance 20, metric 0, best
  Last update 00:00:00 ago
  * 192.168.161.1, via enp39s0, weight 1
    AS-Path: 60000 64539 15096 6939 8075

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-08 09:07:21 -05:00
Donald Sharp
cfa2a35d8d sharpd, zebra: Pass and display opaque data as PoC
Pass data from sharpd to zebra as opaque data and display
it as part of the detailed route data.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-08 09:06:09 -05:00
Donald Sharp
80a6ee90c3 zebra: Setup structure for opaque data to be displayed
Setup the output mechanism for opaque data to be displayed
to the end operator.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-08 09:06:08 -05:00
Patrick Ruddy
dd662ca570
Merge pull request #7399 from AnuradhaKaruppiah/mh-mac-ecmp-fixes
evpn-mh: miscellaneous fixes in MAC-sync and MAC-ECMP handling
2020-12-03 16:27:49 +00:00
Anuradha Karuppiah
5de10c3705 zebra: allocate one nexthop id per-VTEP instead of one per-ES-VTEP
This is an optimization to reduce the number of L2 nexthops. A
l2 or fdb nexthop simply provides the dataplane with a nexthop ip-
torm-12:mgmt:~# ip nexthop
id 268435461 via 27.0.0.20 scope link fdb
id 268435463 via 27.0.0.20 scope link fdb
id 268435465 via 27.0.0.20 scope link fdb

So there is no need to allocate a nexthop per-ES/per-VTEP. There
can be 100+ ESs per-VTEP so this change cuts the scale down by a
factor of 100.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-01 09:46:28 -08:00
Anuradha Karuppiah
15400f95b7 zebra: support for slow-failover of local MACs on an ES
When a local ES flaps there are two modes in which the local
MACs are failed over -
1. Fast failover - A backup NHG (ES-peer group) is programmed in the
dataplane per-access port. When a local ES flaps the MAC entries
are left unaltered i.e. pointing to the down access port. And the
dataplane redirects traffic destined to the oper-down access port
via the backup NHG.
2. Slow failover - This mode needs to be turned on to allow dataplanes
not capable of re-directing traffic. In this mode local MAC entries
on a down local ES are re-programmed to point to the ES-peers'
NHG. And vice-versa i.e. when the ES comes up the MAC entries
are re-programmed with the access port as dest.

Fast failover is on by default. Slow failover can be enabled via the
following config -
evpn mh redirect-off

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-01 09:46:26 -08:00
Emanuele Di Pascale
265ac74a87 zebra: fix show ip route vrf X summary
The lookup for non default VRFs was always using a tableId; if not
provided, we were defaulting to RT_TABLE_MAIN. This is fine for the
default VRF but not for others. As a result, the command was silently
failing for non-default VRFs unless we also specified the correct tableId.

Fix this by only performing the lookup using the tableId if it is
provided; else use zebra_vrf_table.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2020-12-01 18:34:05 +01:00
Donald Sharp
0154d8ce45 bgpd, lib, nhrpd, zebra: verify return of sockunion2hostprefix
The return from sockunion2hostprefix tells us if the conversion
succeeded or not.  There are places in the code where we
always assume that it just `works`, since it can fail
notice and try to do the right thing.

Please note that failure of this function for most cases
of sockunion2hostprefix is highly highly unlikely as that
the sockunion was already created and tested elsewhere
it's just that this function can fail.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-18 11:04:27 -05:00
Donald Sharp
f7a9d0120d zebra: Add offload and trap counts to summary command for json output
For the json output add offload and trap route counts for the
json output.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-15 10:19:25 -05:00
Donald Sharp
e4876266e4 zebra: Add --asic-offload command
Add a command that allows FRR to know it's being used with
an underlying asic offload, from the linux kernel perspective.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-15 10:19:25 -05:00
Donald Sharp
0d32fbee6d lib, zebra: Add ability to read kernel notice of Offload Failed
The linux kernel is getting RTM_F_OFFLOAD_FAILED for kernel routes
that have failed to offload.  Write the code
to receive these notifications from the linux kernel
and store that data for display about the routes.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-15 10:12:50 -05:00