]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
20 months agoMerge pull request #14207 from routingrocks/cover_fixes
Donatas Abraitis [Wed, 16 Aug 2023 06:00:06 +0000 (09:00 +0300)]
Merge pull request #14207 from routingrocks/cover_fixes

bgpd: fix coverity issue in bgpd

20 months agoMerge pull request #14184 from opensourcerouting/fix/cpu-wall-warning_vtysh_fixes_for...
Donald Sharp [Tue, 15 Aug 2023 20:01:07 +0000 (16:01 -0400)]
Merge pull request #14184 from opensourcerouting/fix/cpu-wall-warning_vtysh_fixes_for_no_form

lib: Allow unsetting walltime-warning and cpu-warning

20 months agobgpd: fix coverity issue in bgpd 14207/head
Rajesh Varatharaj [Tue, 15 Aug 2023 18:13:20 +0000 (11:13 -0700)]
bgpd: fix coverity issue in bgpd

Should address this issue:
** CID 1566843:  Uninitialized variables  (UNINIT)
/bgpd/bgp_route.c: 6754 in bgp_static_set()
6748                            bgp_static->backdoor = backdoor;
6749                            bgp_static->valid = 0;
6750                            bgp_static->igpmetric = 0;
6751                            bgp_static->igpnexthop.s_addr = INADDR_ANY;
6752                            bgp_static->label_index = label_index;
6753                            bgp_static->label = label;
>>>     CID 1566843:  Uninitialized variables  (UNINIT)
>>>     Using uninitialized value prd.
6754                            bgp_static->prd = prd;
6755
6756                            if (rmap) {
6757                                    XFREE(MTYPE_ROUTE_MAP_NAME,
6758                                          bgp_static->rmap.name);
6759                                    route_map_counter_decrement(

Testing Done:
 build

Ticket: #NA
Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
20 months agoMerge pull request #14193 from donaldsharp/pim_vxlan_weirdness
mobash-rasool [Tue, 15 Aug 2023 16:56:21 +0000 (22:26 +0530)]
Merge pull request #14193 from donaldsharp/pim_vxlan_weirdness

Do not look into pim's eyes, pim gets mad

20 months agoMerge pull request #14016 from mjstapp/event_exec_ptr
Donald Sharp [Tue, 15 Aug 2023 15:52:49 +0000 (11:52 -0400)]
Merge pull request #14016 from mjstapp/event_exec_ptr

* : include event ptr in event_execute api

20 months agoMerge pull request #14175 from samanvithab/bgpd_update_err_fix
Russ White [Tue, 15 Aug 2023 15:35:37 +0000 (11:35 -0400)]
Merge pull request #14175 from samanvithab/bgpd_update_err_fix

bgpd: Few fixes for Update message error handling of malformed attribute

20 months agoMerge pull request #14198 from opensourcerouting/feature/refactor_bgp_static_set
Donald Sharp [Tue, 15 Aug 2023 13:36:18 +0000 (09:36 -0400)]
Merge pull request #14198 from opensourcerouting/feature/refactor_bgp_static_set

bgpd: Refactor bgp_static_set/bgp_static_set_safi

20 months agopimd: Add whether or not the rpf succeeded or not to the debug 14193/head
Donald Sharp [Sat, 12 Aug 2023 15:40:30 +0000 (11:40 -0400)]
pimd: Add whether or not the rpf succeeded or not to the debug

Hard to know what is going on if the debug doesn't tell us.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agopimd: Intentionally rescan oil when RPF fails on upstream creation
Donald Sharp [Sat, 12 Aug 2023 15:29:37 +0000 (11:29 -0400)]
pimd: Intentionally rescan oil when RPF fails on upstream creation

When pim is creating an upstream for a S,G that it has received
*but* it has not received a route to the S, the oil is not
scanned to see if it should inherit anything from the *,G
that may be present when it cannot find the correct iif to
use.  When the nexthop tracking actually
resolves the route, the oil is never rescanned and the
S,G stream will be missing a correct oil list leading
to absolute mayhem in the network.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agobgpd: Refactor bgp_static_set/bgp_static_set_safi 14198/head
Donatas Abraitis [Thu, 10 Aug 2023 08:37:40 +0000 (11:37 +0300)]
bgpd: Refactor bgp_static_set/bgp_static_set_safi

Those two functions are very similar, let's get a single one.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agoMerge pull request #14189 from donaldsharp/do_not_use_system_calls
Jafar Al-Gharaibeh [Sun, 13 Aug 2023 21:02:17 +0000 (16:02 -0500)]
Merge pull request #14189 from donaldsharp/do_not_use_system_calls

doc: Prohibit usage of `system()` calls in FRR

20 months agoMerge pull request #14183 from donaldsharp/zebra_routemap_cleanup
Donatas Abraitis [Sun, 13 Aug 2023 16:57:30 +0000 (19:57 +0300)]
Merge pull request #14183 from donaldsharp/zebra_routemap_cleanup

Zebra routemap cleanup

20 months agoMerge pull request #14096 from gongjianLhr/dup_fix
Donatas Abraitis [Sun, 13 Aug 2023 13:44:49 +0000 (16:44 +0300)]
Merge pull request #14096 from gongjianLhr/dup_fix

zebra: remove duplicated nexthops when sending fpm msg

20 months agoMerge pull request #14126 from LabNConsulting/ziemba-pbr-actions-mangling
Donatas Abraitis [Sun, 13 Aug 2023 13:39:07 +0000 (16:39 +0300)]
Merge pull request #14126 from LabNConsulting/ziemba-pbr-actions-mangling

pbrd: (3/3) add packet mangling actions (src/dst ip-addr/port, dscp, ecn)

20 months agopimd: Allow more immediate null registers to be sent in the vxlan code
Donald Sharp [Sat, 12 Aug 2023 04:14:00 +0000 (00:14 -0400)]
pimd: Allow more immediate null registers to be sent in the vxlan code

When a pim vxlan S,G is created, the code attempts to send out a NULL
register.  This is used to build the S,G tree from the RP to the
FHR.  Upon initial startup it is not unusual for the pim vxlan state
be fully ready to go but the RP is still not reachable.  Let's add
a bit of a pump prime that allows the vxlan code to re-attempt to
send the null register for vxlan S,G's that the RP's outgoing
interface changed from unknown to an actual interface.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agobgpd: Fix update message error handling for multiple same attributes 14175/head
Samanvitha B Bhargav [Fri, 11 Aug 2023 10:32:16 +0000 (03:32 -0700)]
bgpd: Fix update message error handling for multiple same attributes

As per RFC7606 section 3g,
   g.  If the MP_REACH_NLRI attribute or the MP_UNREACH_NLRI [RFC4760]
       attribute appears more than once in the UPDATE message, then a
       NOTIFICATION message MUST be sent with the Error Subcode
       "Malformed Attribute List".  If any other attribute (whether
       recognized or unrecognized) appears more than once in an UPDATE
       message, then all the occurrences of the attribute other than the
       first one SHALL be discarded and the UPDATE message will continue
       to be processed.
However, notification is sent out currently for all the cases.
Fix:
For cases other than MP_REACH_NLRI & MP_UNREACH_NLRI, handling has been updated
to discard the occurrences other than the first one and proceed with further parsing.
Again, the handling is relaxed only for the EBGP case.
Also, since in case of error, the attribute is discarded &
stream pointer is being adjusted accordingly based on length,
the total attribute length sanity check case has been moved up in the function
to be checked before this case.

Signed-off-by: Samanvitha B Bhargav <bsamanvitha@vmware.com>
20 months agobgpd: Fix update message error handling for total attribute length
Samanvitha B Bhargav [Tue, 8 Aug 2023 12:09:16 +0000 (05:09 -0700)]
bgpd: Fix update message error handling for total attribute length

As per RFC7606 section 4,
when the total attribute length value is in conflict with the
enclosed attribute length, treat-as-withdraw approach must be followed.
However, notification is being sent out for this case currently,
that leads to session reset.
Fix:
The handling has been updated to conform to treat-as-withdraw
approach only for EBGP case. For IBGP, since we are not following
treat-as-withdraw approach for any of the error handling cases,
the existing behavior is retained for the IBGP.

Signed-off-by: Samanvitha B Bhargav <bsamanvitha@vmware.com>
20 months agopimd: Prevent vxlan from causing a S,G RPT Prune in some cases
Donald Sharp [Sat, 12 Aug 2023 04:06:51 +0000 (00:06 -0400)]
pimd: Prevent vxlan from causing a S,G RPT Prune in some cases

Upon startup the pim vxlan code initiates a pim null register
send for the S,G and sends a *,G join towards the RP at the same
time.  Since a S,G upstream is created in the vxlan code with
the appropriate flags, the *,G join has the embedded S,G RPT
Prune.  When an intermediate route receives this *,G RPT Prune
it creates a blackhole S,G route since this particular intermediate
router has not received a join from the RP yet( say the packet is
lost, or that part of the network is slower coming up ).

Let's try to intelligently decide that the S,G RPT Prune
should not be sent as part of the *,G join until the actual
S,G join from the RP reaches this box.  Then we can make
intelligent decisions about whether or not to send it
out.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agotests: Make bgp_evpn_mh a 3 level clos
Donald Sharp [Sat, 12 Aug 2023 03:51:07 +0000 (23:51 -0400)]
tests: Make bgp_evpn_mh a 3 level clos

The tests were originally tor --- spine
lets add a tor -- leaf -- spine.  At this
point this change was to allow me to test
some funkiness I am seeing in pim vxlan setups
when the leaf is acting as the intermediate routers.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agoMerge pull request #14182 from donaldsharp/bgp_evpn_lock_problem
Jafar Al-Gharaibeh [Sat, 12 Aug 2023 00:52:37 +0000 (19:52 -0500)]
Merge pull request #14182 from donaldsharp/bgp_evpn_lock_problem

bgpd: evpn code was not properly unlocking rd_dest

20 months agodoc: Prohibit usage of `system()` calls in FRR 14189/head
Donald Sharp [Fri, 11 Aug 2023 16:40:40 +0000 (12:40 -0400)]
doc: Prohibit usage of `system()` calls in FRR

See the documentation update, but system() calls and
it's ilk block the processing of SIGINT and they are
not properly handled as a result leading to shutdown
issues where one or more daemons never stop.

See aa530b627de8d1d8c11e4455f3e97a8c2e045281 as an example
of system call usage removed from the system.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agoMerge pull request #14176 from pguibert6WIND/mpls_yang_enable_disable
Donatas Abraitis [Fri, 11 Aug 2023 15:36:35 +0000 (18:36 +0300)]
Merge pull request #14176 from pguibert6WIND/mpls_yang_enable_disable

Mpls yang enable disable

20 months agovtysh: Print uniq lines when parsing `no service ...` 14184/head
Donatas Abraitis [Fri, 11 Aug 2023 15:21:12 +0000 (18:21 +0300)]
vtysh: Print uniq lines when parsing `no service ...`

Before this patch:

```
no service cputime-warning
no service cputime-warning
no ipv6 forwarding
no service cputime-warning
no service cputime-warning
no service cputime-warning
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agozebra: Remove tag from zebra_rmap_obj 14183/head
Donald Sharp [Fri, 11 Aug 2023 15:21:03 +0000 (11:21 -0400)]
zebra: Remove tag from zebra_rmap_obj

The tag value in all cases was being set to the re->tag.
re is already stored, so let's just use that.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agozebra: Use the re->metric instead of 0 for zebra_rmap_obj
Donald Sharp [Fri, 11 Aug 2023 15:17:29 +0000 (11:17 -0400)]
zebra: Use the re->metric instead of 0 for zebra_rmap_obj

The zebra_rmap_obj was storing the re->metric and allowing
matches against it, but in most cases it was just using 0.
Use the Route entries metric instead.  This should fix
some bugs where a match metric never worked.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agozebra: Remove instance from zebra_rmap_obj data structure
Donald Sharp [Fri, 11 Aug 2023 15:15:06 +0000 (11:15 -0400)]
zebra: Remove instance from zebra_rmap_obj data structure

In all cases the instance is derived from the re pointer
and since the re pointer is already stored, let's just
remove it from the game and cut to the chase.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agozebra: Replace source_protocol with just using re in route map object
Donald Sharp [Fri, 11 Aug 2023 15:11:40 +0000 (11:11 -0400)]
zebra: Replace source_protocol with just using re in route map object

Replace the source_protocol with just saving a pointer to the re
in the `struct zebra_rmap_obj` data structure.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agolib: Allow unsetting walltime-warning and cpu-warning
Donatas Abraitis [Fri, 11 Aug 2023 15:11:03 +0000 (18:11 +0300)]
lib: Allow unsetting walltime-warning and cpu-warning

With a negative form we get:

```
Internal CLI error [walltime_warning_str]
Internal CLI error [cputime_warning_str]
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agozebra: Remove vrf_id from passed around object
Donald Sharp [Fri, 11 Aug 2023 15:06:04 +0000 (11:06 -0400)]
zebra: Remove vrf_id from passed around object

The nexthop that is stored already knows it's nexthop and
in all cases the vrf id is derived from the nexthop->vrf_id
let's just cut to the chase and not do this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agozebra: import table match against interface name could fail
Donald Sharp [Fri, 11 Aug 2023 14:18:41 +0000 (10:18 -0400)]
zebra: import table match against interface name could fail

If an import table route-map is trying to match against
a particular interface, The code is matching against
the actual vrf the route entry is in -vs- the vrf
the nexthop entry is in.  Let's modify the code
to actually allow the import table entry to match
against the nexthops vrf.

Not working:

ip import-table 91
ip import-table 93 route-map FOO
no service integrated-vtysh-config
!
debug zebra events
!
interface green
 ip address 192.168.4.3/24
exit
!
route-map FOO permit 10
 match interface green
exit

eva# 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, r - rejected, b - backup
       t - trapped, o - offload failure

K>* 0.0.0.0/0 [0/100] via 192.168.119.1, enp13s0, 1d10h07m
T[91]>* 1.2.3.5/32 [15/0] via 192.168.119.1, enp13s0, 00:00:05
K>* 169.254.0.0/16 [0/1000] is directly connected, virbr0 linkdown, 1d16h34m
C>* 192.168.44.0/24 is directly connected, virbr1, 01:30:51
C>* 192.168.45.0/24 is directly connected, virbr2, 01:30:51
C>* 192.168.119.0/24 is directly connected, enp13s0, 1d16h34m
C>* 192.168.122.0/24 is directly connected, virbr0 linkdown, 01:30:51
eva# show ip route table 91
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, r - rejected, b - backup
       t - trapped, o - offload failure

VRF default table 91:
K>* 1.2.3.5/32 [0/0] via 192.168.119.1, enp13s0, 00:00:15
eva# show ip route table 93
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, r - rejected, b - backup
       t - trapped, o - offload failure

VRF default table 93:
K * 1.2.3.4/32 [0/0] via 192.168.4.5, green (vrf green), 00:03:05

Working:

eva# 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, r - rejected, b - backup
       t - trapped, o - offload failure

K>* 0.0.0.0/0 [0/100] via 192.168.119.1, enp13s0, 00:03:09
T[93]>* 1.2.3.4/32 [15/0] via 192.168.4.5, green (vrf green), 00:02:21
T[91]>* 1.2.3.5/32 [15/0] via 192.168.119.1, enp13s0, 00:02:26
K>* 169.254.0.0/16 [0/1000] is directly connected, virbr0, 00:03:09
C>* 192.168.44.0/24 is directly connected, virbr1, 00:03:09
C>* 192.168.45.0/24 is directly connected, virbr2, 00:03:09
C>* 192.168.119.0/24 is directly connected, enp13s0, 00:03:09
C>* 192.168.122.0/24 is directly connected, virbr0, 00:03:09
eva# show ip route table 91
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, r - rejected, b - backup
       t - trapped, o - offload failure

VRF default table 91:
K * 1.2.3.5/32 [0/0] via 192.168.119.1, enp13s0, 00:03:12
eva# show ip route table 93
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, r - rejected, b - backup
       t - trapped, o - offload failure

VRF default table 93:
K * 1.2.3.4/32 [0/0] via 192.168.4.5, green (vrf green), 00:03:14

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agozebra: Rename `struct nh_rmap_obj` to `struct zebra_rmap_obj`
Donald Sharp [Fri, 11 Aug 2023 14:12:06 +0000 (10:12 -0400)]
zebra: Rename `struct nh_rmap_obj` to `struct zebra_rmap_obj`

This structure is really the generic route map object for
handling routemaps in zebra.  Let's name it appropriately.
Future commits will consolidate the data to using the
struct route_entry as part of this data instead of copying
bits and bobs of it.  This will allow future work to
set/control the route_entry more directly.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agobgpd: evpn code was not properly unlocking rd_dest 14182/head
Donald Sharp [Fri, 11 Aug 2023 13:53:42 +0000 (09:53 -0400)]
bgpd: evpn code was not properly unlocking rd_dest

Found some code where bgp was not unlocking the dest
and rd_dest when walking the tree attempting to
find something to install.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agotopotests: add static mpls routing test 14176/head
Philippe Guibert [Fri, 4 Aug 2023 10:00:08 +0000 (12:00 +0200)]
topotests: add static mpls routing test

There is no test that checks for the mpls interface
configuration.
The new test checks that mpls configuration per
interface works when value is enabled or disabled.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
20 months agodoc: update mpls per interface command
Philippe Guibert [Mon, 31 Jul 2023 20:26:54 +0000 (22:26 +0200)]
doc: update mpls per interface command

Update mpls per interface command information.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
20 months agozebra, yang: add an mpls leaf to interface
Philippe Guibert [Sun, 9 Jul 2023 19:44:03 +0000 (21:44 +0200)]
zebra, yang: add an mpls leaf to interface

The yang NB API does not handle the mpls configuration
on its leaf.
Add an mpls leaf to stick to the mpls configuration.
- true or false to mean if config
- not defined, means no config.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
20 months agozebra: fix 'no mpls' command by using 'mpls disable' instead
Philippe Guibert [Thu, 13 Jul 2023 07:42:55 +0000 (09:42 +0200)]
zebra: fix 'no mpls' command by using 'mpls disable' instead

The 'no mpls' command wrongly assumes the user wants to disable
the mpls handling on the interface whereas this is just a config
knob that should mean 'I don't care with mpls'.

Fix this by adding a 'disable' option to the mpls command.

Fixes: 39ffa8e8e856 ("zebra: Add a `mpls enable` interface node command")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
20 months agoMerge pull request #14171 from mjstapp/fix_bgp_lblpool_indent
Donatas Abraitis [Thu, 10 Aug 2023 13:20:28 +0000 (16:20 +0300)]
Merge pull request #14171 from mjstapp/fix_bgp_lblpool_indent

bgpd: fix whitespace/indent in bgp_labelpool module

20 months agoMerge pull request #14170 from mjstapp/fix_bitfield_mtype
Donatas Abraitis [Thu, 10 Aug 2023 11:17:28 +0000 (14:17 +0300)]
Merge pull request #14170 from mjstapp/fix_bitfield_mtype

libs: use XREALLOC in bitfield lib module

20 months agoMerge pull request #14169 from qlyoung/amalgamate-checkping
Donald Sharp [Wed, 9 Aug 2023 23:47:56 +0000 (19:47 -0400)]
Merge pull request #14169 from qlyoung/amalgamate-checkping

tests: amalgamate check_ping

20 months agobgpd: fix whitespace/indent in bgp_labelpool module 14171/head
Mark Stapp [Wed, 9 Aug 2023 21:01:16 +0000 (17:01 -0400)]
bgpd: fix whitespace/indent in bgp_labelpool module

Fix some weird indentation in the bgp labelpool module.

Signed-off-by: Mark Stapp <mjs@labn.net>
20 months agolibs: use XREALLOC in bitfield lib module 14170/head
Mark Stapp [Wed, 9 Aug 2023 20:19:40 +0000 (16:19 -0400)]
libs: use XREALLOC in bitfield lib module

Use FRR mem api instead of raw realloc() in bitfield module.

Signed-off-by: Mark Stapp <mjs@labn.net>
20 months agotests: amalgamate check_ping 14169/head
Quentin Young [Wed, 9 Aug 2023 19:45:56 +0000 (15:45 -0400)]
tests: amalgamate check_ping

❌✂️📋

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
20 months agopbrd: add packet mangling actions (src/dst ip-addr/port, dscp, ecn) 14126/head
G. Paul Ziemba [Tue, 1 Aug 2023 18:00:52 +0000 (11:00 -0700)]
pbrd: add packet mangling actions (src/dst ip-addr/port, dscp, ecn)

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
20 months agopbrd: use flags to indicate active fields
G. Paul Ziemba [Mon, 31 Jul 2023 04:33:10 +0000 (21:33 -0700)]
pbrd: use flags to indicate active fields

    Before now, PBRD used non-zero values to imply that a rule's
    match or action field was active. This approach was getting
    cumbersome for fields where 0 is a valid active value and
    various field-specific magic values had to be used.

    This commit changes PBRD to use a flag bit per field to
    indicate that the field is active.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
20 months agoMerge pull request #14073 from fdumontet6WIND/as_path_replace_reg
Donatas Abraitis [Wed, 9 Aug 2023 12:28:58 +0000 (15:28 +0300)]
Merge pull request #14073 from fdumontet6WIND/as_path_replace_reg

  bgpd: add set as-path replace acl-list command

20 months agoMerge pull request #14099 from lkClare/formated_sync_0727
Donatas Abraitis [Wed, 9 Aug 2023 11:46:48 +0000 (14:46 +0300)]
Merge pull request #14099 from lkClare/formated_sync_0727

bgpd: bgp_path_info_extra memory optimization

20 months agodoc: set as-path replace as-path-access-list 14073/head
Francois Dumontet [Fri, 21 Jul 2023 13:38:21 +0000 (15:38 +0200)]
doc: set as-path replace as-path-access-list

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
20 months agopbrd: add explicit 'family' field for rules
G. Paul Ziemba [Mon, 31 Jul 2023 02:14:01 +0000 (19:14 -0700)]
pbrd: add explicit 'family' field for rules

    In the netlink-mediated kernel dataplane, each rule is stored
    in either an IPv4-specific database or an IPv6-specific database.
    PBRD opportunistically gleans each rule's address family value
    from its source or destination IP address match value (if either
    exists), or from its nexthop or nexthop-group (if it exists).

    The 'family' value is particularly needed for netlink during
    incremental rule deletion when none of the above fields remain set.

    Before now, this address family has been encoded by occult means
    in the (possibly otherwise unset) source/destination IP match
    fields in ZAPI and zebra.

    This commit documents the reasons for maintaining the 'family'
    field in the PBRD rule structure, adds a 'family' field in the
    common lib/pbr.h rule structure, and carries it explicitly in ZAPI.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
20 months agopbrd: PBR_FILTER_DSFIELD -> {PBR_FILTER_DSCP,PBR_FILTER_ECN}
G. Paul Ziemba [Tue, 1 Aug 2023 13:49:38 +0000 (06:49 -0700)]
pbrd: PBR_FILTER_DSFIELD -> {PBR_FILTER_DSCP,PBR_FILTER_ECN}

    DSCP and ECN matching are configured independently. Maintain
    these values in independent fields in pbrd, zapi, and zebra.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
20 months agopbrd: add nexthop drop type
G. Paul Ziemba [Sun, 30 Jul 2023 19:14:05 +0000 (12:14 -0700)]
pbrd: add nexthop drop type

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
20 months agoMerge pull request #14161 from opensourcerouting/fix/comment
Mark Stapp [Tue, 8 Aug 2023 16:36:58 +0000 (12:36 -0400)]
Merge pull request #14161 from opensourcerouting/fix/comment

bgpd: Fix RFC number in a comment

20 months agoMerge pull request #14154 from opensourcerouting/feature/bgpd_handle_role_capability_...
Russ White [Tue, 8 Aug 2023 14:47:04 +0000 (10:47 -0400)]
Merge pull request #14154 from opensourcerouting/feature/bgpd_handle_role_capability_using_dynamic_capability

bgpd: Handle role capability using dynamic capability

20 months agoMerge pull request #14158 from donaldsharp/listnode_stuff
Donatas Abraitis [Tue, 8 Aug 2023 13:31:57 +0000 (16:31 +0300)]
Merge pull request #14158 from donaldsharp/listnode_stuff

ospfd: Ensure listnode returns are usable

20 months agobgpd: Fix RFC number in a comment 14161/head
Donatas Abraitis [Tue, 8 Aug 2023 13:31:12 +0000 (16:31 +0300)]
bgpd: Fix RFC number in a comment

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agobgpd: bgp_path_info_extra memory optimization 14099/head
Valerian_He [Tue, 8 Aug 2023 10:47:29 +0000 (10:47 +0000)]
bgpd: bgp_path_info_extra memory optimization

Even if some of the attributes in bgp_path_info_extra are
not used, their memory is still allocated every time. It
cause a waste of memory.
This commit code deletes all unnecessary attributes and
changes the optional attributes to pointer storage. Memory
will only be allocated when they are actually used. After
optimization, extra info related memory is reduced by about
half(~400B -> ~200B).

Signed-off-by: Valerian_He <1826906282@qq.com>
20 months agoMerge pull request #14157 from donaldsharp/blargle_smargle
Donatas Abraitis [Tue, 8 Aug 2023 10:03:34 +0000 (13:03 +0300)]
Merge pull request #14157 from donaldsharp/blargle_smargle

bgpd: bgp_vrf is already deref'ed in all paths

20 months agoospfd: Ensure listnode returns are usable 14158/head
Donald Sharp [Mon, 7 Aug 2023 19:57:29 +0000 (15:57 -0400)]
ospfd: Ensure listnode returns are usable

Coverity is complaining that listnode can return a NULL
value and thus FRR could derefence the returned value.
Since this is not crashing we know that this is not happening
in the wild.  Let's make this an assert or check that it is
legal to use the value.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agoMerge pull request #14153 from idryzhov/vtysh-empty-interface
Donald Sharp [Mon, 7 Aug 2023 19:48:00 +0000 (15:48 -0400)]
Merge pull request #14153 from idryzhov/vtysh-empty-interface

vtysh: fix checking empty interface node

20 months agolib: pbr.h: remove unused PBR_FILTER_PROTO
G. Paul Ziemba [Sun, 30 Jul 2023 18:52:57 +0000 (11:52 -0700)]
lib: pbr.h: remove unused PBR_FILTER_PROTO

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
20 months agopbrd: pbr_vty.c organize/style
G. Paul Ziemba [Thu, 27 Jul 2023 18:15:39 +0000 (11:15 -0700)]
pbrd: pbr_vty.c organize/style

    No functional changes: just arrange CLI handlers into logical
    order and standardize DEFPY formatting.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
20 months agoMerge pull request #14155 from LabNConsulting/ziemba-zebra-pbr-ctx-common
Donald Sharp [Mon, 7 Aug 2023 19:15:25 +0000 (15:15 -0400)]
Merge pull request #14155 from LabNConsulting/ziemba-zebra-pbr-ctx-common

zebra: zebra_dplane.[ch]: use pbr common struct in ctx

20 months agobgpd: bgp_vrf is already deref'ed in all paths 14157/head
Donald Sharp [Mon, 7 Aug 2023 19:11:05 +0000 (15:11 -0400)]
bgpd: bgp_vrf is already deref'ed in all paths

The usage of bgp_vrf does not need to be tested
at this point since it's already been derefed in all
paths to this point.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agozebra: zebra_dplane.[ch]: use pbr common struct in ctx 14155/head
G. Paul Ziemba [Sun, 6 Aug 2023 15:51:01 +0000 (08:51 -0700)]
zebra: zebra_dplane.[ch]: use pbr common struct in ctx

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
20 months agotests: add one test to bgp_set_aspath_replace.py
Francois Dumontet [Mon, 17 Jul 2023 15:48:49 +0000 (17:48 +0200)]
tests: add one test to bgp_set_aspath_replace.py

add support of  set as-path replace as-path-access-list

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
20 months agobgpd: add set as-path exclude acl-list command
Francois Dumontet [Tue, 11 Jul 2023 08:03:04 +0000 (10:03 +0200)]
bgpd: add set as-path exclude acl-list command

A route-map applied on incoming BGP updates is not able
to replace an unwanted as segments by another one.
unwanted as segment are based on an AS path access-list.

The below configuration illustrates the case:

router bgp 65001

address-family ipv4 unicast
 neighbor 192.168.1.2 route-map rule_2 in
exit-address-family

bgp as-path access-list RULE permit ^65

route-map rule_2 permit 10
 set as-path replace as-path-access-list RULE 6000

```
BGP routing table entry for 10.10.10.10/32, version 13
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  192.168.10.65
  65000 1 2 3 123
    192.168.10.65 from 192.168.10.65 (10.10.10.11)
      Origin IGP, metric 0, valid, external, best (First path received)
```

After:

```
do show ip bgp 10.10.10.10/32
BGP routing table entry for 10.10.10.10/32, version 15
    Paths: (1 available, best #1, table default)
      Advertised to non peer-group peers:
      192.168.10.65
      6000 1 2 3 123
        192.168.10.65 from 192.168.10.65 (10.10.10.11)
          Origin IGP, metric 0, valid, external, best (First path
          received)
```

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
20 months agoMerge pull request #14151 from opensourcerouting/fix/improve_addpath_selected_test
Donald Sharp [Sun, 6 Aug 2023 21:01:16 +0000 (17:01 -0400)]
Merge pull request #14151 from opensourcerouting/fix/improve_addpath_selected_test

tests: Improve bgp_addpath_best_selected topotest

20 months agoMerge pull request #14152 from idryzhov/vtysh-filter
Donatas Abraitis [Sun, 6 Aug 2023 17:14:13 +0000 (20:14 +0300)]
Merge pull request #14152 from idryzhov/vtysh-filter

vtysh: remove unused cmd_filter_type

20 months agoMerge pull request #14139 from donaldsharp/v6_v4_nexthops
Donatas Abraitis [Sun, 6 Aug 2023 17:11:19 +0000 (20:11 +0300)]
Merge pull request #14139 from donaldsharp/v6_v4_nexthops

V6 v4 nexthops

20 months agoMerge pull request #14149 from donaldsharp/cleanup_bad_commands
Donatas Abraitis [Sun, 6 Aug 2023 17:10:23 +0000 (20:10 +0300)]
Merge pull request #14149 from donaldsharp/cleanup_bad_commands

Cleanup bad commands

20 months agobgpd: Check if peer is established and dynamic capability-aware 14154/head
Donatas Abraitis [Sat, 5 Aug 2023 20:00:55 +0000 (23:00 +0300)]
bgpd: Check if peer is established and dynamic capability-aware

Add this logic inside bgp_capability_send() instead of repeating the whole
logic before calling bgp_capability_send().

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agotests: Check if role capability is exchanged via dynamic capability
Donatas Abraitis [Sat, 5 Aug 2023 19:54:55 +0000 (22:54 +0300)]
tests: Check if role capability is exchanged via dynamic capability

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agobgpd: Handle role capability using dynamic capability
Donatas Abraitis [Sat, 5 Aug 2023 19:32:57 +0000 (22:32 +0300)]
bgpd: Handle role capability using dynamic capability

When setting local-role for the neighbor, force sending ROLE capability via
dynamic capability if it's enabled.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agovtysh: fix checking empty interface node 14153/head
Igor Ryzhov [Fri, 4 Aug 2023 21:46:45 +0000 (00:46 +0300)]
vtysh: fix checking empty interface node

vtysh is not supposed to show empty interface node in running config,
however the corresponding check is broken and empty nodes are shown.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
20 months agovtysh: remove unused cmd_filter_type 14152/head
Igor Ryzhov [Fri, 4 Aug 2023 21:45:10 +0000 (00:45 +0300)]
vtysh: remove unused cmd_filter_type

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
20 months agotests: Drop duplicate neighbor definition 14151/head
Donatas Abraitis [Fri, 4 Aug 2023 20:22:38 +0000 (23:22 +0300)]
tests: Drop duplicate neighbor definition

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agoMerge pull request #14148 from opensourcerouting/fix/tests_bgp_addpath_failing_sometimes
Donald Sharp [Fri, 4 Aug 2023 19:44:10 +0000 (15:44 -0400)]
Merge pull request #14148 from opensourcerouting/fix/tests_bgp_addpath_failing_sometimes

tests: Use a correct syntax for defining keepalive/hold timers

20 months agotests: Improve bgp_addpath_best_selected topotest
Donatas Abraitis [Fri, 4 Aug 2023 19:34:17 +0000 (22:34 +0300)]
tests: Improve bgp_addpath_best_selected topotest

Test everything else only after we have an initial good state.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agoMerge pull request #14147 from idryzhov/static-fix-nexthop-vrf
Mark Stapp [Fri, 4 Aug 2023 19:09:39 +0000 (15:09 -0400)]
Merge pull request #14147 from idryzhov/static-fix-nexthop-vrf

staticd: fix comparison of nexthop-vrf

20 months agotests: isis_snmp, ldpd doesn't talk to snmp 14149/head
Donald Sharp [Fri, 4 Aug 2023 17:06:56 +0000 (13:06 -0400)]
tests: isis_snmp, ldpd doesn't talk to snmp

isis_snmp.test_isis_snmp/r1/ldpd.log:2023/08/04 12:49:54 LDP: [SHWNK-NWT5S][EC 100663304] No such command on config line 8: agentx

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agotests: babel_topo1 Another no such command
Donald Sharp [Fri, 4 Aug 2023 17:05:42 +0000 (13:05 -0400)]
tests: babel_topo1 Another no such command

babel_topo1.test_babel_topo1/r3/babeld.log:2023/08/04 12:46:55 BABELD: [SHWNK-NWT5S][EC 100663304] No such command on config line 17:  redistirbute ipv6 connected

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agotests: config_timing calls non-existent command
Donald Sharp [Fri, 4 Aug 2023 17:04:48 +0000 (13:04 -0400)]
tests: config_timing calls non-existent command

./config_timing.test_config_timing/r1/zebra.log:2023/08/04 12:34:29 ZEBRA: [SHWNK-NWT5S][EC 100663304] No such command on config line 7: exit-route-map
./config_timing.test_config_timing/r1/zebra.log:2023/08/04 12:34:29 ZEBRA: [SHWNK-NWT5S][EC 100663304] No such command on config line 10: exit-route-map

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agotests: bfd_ospf_topo1 there is no passive interface command
Donald Sharp [Fri, 4 Aug 2023 17:03:44 +0000 (13:03 -0400)]
tests: bfd_ospf_topo1 there is no passive interface command

./bfd_ospf_topo1.test_bfd_ospf_topo1/rt3/ospfd.log:2023/08/04 12:46:58 OSPF: [SHWNK-NWT5S][EC 100663304] No such command on config line 28:  passive interface lo
./bfd_ospf_topo1.test_bfd_ospf_topo1/rt5/ospfd.log:2023/08/04 12:46:59 OSPF: [SHWNK-NWT5S][EC 100663304] No such command on config line 27:  passive interface lo
./bfd_ospf_topo1.test_bfd_ospf_topo1/rt1/ospfd.log:2023/08/04 12:46:56 OSPF: [SHWNK-NWT5S][EC 100663304] No such command on config line 30:  passive interface lo
./bfd_ospf_topo1.test_bfd_ospf_topo1/rt4/ospfd.log:2023/08/04 12:47:00 OSPF: [SHWNK-NWT5S][EC 100663304] No such command on config line 27:  passive interface lo
./bfd_ospf_topo1.test_bfd_ospf_topo1/rt2/ospfd.log:2023/08/04 12:46:57 OSPF: [SHWNK-NWT5S][EC 100663304] No such command on config line 28:  passive interface lo

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agotests: ospf6_gr_topo1 attempts, but fails to set the password
Donald Sharp [Fri, 4 Aug 2023 17:01:54 +0000 (13:01 -0400)]
tests: ospf6_gr_topo1 attempts, but fails to set the password

Irrelevant and let's just remove it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agotests: cspf_topo1 has `import-te` in sharpd.conf
Donald Sharp [Fri, 4 Aug 2023 17:00:36 +0000 (13:00 -0400)]
tests: cspf_topo1 has `import-te` in sharpd.conf

This will never work, let's remove

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agotests: bgp_update_delay is not even using frr cli syntax
Donald Sharp [Fri, 4 Aug 2023 16:58:53 +0000 (12:58 -0400)]
tests: bgp_update_delay is not even using frr cli syntax

Let's just remove it.   Looks like iproute2 configuration

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agotests: bgp_vpnv4_noretain test turns on isis but never uses it
Donald Sharp [Fri, 4 Aug 2023 16:56:11 +0000 (12:56 -0400)]
tests: bgp_vpnv4_noretain test turns on isis but never uses it

The test was reading in the bgp config for the isis config and
clearly the test is working without this.  So let's remove
from the test the usage of isisd

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
20 months agotests: Use a correct syntax for defining keepalive/hold timers 14148/head
Donatas Abraitis [Fri, 4 Aug 2023 16:22:20 +0000 (19:22 +0300)]
tests: Use a correct syntax for defining keepalive/hold timers

BGP: [SHWNK-NWT5S][EC 100663304] No such command on config line 2:  timers 3 10

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agoMerge pull request #14140 from opensourcerouting/fix/handle_more_capabilities_via_dyn...
Donald Sharp [Fri, 4 Aug 2023 15:26:43 +0000 (11:26 -0400)]
Merge pull request #14140 from opensourcerouting/fix/handle_more_capabilities_via_dynamic_capability

bgpd: Handle software version capability dynamicaly

20 months agostaticd: fix comparison of nexthop-vrf 14147/head
Igor Ryzhov [Fri, 4 Aug 2023 15:24:51 +0000 (18:24 +0300)]
staticd: fix comparison of nexthop-vrf

When displaying the configuration, the order of nexthop-vrf is wrong,
because the default VRF is not displayed, but still compared as the word
"default". Therefore it is placed in the middle of the list instead of
always being the first one.

Before the fix:
```
ip route 1.1.1.0/24 2.2.2.2 nexthop-vrf ccc
ip route 1.1.1.0/24 2.2.2.2
ip route 1.1.1.0/24 2.2.2.2 nexthop-vrf eee
```

After the fix:
```
ip route 1.1.1.0/24 2.2.2.2
ip route 1.1.1.0/24 2.2.2.2 nexthop-vrf ccc
ip route 1.1.1.0/24 2.2.2.2 nexthop-vrf eee
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
20 months agoMerge pull request #14145 from opensourcerouting/fix/handling_cluster_transit
Donald Sharp [Fri, 4 Aug 2023 11:14:55 +0000 (07:14 -0400)]
Merge pull request #14145 from opensourcerouting/fix/handling_cluster_transit

bgpd: Some cleanup and consistency "improvements"

20 months agoMerge pull request #14141 from opensourcerouting/fix/remove_deprecated_internet_community
Donald Sharp [Fri, 4 Aug 2023 11:09:05 +0000 (07:09 -0400)]
Merge pull request #14141 from opensourcerouting/fix/remove_deprecated_internet_community

bgpd: Remove deprecated COMMUNITY_INTERNET community

20 months agobgpd: Use SET_FLAG when setting AIGP attribute flag 14145/head
Donatas Abraitis [Thu, 3 Aug 2023 19:54:36 +0000 (22:54 +0300)]
bgpd: Use SET_FLAG when setting AIGP attribute flag

Just reuse an existing more-readable code.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agobgpd: Handle srv6 attributes the same way as others using setters/getters
Donatas Abraitis [Thu, 3 Aug 2023 19:53:21 +0000 (22:53 +0300)]
bgpd: Handle srv6 attributes the same way as others using setters/getters

To be consistent and error-safe.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agobgpd: Handle encap attributes the same way as others using setters/getters
Donatas Abraitis [Thu, 3 Aug 2023 19:52:09 +0000 (22:52 +0300)]
bgpd: Handle encap attributes the same way as others using setters/getters

To be consistent and error-safe.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agobgpd: Handle transit attributes the same way as others using setters/getters
Donatas Abraitis [Thu, 3 Aug 2023 19:48:40 +0000 (22:48 +0300)]
bgpd: Handle transit attributes the same way as others using setters/getters

To be consistent and error-safe.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agobgpd: Handle cluster attribute the same way as others using setters/getters
Donatas Abraitis [Thu, 3 Aug 2023 19:44:17 +0000 (22:44 +0300)]
bgpd: Handle cluster attribute the same way as others using setters/getters

To be consistent and error-safe.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agobgpd: Check if we have such a peer before handling software capability 14140/head
Donatas Abraitis [Thu, 3 Aug 2023 19:00:27 +0000 (22:00 +0300)]
bgpd: Check if we have such a peer before handling software capability

Do not pass NULL for peer_established(), just in case.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agobgpd: Remove deprecated COMMUNITY_INTERNET community 14141/head
Donatas Abraitis [Thu, 3 Aug 2023 14:12:19 +0000 (17:12 +0300)]
bgpd: Remove deprecated COMMUNITY_INTERNET community

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agobgpd: Add all other capabilities for dynamic handling (placeholders)
Donatas Abraitis [Thu, 3 Aug 2023 13:58:40 +0000 (16:58 +0300)]
bgpd: Add all other capabilities for dynamic handling (placeholders)

Gonna be covered later with further PRs. Now adding them to avoid compiler
errors due to uncovered switch/cases.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agobgpd: Handle software version capability dynamicaly
Donatas Abraitis [Thu, 3 Aug 2023 13:37:54 +0000 (16:37 +0300)]
bgpd: Handle software version capability dynamicaly

We have dynamic capability support, but it handles only MP capability.

With this change, we can enable software version capability dynamicaly, without
resetting the session.

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