Commit Graph

32667 Commits

Author SHA1 Message Date
Chirag Shah
0d005b2d5c ospfd: fix interface param type update
interface link update event needs
to be handle properly in ospf interface
cache.

Example:
When vrf (interface) is created its default type
would be set to BROADCAST because ifp->status
is not set to VRF.
Subsequent link event sets ifp->status to vrf,
ospf interface update need to compare current type
to new default type which would be VRF (OSPF_IFTYPE_LOOPBACK).
Since ospf type param was created in first add event,
ifp vrf link event didn't update ospf type param which
leads to treat vrf as non loopback interface.

Ticket:#3459451
Testing Done:

Running config suppose to bypass rendering default
network broadcast for loopback/vrf types.

Before fix:

vrf vrf1
 vni 4001
exit-vrf
!
interface vrf1
 ip ospf network broadcast
exit

After fix: (interface vrf1 is not displayed).

vrf vrf1
 vni 4001
exit-vrf

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-06-01 10:39:21 -07:00
anlan_cs
32e29c746a bgpd: Fix typo in debug message
Cosmetic change for the debug messages, mainly on the parentheses.

Before:
```
[ZJYCS-KQYD6] VRF vrf-debug(140): Rcvd NH update 50.50.50.0/24(0)0) - metric 300/300 #nhops 2/1 flags Valid Reg Static Static Exact
[VZJVD-D7GXM] parse nexthop update(50.50.50.0/24(0)(VRF vrf-debug)): bnc info not found for nexthop cache
[NSWTE-81HEK] parse nexthop update(50.50.201.0/31(0)(VRF vrf-debug)): bnc info not found for import check
```

After:
```
[ZJYCS-KQYD6] VRF vrf-debug(140): Rcvd NH update 50.50.50.0/24(0)(0) - metric 300/300 #nhops 2/1 flags Valid Reg Static Static Exact
[VZJVD-D7GXM] parse nexthop update 50.50.50.0/24(0)(VRF vrf-debug): bnc info not found for nexthop cache
[NSWTE-81HEK] parse nexthop update 50.50.201.0/31(0)(VRF vrf-debug): bnc info not found for import check
```

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-06-01 23:31:45 +08:00
Donald Sharp
84af55b268 tests: new mgmt_startup tests are failing due to insufficient time
The tests are failing due to heavily loaded system and insufficient
time for large configs to be handled.  Increasing the time
allows the tests to complete locally for me under heavy load.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-01 09:57:48 -04:00
Donald Sharp
56cc0c2478 eigrpd: dest_addr does not need to be set to NULL
All paths of the loop set dest_addr at the start
of the loop.  No need to set it to NULL to immediately
set it too something else.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-01 08:58:16 -04:00
Donald Sharp
c36bd47d76 bgpd: vpn_policy_getafi can return AFI_MAX
Let's account for vpn_policy_getafi having a failure
situation and back out of the whole thing gracefully.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-01 08:58:16 -04:00
Donald Sharp
6e233c77d8 bgpd: blnc cannot be NULL at if statement time
It is impossible for the blnc statement to ever be NULL at
line 1470 as that the if statement at 1453 guarantees it
to be set to something.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-01 08:58:16 -04:00
Donald Sharp
3ddf7680fd zebra: Consolidate the stream_failure section with normal return
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-01 08:58:16 -04:00
Donald Sharp
c2cf522347 zebra: No need to set msg to NULL
The msg value is always reset to something new before it is used inside
the mutex.  No need to set it to NULL.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-01 08:54:25 -04:00
Donald Sharp
1f7038386e bgpd: community_list_set str is always non null
When calling community_list_set the str variable is
always non NULL.  As such let's treat it as such.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-01 08:54:25 -04:00
Donald Sharp
3f1b34c498
Merge pull request #13652 from opensourcerouting/fix/drop_old_releases_from_the_table
doc: Update reference table for current and upcoming release dates
2023-06-01 08:27:54 -04:00
Louis Scalbert
5f230545e1 tests: re-style isis_sr_flex_algo_topo1
Re-style isis_sr_flex_algo_topo1. Cosmetic change.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-01 14:26:48 +02:00
Louis Scalbert
9ed86fe07e isisd: fix wrongly disabled flex-algo
A configured flex-algo algorithm may remain in disabled state after its
definition is advertised on the area.

