Commit Graph

22862 Commits

Author SHA1 Message Date
GalaxyGorilla
4ea5353bfd ospfd: Add TI-LFA Prefix-SID Protection
Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-01-19 15:32:13 +00:00
GalaxyGorilla
385a1e07b1 ospfd: Add support for TI-LFA node protection
Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-01-19 15:32:13 +00:00
GalaxyGorilla
cc1725bd34 ospfd: Make use of adjacency SIDs in TI-LFA
When P and Q spaces are adjacent then it makes sense to use adjacency SIDs to
from the P node to the Q node. There are some other corner cases where this
makes also sense like when a P/Q node adjacent to root node.

Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-01-19 15:32:13 +00:00
GalaxyGorilla
133e59cfad ospfd: Add support for reverse SPF (P2P only)
A reverse SPF is important in the context of TI-LFA, e.g. for
computing so called Q spaces. In case the weights of the links are
symmetric there is no difference to the 'normal' SPF and hence this
patch is really just needed for the case with asymmetric link
weights.

Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-01-19 15:32:13 +00:00
GalaxyGorilla
7fd0729f76 ospfd: TI-LFA basic infrastructure and algorithms
Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-01-19 15:32:13 +00:00
Donald Sharp
45e56ec4c2 lib: Fix up str2prefix usage in lua code
Two new coverity issues from inclusion of new lua code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-19 09:29:50 -05:00
Donald Sharp
6351ea6ebf
Merge pull request #7886 from volta-networks/master
pathd: add meaningful names to threads
2021-01-19 09:12:30 -05:00
Mark Stapp
5898ce6f35 libs,zebra: remove zapi nhg encode and decode public apis
The raw zapi apis to encode and decode NHGs don't need to be
public; also add a little more validity-checking.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-01-19 08:48:54 -05:00
Rafael Zalamena
af05c8951c
Merge pull request #7840 from pguibert6WIND/bfd_misc_fixes_vrflite
Bfd misc fixes
2021-01-19 10:10:04 -03:00
Russ White
21a7815dc1
Merge pull request #7863 from chiragshah6/mdev
[yang,staticd]: remove when condition from static nexthop om
2021-01-19 07:48:28 -05:00
Russ White
a02d1bbfaa
Merge pull request #7884 from donaldsharp/null_stuff
Null stuff
2021-01-19 07:44:21 -05:00
Russ White
4c35f214b7
Merge pull request #6455 from GalaxyGorilla/bfd_ospf_topotest
tests: Introduce BFD OSPFv2/v3 topotests
2021-01-19 07:39:05 -05:00
Russ White
c0b6ef23f7
Merge pull request #7639 from qlyoung/frr-lua
Scripting
2021-01-19 07:17:03 -05:00
Javier Garcia
5ffdc11eda pathd: add meaningful names to threads
Signed-off-by: Javier Garcia <javier.garcia@voltanet.io>
2021-01-19 11:42:48 +01:00
kuldeepkash
693a44e183 tests: Add new scenarios to test multicast-pim-sm(different topology)
Add new scenarios to test multicast-pim-sm(different topology)

Signed-off-by: kuldeepkash <kashyapk@vmware.com>
2021-01-18 20:09:07 +00:00
kuldeepkash
eab72dc8e0 tests: Add/enhance framework for multicast-pim-sm automation
1. Add/enhance framework for multicast-pim-sm automation

Signed-off-by: kuldeepkash <kashyapk@vmware.com>
2021-01-18 20:09:07 +00:00
kuldeepkash
c9b5d52c65 tests: Add new scenarios to test multicast-pim-sm
1, Added new scenarios to test multicast-pim-sm

