Commit Graph

5848 Commits

Author SHA1 Message Date
EasyNetDev
0e040960d7
zebra: Update Zebra for DPDK >=22.11 API
* Starting from version DPDK 22.11 we have API changes:
The rte_driver and rte_device objects are now opaque and must be manipulated through added accessors.

We need to update Zebra DPDK sources to DPDK version >=22.11

* Fix clang-format

Signed-off-by: EasyNet <devel@easynet.dev>
2024-05-16 14:26:26 +03:00
Donatas Abraitis
5f8759a4aa
Merge pull request #15968 from donaldsharp/parse_attr_problems
Parse attr problems
2024-05-11 14:44:29 +03:00
Mark Stapp
6afb6962be zebra: add some more netlink RTA_ strings
Add a few more RTA_ attribute names to the netlink debug
output.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-05-09 16:56:07 -04:00
Donald Sharp
bd4fca132a zebra: Ensure multipath encodes vxlan right for fpm usage
The fpm code path for the dplane_fpm_nl module was improperly
encoding the multipath nexthop data for vxlan type routes.
Move this into the embedded nexthop encoding where it belongs.

This change makes it so that the usage of `-M dplane_fpm_nl`
is now producing the same netlink messages that `-M fpm`
produces when using vxlan based nexthops.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-05-09 11:52:51 -04:00
Donald Sharp
569f9e4394 zebra: Move fpm check to inside of netlink_route_nexthop_encap
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-05-09 11:52:51 -04:00
Donald Sharp
ba5a3538e8 zebra: Move netlink_route_nexthop_encap
Move this static function earlier so we can avoid
a predecleartion.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-05-09 11:52:51 -04:00
Donald Sharp
084aba4ec0 zebra: Add 2 things to fpm_listener
1) Add ability to hex-dump the received packet for debugging
2) Receive encap type and vxlan vni and display them.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-05-09 11:52:51 -04:00
Donatas Abraitis
5ed6db5e9e
Merge pull request #15920 from chiragshah6/fdev2
zebra: fix EVPN svd based remote nh neigh del
2024-05-08 22:36:58 +03:00
Christian Hopps
c54bc7a8dd
Merge pull request #15594 from idryzhov/mgmt-rpc
mgmtd: implement YANG RPC/action support
2024-05-06 16:05:50 -04:00
Donald Sharp
216bac2826
Merge pull request #15902 from opensourcerouting/build-xref-setup-hppa
build: fix missing `XREF_SETUP` (and HP PA-RISC build failure)
2024-05-06 10:29:05 -04:00
Chirag Shah
fde6dd7bb9 zebra: fix EVPN svd based remote nh neigh del
In the context of SVD (Single VxLAN Device) for L3VNI,
the remote VTEP's nexthop is programmed neighbor entry against
SVD along with neighbor entry against SVI.

However, when L3VNI is removed or the VRF is disabled, all SVI
based remote nexthop neighbors are uninstalled and deleted.
The SVD based neigh entries remains in Zebra and the Kernel.
Subsequently, when reconfiguring L3VNI and relearning the same nexthop,
the neighbor entry is not programmed is because it is not removed
from Zebra SVD neighbor hash table, leading to the failure to
reprogram the entry.

With this fix, the SVD nexthop neigh entry is uninstalled
and deleted from Zebra and Kernel.

Ticket: #3729045

Testing:

borderleaf:# ip neigh show 2.2.2.2
2.2.2.2 dev vlan2560_l3 lladdr 00:01:00:00:1d:09 extern_learn NOARP proto zebra
2.2.2.2 dev vxlan99 lladdr 00:01:00:00:1d:09 extern_learn NOARP proto zebra

With the fix:

Zebra log shows both enties SVD (vxlan99) and SVI (vlan2560_l3)
neighbor entries are deleted.

2024/05/03 18:41:33.527125 ZEBRA: [NH6N7-54CD1] Tx RTM_DELNEIGH family
ipv4 IF vxlan99(16) Neigh 2.2.2.2 MAC  null flags 0x10 state 0x0
ext_flags 0x0
2024/05/03 18:41:33.527128 ZEBRA: [NH6N7-54CD1] Tx RTM_DELNEIGH family
ipv4 IF vlan2560_l3(18) Neigh 2.2.2.2 MAC  null flags 0x10 state 0x0
ext_flags 0x0