It happens sometimes that, in isis_sr_flex_algo_topo1 topotest step 4 or
8, flex-algo 203 is disabled. It depends on the following sequence:

 1. Flex-algo 203 is configured on a remote router to be re-advertised.
 2. A LSP is received on the local router and contains the algo 203
    definition.
 3. The local router re-builds its own LSP with lsp_build().
 4. local router isis_run_spf() recomputes the algo 203 SPF tree.

A 1. 2. 3. 4. sequence results in a working test. The reception of the
remote LSP (2.) does not trigger the built of the local LSP. If for
some reasons, the sequence is 1. 3. 4. 2. 4., isis_run_spf() will not
knows that flex-algo 203 has been re-enabled because
flex_algo_get_state() only returns the state from the local LSP.

Compare in sequence step 4. the flex-algo state from the local LSP with
the actual state. If the state is not the same, request a new local LSP
generation and quits the re-computation of algo SPF tree. The SPF tree
will be recomputed just after the built of the local LSP.

Fixes: 3f55b8c621 ("isisd: fix disabled flex-algo on race condition")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-01 14:26:39 +02:00
Louis Scalbert
b24bad5632 tests: fix mpls table check in isis_sr_flex_algo_topo1
Some test steps result in removing some entries in the MPLS forwarding
table. However, these steps pass before the entries are actually
removed.

Use the exact JSON comparison so that the removal of the entries is
checked.

Fixes: 1a61ef95b2 ("tests: add isis_sr_flex_algo_topo1 for flex-algo")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-01 14:14:51 +02:00
Donald Sharp
82c6e4fea5 zebra: Unlock the route node when sending route notifications
When using a context to send route notifications to upper
level protocols, the code was using a locking function to
get the route node.  There is no need for this to be locked
as such FRR should free it up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-01 07:35:12 -04:00
sri-mohan1
a3b7872c66 ldpd: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2023-06-01 13:30:35 +05:30
Donatas Abraitis
8d4eeb9026
Merge pull request #13450 from patrasar/mld_core
pim6d: Fix crash in ipv6 pim command
2023-06-01 09:13:30 +03:00
David Ward
4a1696818f ospf6d: Prevent redundant LSA generation before interface goes down
Commit 76249532fa ("ospf6d: Handle Premature Aging of LSAs") added a
duplicate call to OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT(), when the
interface state changes to "Down".

Fixes: #1738

Signed-off-by: David Ward <david.ward@ll.mit.edu>
2023-05-31 16:44:44 -04:00
Yuan Yuan
f8aa257997 lib: fix vtysh core when handling questionmark
When issue vtysh command with ?, the initial buf size for the
element is 16. Then it would loop through each element in the cmd
output vector. If the required size for printing out the next
element is larger than the current buf size, realloc the buf memory
by doubling the current buf size regardless of the actual size
that's needed. This would cause vtysh core when the doubled size
is not enough for the next element.

Signed-off-by: Yuan Yuan <yyuanam@amazon.com>
2023-05-31 20:30:03 +00:00
Donatas Abraitis
b28e2c59dc doc: Update reference table for current and upcoming release dates
Keep only 3 release dates, current and two upcoming. On the next release,
just update one, instead of multiple (zero point looking too much in the
future).

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-05-31 23:17:27 +03:00
Donatas Abraitis
1bfbdc17f2 tests: Check if bgp default-originate timer command works
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-05-31 22:58:32 +03:00
Donatas Abraitis
d49700dd2f bgpd: Add an ability to control default-originate route-map timer
By default it's 5 seconds. That means, every 5 second it iterates over the
whole BGP table and checks if a route-map is kicked in (if route-map is defined).

Having a full feed with many of neighbors, this is a huge CPU-killer, and takes
a lot of time.

Thread statistics for bgpd:

Showing statistics for pthread default
--------------------------------------
                               CPU (user+system): Real (wall-clock):