Signed-off-by: kuldeepkash <kashyapk@vmware.com>
2021-01-18 20:08:53 +00:00
Kuldeep Kashyap
6f86321528 tests: Add multicast-pim-bsm-topo2 suite
1. Added 7 testcases to verify PIM BSM functionality. Here we have used Scapy
   to send raw packet, generated using Cisco and FRR. Raw packets are kept in

Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
2021-01-18 18:17:13 +00:00
Kuldeep Kashyap
bf17e2dffe doc: Updated topotest.rst doc with scapy details
1. Scapy, is a python tool, which would be used in multicast-pim-bsm-topo1
   suite automation. We have some BSM raw packets captured and saved in
   JSON file, these packets would be sent using scapy on tests demands.

Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
2021-01-18 18:17:13 +00:00
Kuldeep Kashyap
df94c7e840 tests: Add multicast-pim-bsm-topo1 suite
1. Added 8 testcases to verify PIM BSM functionality. Here we have used Scapy
   to send raw packet, generated using Cisco and FRR. Raw packets are kept in
   JSON file and sent tests on-demand in script.

Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
2021-01-18 18:17:13 +00:00
Kuldeep Kashyap
f40b18e8bb tests: Add framework support for multicast-pim-bsm-topo1
1. Added framework support for multicast-pim-bsm-topo1 suite automation

Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
2021-01-18 18:17:06 +00:00
Donald Sharp
46e6f9f2ad lib: Correctly set temp file permissions
Set the temp file permissions to limit who can read
the file.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-18 09:32:00 -05:00
Donald Sharp
f6e07e1bdf bgpd: Use uint32_t for size value instead of int in ecommunity struct
The `struct ecommunity` structure is using an int for a size value.
Let's switch it over to a uint32_t for size values since a size
value for data can never be negative.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-18 09:06:49 -05:00
Donald Sharp
3a15018892 zebra: Tell SA that we are intentionally ignoring the return
Calling fpm_nl_enqueue we should expect a it fit or not
return value on the outgoing stream.  This is not necessary
to check here because the while loop where we are checking this
already has ensured that the data being written will fit.

CID -> 1499854
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-18 09:06:49 -05:00
Donald Sharp
920bb6f76a pbrd: Prevent possible NULL use
the pnhi data structure can receive either a interface or a
nhr data structure.  Ensure that we don't crash.

CID -> 1500586
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-18 09:06:49 -05:00
Donald Sharp
5c8ecf6e46 bgpd: attr is already derefed cannot be null here
In the function bgp_adj_out_set_subgroup, the attr pointer
is already derefed in all paths leading to a test for NULL.
You cannot pass a NULL attribute in since the whole function
would just immediately crash.

CID -> 1500604
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-18 09:06:49 -05:00
Donald Sharp
4168228f25
Merge pull request #7790 from mobash-rasool/ospfv3-max-path
ospfd: Clear ip ospf process and clear ip ospf neighbor
2021-01-18 06:44:18 -05:00
sudhanshukumar22
a4559740ea bgpd:'bgpd' core generated on Leaf device with system-test config
Description:
aggregate member route was enqueued for recalculation
    while bgp instance was deleted.
    As part of aggregate member route deletion, the aggregate route is
    reinstalled with self-peer as source, but self-peer is already removed.
    Assert() for null peer pointer is path attribute aborts bgp.
Problem Description/Summary :
BGP crashed while cleaning up aggregate route as part of bgp instance deletion.
-----------------------
Leaf-4(config)#
Leaf-4(config)# no router bgp 65179 vrf Vrf-red
Leaf-4(config)# no router bgp 65179
Leaf-4(config)#
Leaf-4(config)#
Leaf-4(config)# root@Leaf-4:~#