borderleaf:# ip neigh show 2.2.2.2
borderleaf:#

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-05-03 12:43:01 -07:00
Chirag Shah
07005288c2 zebra: bridge flap handle vlan membership update
Upon bridge flap, the associated SVD case,
VLAN membership is not updated correctly.
When SVI comes up, the VNI could not associate
with it as bridge VLAN membership was not updated.

Ticket: #3821632

Testing:

Before fix:
-----------
tor-1:#ifdown br_l3vni ; sleep 1 ; ifup br_l3vni
tor-1:# vtysh -c 'show evpn vni 8888'
VNI: 8888
  Type: L3
  Tenant VRF: sym_1
  Vlan: 490
  Bridge: br_l3vni
  Local Vtep Ip: 27.0.0.9
  Vxlan-Intf: vxlan99
  SVI-If: None    <<<<<< SVI not found
  State: Down     <<<<<< status remained in down BGP is not informed
  VNI Filter: none
  System MAC: None
  Router MAC: None
  L2 VNIs: 1800 1801 1900 1901

After fix:
----------

tor-1:# ifdown br_l3vni; sleep 1; ifup br_l3vni
tor-1:# vtysh

Hello, this is FRRouting (version 8.4.3).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

tor-1# show evpn vni 8888
VNI: 8888
  Type: L3
  Tenant VRF: sym_1
  Vlan: 490
  Bridge: br_l3vni
  Local Vtep Ip: 27.0.0.9
  Vxlan-Intf: vxlan99
  SVI-If: vlan490_l3 <<<<<<
  State: Up          <<<<<<
  VNI Filter: none
  System MAC: 44:38:39:ff:ff:29
  Router MAC: 44:38:39:ff:ff:29
  L2 VNIs: 1800 1801 1900 1901

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-05-03 10:52:33 -07:00
David Lamparter
3ca60d00b1 *: add XREF_SETUP() to libraries and utilites
This is theoretically not needed if neither DEFUNs nor zlog_* calls are
used, except I'm about to turn it into a build error to catch the cases
where it _is_ necessary.  Which is libmgmt_be_nb.la in this case, where
it causes build failures on hppa.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-05-02 23:03:08 +02:00
anlan_cs
8a02942eda zebra: clean up one comment
With the commit `605df8d4`, all real things are moved into dplane.
So the operations mentioned in this comment have nothing to do with
this function `netlink_link_change()`.

Just remove that confusing and useless comment.

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2024-05-02 16:36:01 +08:00
Donald Sharp
26595e3162 zebra: Ensure proper decoding of netlink message
As part of the kernel netlink functionality, it is
possible that a bit of nested attributes can be
passed up.  This attribute has a type value which
is stored in the lower 8 bits and in the upper 8
bits are a couple control flags that can be used.
FRR can parse this data and then just throw away
the value unless we mask off the upper 8 bits.
Let's ensure that it can be properly parsed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-04-30 14:46:08 -04:00
Donatas Abraitis
03a4765cda
Merge pull request #15841 from pguibert6WIND/dx6_support
zebra, sharpd: add srv6 End.DX6 support
2024-04-26 23:25:34 +03:00
Russ White
f19817f71d
Merge pull request #15723 from opensourcerouting/feature/extended_link_bw_refactored_v1
bgpd: Implement extended link-bandwidth
2024-04-26 14:41:05 -04:00
Philippe Guibert
f6e58d26f6 zebra, sharpd: add srv6 End.DX6 support
Add the support for adding DX6 behavior into netlink layer of zebra.
Add the necessary test in sharpd.