Active   Runtime(ms)   Invoked Avg uSec Max uSecs Avg uSec Max uSecs  CPU_Warn Wall_Warn Starv_Warn Type   Thread
    0          0.487        10       48        84       49        85         0         0          0    T    (bgp_connect_timer)
    0          0.000         1        0         0        1         1         0         0          0    T    bgp_startup_timer_expire
    2          3.991       276       14      1032       14      1031         0         0          0  R      zclient_read
    0          0.010         4        2         6        3         6         0         0          0     E   _bfd_sess_send
    0          0.057        11        5        26        6        26         0         0          0   W     vtysh_write
    0         65.054       136      478     28907      484     28914         0         0          0     E   bgp_event
    0      11233.040        24   468043   2772209  1341293   7781145         0         3          0    T    subgroup_coalesce_timer
    2          3.649        33      110       394      111       395         0         0          0  R      bgp_accept
    0        468.837         5    93767    178929    93799    178960         0         0          0    T    (bgp_graceful_stale_timer_expire)
    0          0.462         9       51        77       51        78         0         0          0    T    (bgp_start_timer)
    1        415.825     14200       29       414       29       415         0         0          0  R      vtysh_accept
    0          0.052         3       17        47       18        49         0         0          1    T    bgp_config_finish
    0          0.011         1       11        11       12        12         0         0          0     E   frr_config_read_in
    0          0.022         4        5         8        6         9         0         0          0     E   bgp_nht_ifp_initial
    0          0.121        44        2        64        3        65         0         0          0    T    (bgp_routeadv_timer)
    0      34194.454         3 11398151  21874014 27937411  52641827         2         0          1    T    bgp_route_map_update_timer
    0      13246.820         8  1655852   3065476  4589606   8454782         0         4          1    T    bgp_announce_route_timer_expired
    0          0.035         2       17        26       18        27         0         0          0     E   zclient_connect
    0     279624.026    318778      877    571779     2808   1639624         0         0          5    T    work_queue_run
    0          0.097        32        3        21        3        23         0         0          0  RW     bgp_connect_check
    2       6005.738     43560      137    680012      138    680446         0         0          0  R      vtysh_read
    0       1605.840   1116298        1      1331        2     10152         0         0        133    T    (bgp_generate_updgrp_packets)
    0       1073.162        17    63127    222065    63175    222087         0         0          0     E   bgp_packet_process_error
    1   16744058.262     10691  1566182   1807248  1566900   1808301         0         0          5    T    update_group_refresh_default_originate_route_map
    0          0.000        11        0         0        0         1         0         0          0    T    update_subgroup_merge_check_thread_cb
    0      94544.034   1898726       49    225054       69    225156         0         0          0     E   bgp_process_packet

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-05-31 22:58:30 +03:00
Donatas Abraitis
610af81ae4 bgpd: Remove bgp_lock() when spawning a timer for default-originate
Not sure why it's here, but looks like it was since the beginning, let's see
if we can drop it.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-05-31 22:49:32 +03:00
Igor Ryzhov
f7884aedf7 bfdd: remove redundant nb destroy callbacks
Fixes warning logs:
```
2023/05/29 20:11:50 BFD: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-bfdd:bfdd/bfd/profile/minimum-ttl'
2023/05/29 20:11:50 BFD: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-bfdd:bfdd/bfd/sessions/multi-hop/minimum-ttl'
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-05-31 15:28:08 +03:00
Donald Sharp
af001e29f9 mgmtd: xpath is already NULL in the failure path
There is no way that xpath can ever be anything but NULL
in the failure path with the goto's.  Let's just remove
the goto's and return immediately.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-31 07:54:10 -04:00
Donald Sharp
7470509390
Merge pull request #13632 from LabNConsulting/chopps/mgmt-avoid-race
mgmtd: fix possible race btw read config and backend connection
2023-05-31 07:28:50 -04:00
Donald Sharp
a53c4891fd
Merge pull request #13639 from opensourcerouting/ospf-timestamp-truncation
ospfd, ospf6d: fix time_t truncation
2023-05-31 07:26:06 -04:00
Donatas Abraitis
549f664d39
Merge pull request #13634 from yyuanam/fix_bgp_core
bgpd: fix bgpd core when unintern attr
2023-05-31 08:57:40 +03:00
Jafar Al-Gharaibeh
adea8ef308
Merge pull request #13635 from donaldsharp/give_ping_a_chance
tests: Actually loop if ping fails
2023-05-30 18:59:44 -05:00
Yuan Yuan
32af4995aa bgpd: fix bgpd core when unintern attr
When the remote peer is neither EBGP nor confed, aspath is the
shadow copy of attr->aspath in bgp_packet_attribute(). Striping
AS4_PATH should not be done on the aspath directly, since
that would lead to bgpd core dump when unintern the attr.

Signed-off-by: Yuan Yuan <yyuanam@amazon.com>
2023-05-30 22:49:07 +00:00
Renato Westphal
2882096fad ospfd, ospf6d: fix time_t truncation
Change timestamp parameter from int to time_t to avoid truncation.

Found by Coverity Scan (CID 1563226 and 1563222)

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-05-30 19:47:28 -03:00
Donald Sharp
22c10bbdaa tests: Actually loop if ping fails
The usage of run_and_expect doesn't work if the function
being called as the run part asserts.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-30 15:43:42 -04:00
Donatas Abraitis
147c7a2de3
Merge pull request #13631 from donaldsharp/fix_some_ping_issues
various issues
2023-05-30 21:26:24 +03:00
ryndia
ce0d06d921 ospfd: ospf_route.c memory leak fix
The rn variable has its info attribute being replaced with a new ospf route before being freed properly.

Signed-off-by: ryndia <dindyalsarvesh@gmail.com>
2023-05-30 20:44:30 +04:00
Christian Hopps
3744ad02d9 mgmtd: fix possible race btw read config and backend connection
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 11:52:19 -04:00
Donald Sharp
9be555f8d4
Merge pull request #13601 from opensourcerouting/build-yang-embed-20230525
build: fix missing YANG model embedding
2023-05-30 11:34:29 -04:00
mobash-rasool
46d0674da0
Merge pull request #13588 from sri-mohan1/srib-ldpd1
ldpd: changes for code maintainability
2023-05-30 21:02:31 +05:30
Trey Aspelund
08a3439d51 bgpd: fix static analyzer complaint for evpn_info
In CI, CLANG static analyzer started complaining about possible null
dereferences of pre-existing fields. Let's make it happy and do a null
check.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-30 15:25:45 +00:00
Trey Aspelund
6510458757 tests: add topotest for EVPN MAC-VRF SoO
Adds topotest to cover the new EVPN MAC-VRF Site-of-Origin feature.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-30 15:25:37 +00:00
Trey Aspelund
9b55b559db doc: add docs for EVPN MAC-VRF Site-of-Origin
Adds user documentation for the new EVPN MAC-VRF Site-of-Origin feature.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-30 15:20:35 +00:00
Trey Aspelund
3579225830 bgpd: doc enhanced route-refresh subtype
Adds missing param for 'subtype' to docstring of bgp_route_refresh_send.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-30 15:20:35 +00:00
Trey Aspelund
6cabac8505 bgpd: fix rc for invalid mac-vrf soo
Change CMD_WARNING -> CMD_WARNING_CONFIG_FAILED so that the rc is
non-zero and the caller can detect a failure.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-30 15:20:35 +00:00
Trey Aspelund
badc4857aa bgpd: add EVPN reimport handler for martian change
Adds a generalized martian reimport function used for triggering a
relearn/reimport of EVPN routes that were previously filtered/deleted
as a result of a "self" check (either during import or by a martian
change handler). The MAC-VRF SoO is the first consumer of this function,
but can be expanded for use with Martian Tunnel-IPs, Interface-IPs,
Interface-MACs, and RMACs.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-30 15:20:35 +00:00
Trey Aspelund
67b493a5b3 bgpd: generalize EVPN martian nexthop changes
Currently we have a handler function that will walk the global EVPN
rib and unimport/remove routes matching a local IP/TIP. This generalizes
this function so that it can be re-used for other BGP Martian entry
types. Now this can be used to unimport routes when the MAC-VRF SoO is
reconfigured.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-30 15:20:35 +00:00
Trey Aspelund
465d3e356d bgpd: track L3VNI VTEP-IPs in tip_hash
For whatever reason, we were only updating tip_hash when we processed an
L2VNI add/del. This adds tip_hash updates to the L3VNI add/del codepaths
so that their VTEP-IPs are also used when when considering martian
addresses, e.g. bgp_nexthop_self().

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-30 15:20:35 +00:00
Trey Aspelund
e7b8832c76 bgpd: remove unused struct bgp_addrv6
All uses of struct bgp_addrv6 were removed in a prior commit that made
struct bgp_addr reusable for both v4 and v6. This cleans up the last
remnants of the old v6 struct.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-30 15:20:35 +00:00
Trey Aspelund
c4b59c9ab1 bgpd: add mac-vrf soo to show bgp l2vpn evpn vni
Adds the current MAC-VRF SoO value to the output of "show bgp l2vpn evpn
vni [vni]". Also fixes a missing space in front of the Tenant VRF string.

New output:
```
ub20-2(config-router-af)# do show bgp l2vpn evpn vni
Advertise Gateway Macip: Disabled
Advertise SVI Macip: Disabled
Advertise All VNI flag: Enabled
BUM flooding: Head-end replication
VXLAN flooding: Enabled
Number of L2 VNIs: 2
Number of L3 VNIs: 1
Flags: * - Kernel
  VNI        Type RD                    Import RT                 Export RT                 MAC-VRF Site-of-Origin    Tenant VRF