Sep 26 15:38:21.257554 System is not ready - Core services are down
------------
router bgp 65179
bgp router-id 100.2.0.3
no bgp default ipv4-unicast
bgp network import-check
neighbor LeafToHostv4 peer-group
neighbor LeafToHostv4 remote-as 65003
neighbor LeafToHostv6 peer-group
neighbor LeafToHostv6 remote-as 65003
neighbor LeafToSpinev4 peer-group
neighbor LeafToSpinev4 remote-as 65134
neighbor LeafToSpinev4 bfd
neighbor LeafToSpinev6 peer-group
neighbor LeafToSpinev6 remote-as 65134
neighbor LeafToSpinev6 bfd
neighbor WindowsServer peer-group
neighbor WindowsServer remote-as 65201
neighbor 155.1.0.4 peer-group LeafToSpinev4
neighbor 155.2.0.4 peer-group LeafToSpinev4
neighbor 2000:155:1::4 peer-group LeafToSpinev6
neighbor 2000:155:2::4 peer-group LeafToSpinev6
neighbor 172.16.11.2 peer-group WindowsServer
neighbor 172.16.1.2 remote-as 65101
neighbor 2000:172:16:1::2 remote-as 65101
bgp listen limit 400
bgp listen range 133.3.0.0/16 peer-group LeafToHostv4
bgp listen range 2000:133:3::/48 peer-group LeafToHostv6
!
address-family ipv4 unicast
aggregate-address 133.1.0.0/16 as-set
aggregate-address 133.2.0.0/16 as-set
aggregate-address 133.3.0.0/16 as-set
aggregate-address 133.4.0.0/16 as-set
redistribute connected
neighbor LeafToHostv4 activate
neighbor LeafToSpinev4 activate
neighbor LeafToSpinev4 allowas-in 1
neighbor LeafToSpinev4 route-map spine_v4_export out
neighbor WindowsServer activate
neighbor 172.16.1.2 activate
exit-address-family
!
address-family ipv6 unicast
aggregate-address 2000:133:1::/48 as-set
aggregate-address 2000:133:2::/48 as-set
aggregate-address 2000:133:3::/48 as-set
aggregate-address 2000:133:4::/48 as-set
redistribute connected
..
------------
(gdb) bt
name=0x55607dd49090 <_FUNCTION_.23915> "bgp_path_info_add")
at bgpd/bgpd.c:1159
name=name@entry=0x55607dd49090 <_FUNCTION_.23915> "bgp_path_info_add",
peer=<optimized out>) at bgpd/bgpd.c:1158
pi=<optimized out>) at bgpd/bgp_route.c:313
afi=afi@entry=AFI_IP, safi=safi@entry=SAFI_UNICAST,
p=p@entry=0x55607f1c4e10, origin=<optimized out>, aspath=0x55607f4bc8a0,
community=<optimized out>, ecommunity=<optimized out>,
lcommunity=<optimized out>, atomic_aggregate=0 '\000',
aggregate=0x55607f1c4ee0) at bgpd/bgp_route.c:5926
aggr_p=<optimized out>, aggregate=<optimized out>, pi=0x55607f41f9f0,
safi=SAFI_UNICAST, afi=AFI_IP, bgp=0x55607eeba5d0) at bgpd/bgp_route.c:6385
del=del@entry=0x55607f41f9f0, afi=afi@entry=AFI_IP,
--Type <return> to continue, or q <return> to quit--
safi=safi@entry=SAFI_UNICAST) at bgpd/bgp_route.c:6446
pi=0x55607f41f9f0, peer=0x55607ef22c10, afi=AFI_IP, safi=SAFI_UNICAST)
at bgpd/bgp_route.c:2885
data=<optimized out>) at bgpd/bgp_route.c:4125
at lib/workqueue.c:291
at lib/thread.c:1540
at bgpd/bgp_main.c:498
(gdb) fr 5
name=name@entry=0x55607dd49090 <_FUNCTION_.23915> "bgp_path_info_add",
peer=<optimized out>) at bgpd/bgpd.c:1158
1158 bgpd/bgpd.c: No such file or directory.
(gdb) fr 10
pi=0x55607f41f9f0, peer=0x55607ef22c10, afi=AFI_IP, safi=SAFI_UNICAST)
at bgpd/bgp_route.c:2885
2885 bgpd/bgp_route.c: No such file or directory.
(gdb) p peer->lock
$2 = 210
(gdb) p peer->status
$3 = 8
(gdb)
(gdb) p bgp
$11 = (struct bgp *) 0x56121ba315d0
(gdb) p bgp->peer_self
$12 = (struct peer *) 0x0
(gdb) p bgp->name
$13 = 0x0
(gdb) p bgp->name_pretty
$14 = 0x56121bb046a0 "VRF default"
(gdb) p bgp->inst_type
$15 = BGP_INSTANCE_TYPE_DEFAULT
(gdb)

bgp_aggregate_install():
5920
5921 new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_AGGREGATE, 0,
5922 bgp->peer_self, attr, rn);
5923
5924 SET_FLAG(new->flags, BGP_PATH_VALID);
5925
5926 bgp_path_info_add(rn, new);
5927 bgp_process(bgp, rn, afi, safi);

299 void bgp_path_info_add(struct bgp_node *rn, struct bgp_path_info *pi):
...
310
311 bgp_path_info_lock(pi);
312 bgp_lock_node(rn);
313 peer_lock(pi->peer); /* bgp_path_info peer reference */ <<< This points to bgp->peer_self = NULL
314 }