> ubuntu2204# sharp install seg6local-routes 1:1::1:2 nexthop-seg6local loop1 End_DX6 4:4::4:6 1
> ubuntu2204# do show ipv6 route
> [..]
> D>* 1:1::1:2/128 [150/0] is directly connected, loop1, seg6local End.DX6 nh6 4:4::4:6, weight 1, 00:00:03

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-04-25 13:54:25 +02:00
Donatas Abraitis
a988a0a88a *: Use uint64_t for weight down the path to Zebra
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-04-22 17:50:08 +03:00
Donald Sharp
29c1ff446e lib, zebra: Check for not being a blackhole route
In zebra_interface_nhg_reinstall zebra is checking that the
nhg is a singleton and not a blackhole nhg.  This was originally
done with checking that the nexthop is a NEXTHOP_TYPE_IFINDEX,
NEXTHOP_TYPE_IPV4_IFINDEX and NEXTHOP_TYPE_IPV6_IFINDEX.  This
was excluding NEXTHOP_TYPE_IPV4 and NEXTHOP_TYPE_IPV6.  These
were both possible to be received and maintained from the upper
level protocol for when a route is being recursively resolved.
If we have gotten to this point in zebra_interface_nhg_reinstall
the nexthop group has already been installed at least once
and we *know* that it is actually a valid nexthop.  What the
test is really trying to do is ensure that we are not reinstalling
a blackhole nexthop group( Which is not possible to even be
here by the way, but safety first! ).  So let's change
to test for that instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-04-22 10:44:55 -04:00
Igor Ryzhov
58a8ebc1fc lib: rework northbound RPC callback
Change input/output arguments of the RPC callback from lists of
(xpath/value) tuples to YANG data trees.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22 16:36:22 +03:00
Igor Ryzhov
99a723e5a8
Merge pull request #15803 from LabNConsulting/chopps/add-missing-zif-type
yang: add missing `zif-gre` zebra interface type
2024-04-20 21:25:28 +03:00
Christian Hopps
74fb4056cb yang: add missing zif-gre zebra interface type
This was caught by the grpc_basic test which was receiving an invalid error
result, which was returned b/c inside zebra the libyang code was flagging the
value as invalid for a derived zebra interface type.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-04-20 08:04:00 -04:00
Igor Ryzhov
57811a53ba lib, zebra: fix exit commands
If a command is not marked as `YANG`-converted, the current command
batching buffer is flushed before executing the command. We shouldn't
flush the buffer when executing an `exit` command. It should only be
flushed if the next command is not `YANG`-converted, which is checked by
the command itself, not the previous `exit`.

Fixes #15706.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-16 22:18:01 +03:00
Russ White
13d598712a
Merge pull request #15616 from pguibert6WIND/srv6_seg_list_sid_order
zebra: fix static srv6 segment-list sid order
2024-04-16 07:55:05 -04:00
Igor Ryzhov
8d6f7a4397 zebra: fix encoded DNSSL length
The encoded DNSSL length is not set so the value is missing from RA
packet.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-15 23:31:26 +03:00
Donatas Abraitis
deef11a22b
Merge pull request #15612 from sri-mohan1/srib-24-zebra-b
zebra: changes for code maintainability
2024-04-14 21:06:28 +03:00
Jafar Al-Gharaibeh
692f916b88
Merge pull request #15688 from mjstapp/dplane_api_version
lib, zebra: Add a version scheme for the dataplane API
2024-04-11 23:54:02 -05:00
Donald Sharp
4fb336424e zebra: rtadv uses uninited data to sendmsg
valgrind is complaining about this problem.
This fixes it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-04-10 09:24:13 -04:00
Donatas Abraitis
73a6aa6a14
Merge pull request #15708 from donaldsharp/zebra_fix_io_display
Zebra fix io display and shorten evpn zapi packet sizes
2024-04-10 08:26:02 +03:00
Donald Sharp
5d7b50d1c0
Merge pull request #15693 from anlancs/fix/zebra-label-bind
zebra: fix wrong check for mpls label
2024-04-09 18:33:29 -04:00
Donald Sharp
94516d25aa zebra: Use more appropriately sized stream packets for evpn
When sending EVPN data, let's use more appropriately sized
packets for the sending of data.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-04-09 10:08:03 -04:00
Donald Sharp
8d8f12ba8e zebra: Actually display I/O buffer sizes
An operator found a situation where zebra was
backing up in a significant way towards BGP
with EVPN changes taking up some serious amounts
of memory.  The key lines that would have clued
us in on it were behind a dev build.  Let's change
this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-04-09 10:08:03 -04:00
Mark Stapp
9f285dd0bc zebra: add dataplane API version value
Add a version value and accessor API for the zebra dataplane;
plugins can test this to detect API changes.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-04-09 08:59:13 -04:00
Donald Sharp
8cfa3b57e9
Merge pull request #15645 from opensourcerouting/fix/show_ip_route_vrf_all_summary_json
zebra: Fix JSON output for `show route summary json`
2024-04-08 11:12:40 -04:00
Dmytro Shytyi
8e82e2d5ed zebra: fix static srv6 segment-list sid order
When configuring a SID list by vtysh, the segment list
obtained in iproute2 is the exact opposite:
>
>vtysh:
>ipv6 route 2005::/64 eth0 segments 2001:db8:aaaa::7/2002::2/2003::3/2004::4
>
>root@r1:/# ip -6 route
>2005::/64 nhid 6  encap seg6 mode encap segs 4 [ 2004::4 2003::3 2002::2 2001:db8:aaaa::7 ] dev dummy0 proto 196 metric 20 pref medium
>