* 20         L2   100.64.0.33:3         1:20                      1:20                      3.3.3.3:20                stuff
* 30         L2   100.64.0.33:4         1:30                      1:30                      3.3.3.3:20                stuff
* 10         L3   30.0.0.3:2            1:10                      1:10                      3.3.3.3:20                stuff

ub20-2(config-router-af)# do show bgp l2vpn evpn vni 10
VNI: 10 (known to the kernel)
  Type: L3
  Tenant VRF: stuff
  RD: 30.0.0.3:2
  Originator IP: 3.3.3.3
  MAC-VRF Site-of-Origin: 3.3.3.3:20     <<<<<
  Advertise-gw-macip : n/a
  Advertise-svi-macip : n/a
  Advertise-pip: Yes
  System-IP: 100.64.0.33
  System-MAC: aa:bb:cc:00:33:33
  Router-MAC: aa:bb:cc:00:33:33
  Import Route Target:
    1:10
  Export Route Target:
    1:10

ub20-2(config-router-af)# do show bgp l2vpn evpn vni 20
VNI: 20 (known to the kernel)
  Type: L2
  Tenant-Vrf: stuff
  RD: 100.64.0.33:3
  Originator IP: 3.3.3.3
  MAC-VRF Site-of-Origin: 3.3.3.3:20     <<<<<
  Mcast group: 0.0.0.0
  Advertise-gw-macip : Disabled
  Advertise-svi-macip : Disabled
  SVI interface : br20
  Import Route Target:
    1:20
  Export Route Target:
    1:20