1573 #define peer_lock(B) peer_lock_with_caller(_FUNCTION_, (B))

1156 /* increase reference count on a struct peer */
1157 struct peer *peer_lock_with_caller(const char *name, struct peer *peer)
1158 {
1159 assert(peer && (peer->lock >= 0)); <<< asserted here
1160

Similar issue was fixed in community and we already have the fix:
https://github.com/FRRouting/frr/pull/4816
root@sr407497_lxc2:/home/ubuntu/frr_repo/frr/bgpd# git diff dfb6fd1dd119a5bd660012e940e8328534547e76~ dfb6fd1dd1
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index abad1db..a372568 100644
— a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -5332,6 +5332,13 @@ static void bgp_purge_af_static_redist_routes(struct bgp *bgp, afi_t afi,
struct bgp_node *rn;
struct bgp_path_info *pi;

+ /* Do not install the aggregate route if BGP is in the
+ * process of termination.
+ */
+ if (bgp_flag_check(bgp, BGP_FLAG_DELETE_IN_PROGRESS) ||
+ (bgp->peer_self == NULL))
+ return;
+
table = bgp->rib[afi][safi];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) {

But looks like similar handling is required at other places as well:

Expected Behavior :
BGP daemon should not crash

Signed-off-by: sudhanshukumar22 <sudhanshu.kumar@broadcom.com>
2021-01-18 01:33:56 -08:00
Donatas Abraitis
fba9c8d2fd
Merge pull request #7874 from donaldsharp/more_pytest_mark
More pytest mark
2021-01-18 10:12:24 +02:00
Donatas Abraitis
aedb252280
Merge pull request #7873 from donaldsharp/bgp_gtsm_peer_group_fix
bgpd: Allow peer-groups to have `ttl-security hops` configured
2021-01-18 10:10:51 +02:00
Vijay Gupta
d25f322e5a tests: Add multicast-pim-static-rp-topo1 test suits
Signed-off-by: Vijay Gupta <vijayg@vmware.com>

1 Added 17 testcases to verify multicast static RP functionality
2 Execution time ~12min
2021-01-17 21:41:20 -08:00
Vijay Gupta
071feb8267 tests: Add PIM library
Signed-off-by: Vijay Gupta <vijayg@vmware.com>

1 Added PIM lib to create create and verify PIM configurations
2021-01-17 21:41:05 -08:00
Martin Winter
849909ef51
Merge pull request #7882 from donaldsharp/keepalive_default
tests: Set default timers to 3/10 for bgp using create_router_bgp
2021-01-17 20:49:51 +01:00
Donald Sharp
6c04922259
Merge pull request #7881 from logbob0401/correct_sysrepo_lib_name
Correct sysrepo library name in configure.ac
2021-01-16 10:21:03 -05:00
Donald Sharp
e1713aa16d tests: Set default timers to 3/10 for bgp using create_router_bgp
Tests were timing out in our test system due to lost packets and
flakiness of the lower end systems.  Just set the timers to 3/10
and give them plenty of time to converge.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-16 08:29:49 -05:00
Bo Zhang
9a3b4141db configure.ac: Correct library name for sysrepo
Northbound_sysrepo: Correct sysrepo library name in configure.ac

Signed-off-by: Bo Zhang <logbob0401@gmail.com>
2021-01-15 22:09:27 -08:00
Donald Sharp
d33da0e071 zebra: A zebra route-map delay-timer 0 command should still run the route-map
Setting `zebra route-map delay-timer 0` completely turns of any
route-map processing in zebra.  Which is completely wrong.  A timer
of 0 means `do it now`.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 19:34:33 -05:00
Donald Sharp
fed1681178 tests: Modify zebra_rib tests to include some basic route-map tests
New test does this:
a) Ensures that we run the correct number of times given two
`ip protocol X` commands( ie we do not run the route-map application
against all routes, only those affected )
b) Ensure that when we modify the route-map the state ends up sane
this includes making a static route depend on a sharp route that
gets removed from the change of the sharp route-map
c) Ensure that the kernel routes are correct.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 19:34:33 -05:00
Donald Sharp
4dfcfabfa9 zebra: Push timer out if another route-map change comes in for zebra
If we are running with a delayed timer to handle route-map changes
in zebra, if another route-map change is made to the cli, push
out the timer instead of not modifying the timer.  This will
allow a large set of route-maps to be possibly be read in by
the system and we don't have a state where new route-map
changes are being read in and having the timer pop in
the middle of it.