Fix this by keeping the same vtysh config and swap the
segment's order of the list in the rt_netlink.c
>
>root@r1:/# ip -6 route
>2005::/64 nhid 6  encap seg6 mode encap segs 4 [ 2001:db8:aaaa::7 2002::2 2003::3 2004::4 ] dev dummy0 proto 196 metric 20 pref medium
>

Fixes: f20cf14 ("bgpd,lib,sharpd,zebra: srv6 introduce multiple segs/SIDs in nexthop")

Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
2024-04-08 15:45:26 +02:00
anlan_cs
cbd1f3239a zebra: fix wrong check for mpls label
Add a parameter for `zebra_mpls_fec_for_label()`, as before if it is `NULL`,
otherwise exclude what this parameter represents.

Before:
```
anlan(config)# mpls label bind 1.1.1.2/32 88
anlan(config)# mpls label bind 1.1.1.2/32 88
% Label already bound to a FEC
anlan(config)# mpls label bind 1.1.1.3/32 88
% Label already bound to a FEC
```

After:
```
anlan(config)# mpls label bind 1.1.1.2/32 88
anlan(config)# mpls label bind 1.1.1.2/32 88
anlan(config)# mpls label bind 1.1.1.3/32 88
% Label already bound to a FEC
```

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2024-04-06 09:01:39 +08:00
anlan_cs
9fb31c5e24 zebra: cosmetic change for one flag
Use `CHECK_FLAG()` for readability.

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2024-04-05 14:30:26 +08:00
Mark Stapp
75ef259b1d zebra: don't deref vxlan-vni array
Null-check the vxlan-vni array info coming into zebra from
the dataplane.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-04-01 13:00:04 -04:00
Donatas Abraitis
ca13121849 zebra: Fix JSON output for show route summary json
Before:
```
{
  "routes":[
    {
      "fib":1,
      "rib":1,
      "fibOffLoaded":0,
      "fibTrapped":0,
      "type":"connected"
    },
    {
      "fib":1,
      "rib":1,
      "fibOffLoaded":0,
      "fibTrapped":0,
      "type":"local"
    },
    {
      "fib":2,
      "rib":2,
      "fibOffLoaded":0,
      "fibTrapped":0,
      "type":"static"
    }
  ],
  "routesTotal":4,
  "routesTotalFib":4
}
{
  "routes":[
    {
      "fib":2,
      "rib":2,
      "fibOffLoaded":0,
      "fibTrapped":0,
      "type":"connected"
    },
    {
      "fib":2,
      "rib":2,
      "fibOffLoaded":0,
      "fibTrapped":0,
      "type":"local"
    },
    {
      "fib":2,
      "rib":2,
      "fibOffLoaded":0,
      "fibTrapped":0,
      "type":"static"
    }
  ],
  "routesTotal":6,
  "routesTotalFib":6
}
```