```

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-30 15:20:35 +00:00
Trey Aspelund
65cdb9ce9b bgpd: Add MAC-VRF Site-of-Origin support
Initial support for configuring an SoO for all MAC-VRFs (EVIs/L2VNIs).
This provides a topology-independent method of preventing EVPN routes
from one MAC-VRF "site" (an L2 domain) from being imported by other PEs
in the same MAC-VRF "site", similar to how SoO is traditionally used in
L3VPN to identify and break loops for an L3/IP-VRF "site".
One example of where a MAC-VRF SoO can be used to avoid an L2 control
plane loop is with Active/Active MLAG VTEPs. For a given L2 site only
one control plane should be active. SoO can be used to ID/ignore entries
originated from the local MAC-VRF site so that EVPN will not attempt to
manage entries that are already handled by MLAG.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-30 15:20:35 +00:00
Trey Aspelund
5d5d126777 bgpd: migrate MTYPE_BGP_EVPN_INFO
bgp_create() and bgp_free() already call EVPN-specific handlers,
so there's no need to XCALLOC/XFREE BGP_EVPN_INFO directly. Let's move
all the references to MTYPE_BGP_EVPN_INFO into the EVPN specific files.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-30 15:20:35 +00:00
Trey Aspelund
56fe240061 bgpd: only rescan EVPN tables if self-mac changes
When processing an interface up/create event from zebra, we insert that
interface's MAC address into the self_mac_hash used for dropping EVPN
routes carrying a 'self mac' (RMAC ext-comm or MAC in Type-2 NLRI).
However, we were unconditionally triggering a "rescan" of the EVPN RIB
to ensure we handle routes that match the MAC - even if the MAC already
existed in self_mac_hash (i.e. the change wasn't actionable).
This adds logic to only kick off a "rescan" if the MAC learned from
zebra is not already in the self_mac_hash.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-30 15:20:35 +00:00
Donald Sharp
63e04998a7
Merge pull request #13414 from LabNConsulting/chopps/no-mgmtd-nowrite-on-off
rework messaging, resource handling in mgmtd with bug fix and code hardening
2023-05-30 10:48:32 -04:00