Additionally convert to use THREAD_OFF, preventing a possible
use after free as well as aligning the thread api usage
with what we consider correct.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 19:34:33 -05:00
Donald Sharp
cfcd844c0b zebra: Limit routemap changes to reconsider only routes associated with that rm
Current code when a route map changes schedules a rerun of all routes in the
particular table.  So if you modify the `ip protocol XX route-map FOO`
route-map `FOO` all routes will be rechecked.  This is extremely expensive.

Modify zebra to only update the routes associated with the route-map.  So
if we have 800k bgp routes and 50 ospf routes and we are route-map'ing
the ospf routes we'll only look at 50 routes.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 19:34:33 -05:00
Donald Sharp
54aeba3540 zebra: Allow rib_update_table to receive a specified route type
When we need to cause a reprocessing of data the code currently
marks all routes as needing to be looked at.  Modify the
rib_update_table code to allow us to specify a specific route
type we only want to reprocess.  At this point none
of the code is behaving differently this is just setup
for a future code change.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 19:34:33 -05:00
Donald Sharp
1866a6f65b zebra: remove unused function rib_update_vrf
The function rib_update_vrf is never used.  Remove it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 19:34:33 -05:00
Donald Sharp
284a6f5ff1 lib: Keep track of route-map applications per section
When the routemap code was rewritten for performance the
code to track the number of times a particular section of
a route-map was applied was not correctly updated.  In
this case I found another sequence of events where the
number of times a section was invoked was not being correctly
kept.

Effectively in this case when route_map_get_index is called
and returns an index the route map has been applied( see that
skip_match_clause is set to true and then in the for loop
below the skip_match_clause is tested and index->applied is
incremented.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 19:34:33 -05:00
Donald Sharp
3d34678f1d doc: Document the "zebra route-map delay-timer" functionality
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 19:34:33 -05:00
Donald Sharp
e43bb30294
Merge pull request #7878 from opensourcerouting/ldpd-metric-issue
ldpd: fix sporadic failures in the ldp-topo1 topotest
2021-01-15 18:24:38 -05:00
Mark Stapp
18768cc1f9
Merge pull request #7875 from deastoe/fpm-nlmsg-pid
zebra: set nlmsg_pid in netlink msgs sent by 'fpm'
2021-01-15 16:28:46 -05:00
Renato Westphal
1fd7ae7268 ldpd: fix sporadic failures in the ldp-topo1 topotest
Commit 220e848cc5 introduced an optimization that would prevent ldpd
from sending redundant label mappings when it receives notifications
from zebra about routes that didn't effectively change (such
notifications can happen under certain circumstances).

The problem is that that commit didn't take into account the metric
of the received routes, so it would dismiss a notification of a
route with a better metric taking the place of another route in the
RIB, preventing the newly selected route from receiving the label
mappings it needs.

Revert 220e848cc5 temporarily to fix sporadic failures in the CI
system until we have a better solution.

Debugged-by: Lynne Morrison lynne@voltanet.io
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-01-15 17:44:46 -03:00
Duncan Eastoe
869a5f7168 zebra: set nlmsg_pid in netlink msgs sent by 'fpm'
Use nl_pid from the netlink socket used for programming the kernel
(netlink_dplane) in netlink route messages sent by the 'fpm' module.

This makes 'fpm' consistent with 'dplane_fpm_nl' which already
behaves this way, and allows FPM server implementations to determine
route origin via nlmsg_pid.

Signed-off-by: Duncan Eastoe <duncan.eastoe@att.com>
2021-01-15 16:28:06 +00:00
Mark Stapp
0189d02fe1
Merge pull request #7844 from vishaldhingra/static
staticd: correct table-id handling for static routes.
2021-01-15 09:35:12 -05:00
Donald Sharp
3771ded194 tests: Add pytest.mark.pbr
Add a mark to topotests that mark pbr tests

`pytest -k pbr`

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 09:18:59 -05:00