After:
```
{
  "ISR":{
    "routes":[
      {
        "fib":1,
        "rib":1,
        "fibOffLoaded":0,
        "fibTrapped":0,
        "type":"connected"
      },
      {
        "fib":1,
        "rib":1,
        "fibOffLoaded":0,
        "fibTrapped":0,
        "type":"local"
      },
      {
        "fib":2,
        "rib":2,
        "fibOffLoaded":0,
        "fibTrapped":0,
        "type":"static"
      }
    ],
    "routesTotal":4,
    "routesTotalFib":4
  },
  "default":{
    "routes":[
      {
        "fib":2,
        "rib":2,
        "fibOffLoaded":0,
        "fibTrapped":0,
        "type":"connected"
      },
      {
        "fib":2,
        "rib":2,
        "fibOffLoaded":0,
        "fibTrapped":0,
        "type":"local"
      },
      {
        "fib":2,
        "rib":2,
        "fibOffLoaded":0,
        "fibTrapped":0,
        "type":"static"
      }
    ],
    "routesTotal":6,
    "routesTotalFib":6
  }
}
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 23:04:10 +02:00
Piotr Suchy
0e2fc3d67f vtysh, zebra: Fix malformed json output for multiple vrfs in command 'show ip route vrf all json'
Command 'show ip route vrf <vrf_name> json' returns a valid json object,
however if instead of <vrf_name> we specify 'all', we get an invalid json
object, like:

{//vrf1 routes}{//vrf2 routes}{vrf3 routes}

After the fix:

{"vrf1":{//vrf1 routes},"vrf2:{//vrf2 routes},"vrf3":{//vrf3 routes}}

Which is a valid json object, that can be parsed effectively using built-in
modules. The rest of the commands remains unaffected and behave the same.

Signed-off-by: Piotr Suchy <psuchy@akamai.com>
2024-03-29 14:01:21 +01:00
Mark Stapp
498967799d
Merge pull request #15598 from louis-6wind/fix-nhg-iface
zebra: fix rejected route due to wrong nexthop-group
2024-03-26 11:49:03 -04:00
sri-mohan1
2df51c7fe3 zebra: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-03-26 10:21:45 +05:30
Mark Stapp
2313916a9e
Merge pull request #15590 from sri-mohan1/srib-24-zebra-b
zebra: changes for code maintainability
2024-03-22 08:33:52 -04:00
Mark Stapp
20e017c379
Merge pull request #15010 from tlsalmin/master
zebra: Fix crash on macvlan link down/up
2024-03-22 08:31:12 -04:00
Louis Scalbert
2a13b47185 zebra: fix rejected route due to wrong nexthop-group
A specific sequence of actions involving the addition and removal of IP
routes and network interfaces can lead to a route installation failure.
The issue occurs under the following conditions:

 - Initially, there is no route present via the ens3 interface.
 - Adds a route: ip route 10.0.0.0/24 192.168.0.100 ens3
 - Removes the same route: no ip route 10.0.0.0/24 192.168.0.100 ens3
 - Removes the ens3 interface.
 - Re-adds the ens3 interface.
 - Again adds the same route: ip route 10.0.0.0/24 192.168.0.100 ens3
 - And again removes it: no ip route 10.0.0.0/24 192.168.0.100 ens3
 - Shuts down the ens3 interface
 - Reactivates the interface
 - Adds the route once more: ip route 10.0.0.0/24 192.168.0.100 ens3

The route appears to be rejected.
> # show ip route nexthop
> S>r 10.0.0.0/24 [1/0] (6) via 192.168.0.100, ens3, weight 1, 00:00:01

The commit 35729f38fa ("zebra: Add a timer to nexthop group deletion")
introduced a feature to keep a nexthop-group in Zebra for a certain
period even when it is no longer in use. But if a nexthop-group
interface is removed during this period, the association between the
nexthop-group and the interface is lost in zebra memory. If the
interface is later added back and a route is re-established, the
nexthop-group interface dependency is not correctly reestablished.
As a consequence, the nexthop-group flags remain unset when the
interface is down. Upon the interface's reactivation, zebra does not
reinstall the nexthop-group in the kernel because it is marked as valid
and installed, but in reality, it does not exist in the kernel (it was
removed when the interface was down). Thus, attempts to install a route
via this nexthop-group ID fail.

Stop maintaining a nexthop-group when its associated interface is no
longer present.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-03-22 11:29:38 +01:00
Donatas Abraitis
874242f129 *: Add missing SPDX-License-Identifier for some .c/.h files
Adding them as others: GPL-2.0-or-later

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-21 16:46:58 +02:00
sri-mohan1
2501c3a4dc zebra: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-03-21 14:56:24 +05:30
Russ White
502d1937da
Merge pull request #15552 from sri-mohan1/srib-24-zebra-a
zebra: changes for code maintainability
2024-03-19 10:24:13 -04:00
Alexander Skorichenko
444ce317b2 zebra: fix route deletion during zebra shutdown
Split zebra's vrf_terminate() into disable() and delete() stages.
The former enqueues all events for the dplane thread.
Memory freeing is performed in the second stage.

Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
2024-03-15 11:42:02 +01:00