Commit Graph

32667 Commits

Author SHA1 Message Date
Russ White
eb28d67ed7
Merge pull request #13800 from idryzhov/fix-rip-ripd-crash
fix crashes in rip and ripng
2023-06-20 10:40:52 -04:00
Jafar Al-Gharaibeh
3917d78f4c
Merge pull request #13809 from LabNConsulting/chopps/mgmtdoc
doc: start of mgmtd developer doc
2023-06-20 09:04:55 -05:00
Russ White
158920f16b
Merge pull request #13811 from dpward/ospfv3-seqnum-wrap
ospf6d: Increment sequence number correctly in Authentication Trailer
2023-06-20 09:26:19 -04:00
Russ White
4d9fb376c8
Merge pull request #13728 from opensourcerouting/fix/addpath_drop_non_best_addpaths
bgpd: Implement neighbor X addpath-tx-best-selected command
2023-06-20 09:20:36 -04:00
Russ White
554c2e0350
Merge pull request #13750 from louis-6wind/fix-no-retain-memory-usage
bgpd: fix memory usage of vpn no retain
2023-06-20 09:19:50 -04:00
Russ White
e6b33e137f
Merge pull request #13758 from cscarpitta/bugfix/fix-read-beyond-stream-isis-asla
isisd: Fix read beyond end of stream of ASLA Sub-TLV parsing
2023-06-20 09:19:23 -04:00
Russ White
c57667022c
Merge pull request #13769 from opensourcerouting/fix/bgp_peer-group_show_advertised
bgpd: Allow using peer-group for listing advertised-routes, etc.
2023-06-20 09:18:52 -04:00
Russ White
2cfc0ba8e9
Merge pull request #13665 from pguibert6WIND/issue_13616_pr
topotests: label per nexthop test adds add a while loop for mpls table
2023-06-20 09:18:16 -04:00
Russ White
514d3b397a
Merge pull request #13666 from pguibert6WIND/issue_13638_pr
topotests: structural issues in bgp_local_as_dotplus_private_remove
2023-06-20 09:17:51 -04:00
Russ White
68da3eab07
Merge pull request #13524 from pguibert6WIND/mpls_vpn_lsr_redistribute
MPLS vpn LSR redistribute
2023-06-20 09:13:33 -04:00
Russ White
95070f2eef
Merge pull request #13557 from anlancs/fix/bgpd-evpn-rmac-best-path
bgpd: Fix missing deletion of evpn routes
2023-06-20 09:12:51 -04:00
Russ White
40502902f4
Merge pull request #13394 from mjstapp/fix_zebra_mpls_config
zebra: clarify interface-level mpls config
2023-06-20 09:10:53 -04:00
Russ White
56a10caa03
Merge pull request #12971 from taspelund/trey/mac_vrf_soo_upstream
bgpd: Add MAC-VRF Site-of-Origin support
2023-06-20 09:08:28 -04:00
mobash-rasool
53a9aee618
Merge pull request #13810 from chiragshah6/fdev2
vrrpd: add priority field into interface json
2023-06-20 12:45:18 +05:30
Philippe Guibert
f2732f531f topotests: label per nexthop test adds add a while loop for mpls table
The bgp_vpnv4_per_nexthop_label tests only check to see if the mpls labels
are installed one time. Test runs show that all but one label is installed.
More than likely the test has asked for data while zebra is still installing
it. the mpls_label_check functions must check this result multiple times as
that system may be under heavy load.

A loop is introduced in order to let zebra check the mpls table.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-06-20 09:09:22 +02:00
Philippe Guibert
d1e16777d5 topotests: structural issues in bgp_local_as_dotplus_private_remove
This test has several issues:
A) The convergence function is spamming the show neighbor command until success,
if the neighbor never comes up the test will never finish. This adds unnecessary
load to an already loaded test system.  Use run_and_expect to properly wait for
the neighbor relationship to come up.
B) The convergence function should not sleep for 1 second *After* the neighbor
is established
C) The _bgp_as_path() function fails if the prefix has not been received yet.
This looking for the prefix data should be within a run_and_expect() functionality.
Else a loaded test system will fail in this function because while we may be in
an established state, prefixes might not yet have been exchanged and there is no
point in failing the test without giving the system some time to actually converge.

Fix those points, similarly to what has been fixed in
bgp_local_as_private_remove test.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-06-20 09:08:33 +02:00
Christian Hopps
181fab6d06 tools: checkpatch: FRR modifications to linux checkpatch.pl
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-20 01:05:30 -04:00
Christian Hopps
786a1e95bc doc: add the linux doc for checkpatch.pl
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-20 01:05:30 -04:00
Christian Hopps
f7bec5aab1 tools: unmodified import of scripts/checkpatch.pl from linux
0ee3e7b8893e * checkpatch: get default codespell dictionary path from package location

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-20 01:05:30 -04:00
Christian Hopps
a552543640 doc: start of mgmtd developer doc
- docs on how to convert daemon to mgmtd and some diagrams
- and a fix for code-block in cspf.rst

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-19 18:13:37 -04:00
David Ward
9a2d6d98ec ospf6d: Increment sequence number correctly in Authentication Trailer
According to RFC 7166, the sequence number should be treated as an
unsigned 64-bit value, although it is stored as two 32-bit values.

When incrementing it, the code caused the lower-order 32-bit value
to skip from 0xFFFFFFFE to 0. As a side effect, an error was never
produced if the full 64-bit sequence number wrapped.

Fixes: #13805

Signed-off-by: David Ward <david.ward@ll.mit.edu>
2023-06-19 16:00:38 -04:00
Sindhu Parvathi Gopinathan
232e8ef704 vrrpd: add priority field into interface json
'Priority' attribute is missing in "show vrrp interface <intf> json"
output. Whereas it is there in non-json output.

It has been added now in show vrrp interface json output.

Before Fix:

```
vrrp1# show vrrp interface swp5.101 json
[
  {
    "vrid":2,
    "version":3,
    "autoconfigured":false,
    "shutdown":false,
    "preemptMode":true,
    "acceptMode":true,
    "interface":"swp5.101",
    "advertisementInterval":1000,
    "v4":{
      "interface":"vrrp4-11-2",
      "vmac":"00:00:5e:00:01:02",
      "primaryAddress":"50.0.0.2",
      "status":"Master",
      "effectivePriority":110,
      "masterAdverInterval":1000,
      "skewTime":570,
      "masterDownInterval":3570,
      "stats":{
        "adverTx":248456,
        "adverRx":1,
        "garpTx":1,
        "transitions":2
      },
      "addresses":[
        "50.0.0.1"
      ]
    },
    "v6":{
      "interface":"vrrp6-11-2",
      "vmac":"00:00:5e:00:02:02",
      "primaryAddress":"fe80::7f1:49e7:768c:aa73",
      "status":"Master",
      "effectivePriority":110,
      "masterAdverInterval":1000,
      "skewTime":570,
      "masterDownInterval":3570,
      "stats":{
        "adverTx":248455,
        "adverRx":1,
        "neighborAdverTx":1,
        "transitions":2
      },
      "addresses":[
        "2001:50::1"
      ]
    }
  }
]
vrrp1#
```

After Fix:

```
vrrp1# show vrrp interface swp5.101 json
[
  {
    "vrid":2,
    "version":3,
    "autoconfigured":false,
    "shutdown":false,
    "preemptMode":true,
    "acceptMode":true,
    "interface":"swp5.101",
    "advertisementInterval":1000,
    "priority":110, ====> priority added into json output
    "v4":{
      "interface":"vrrp4-11-2",
      "vmac":"00:00:5e:00:01:02",
      "primaryAddress":"50.0.0.2",
      "status":"Master",
      "effectivePriority":110,
      "masterAdverInterval":1000,
      "skewTime":570,
      "masterDownInterval":3570,
      "stats":{
        "adverTx":15,
        "adverRx":4,
        "garpTx":1,
        "transitions":2
      },
      "addresses":[
        "50.0.0.1"
      ]
    },
    "v6":{
      "interface":"vrrp6-11-2",
      "vmac":"00:00:5e:00:02:02",
      "primaryAddress":"fe80::7f1:49e7:768c:aa73",
      "status":"Master",
      "effectivePriority":110,
      "masterAdverInterval":1000,
      "skewTime":570,
      "masterDownInterval":3570,
      "stats":{
        "adverTx":13,
        "adverRx":5,
        "neighborAdverTx":1,
        "transitions":2
      },
      "addresses":[
        "2001:50::1"
      ]
    }
  }
]
```

Ticket:#3502432

Issue:3502432

Testing: UT done

Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
2023-06-19 10:59:06 -07:00
Philippe Guibert
92550adfc7 bgpd: add 'set as-path exclude all' command
It is not possible to flush all the incoming as-path list
from a given BGP update.

Add a route-map set command to remove all as-paths
from a given AS path. Add the necessary tests.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-06-19 18:04:44 +02:00
sri-mohan1
df22d15d7c ripngd: 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-19 14:55:45 +05:30
Christian Hopps
459848ded7 mgmtd: fix memleak
Use northbound functions for replace and merge when possible, rather
than duplicating the code.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-19 00:13:28 -04:00
Christian Hopps
df0173ceeb mgmtd: KISS the locking code
Move away from things like "lock if not locked" type code, require the
user has locked prior to geting to that point.

For now we warn if we are taking a lock we already had; however, this
should really be a failure point.

New requirements:

SETCFG -
  not implicit commit - requires user has locked candidate DS and they
    must unlock after

  implicit commit - requires user has locked candidate and running DS
    both locks will be unlocked on reply to the SETCFG

COMMITCFG -
  requires user has locked candidate and running DS and they must unlock
  after

  rollback - this code now get both locks and then does an unlock and
  early return thing on the adapter side. It needs to be un-special
  cased in follow up work that would also include tests for this
  functionality.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-19 00:13:28 -04:00
Christian Hopps
04b4ede097 mgmtd: simplify locking, removing read locks
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-18 16:17:46 -04:00
Christian Hopps
f8500d4849 lib: mgmtd: use short-circuit for locking
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-18 16:17:32 -04:00
Christian Hopps
babbdd43d5 lib: mgmtd: re-purpose is_short_circuit and fix depth variable inc/dec
`is_short_circuit` now is set to true when a message is being
short-circuit handled.

`short_circuit_depth` was being inc/dec inside conditional macro, move
that out of the macro.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-18 14:02:47 -04:00
Donatas Abraitis
4230f85bef
Merge pull request #13798 from donaldsharp/bgp_suppression
bgpd: some safi's do not mix with bgp suppress-fib
2023-06-18 11:58:08 +03:00
Donatas Abraitis
253135ca2c
Merge pull request #13765 from AbhishekNR/query-max-response-time
pim6d: Correcting the help string
2023-06-18 11:48:29 +03:00
Donatas Abraitis
27d23c1ce7
Merge pull request #13796 from anlancs/doc-wrong-code-block
doc: Fix one syntax error for code block
2023-06-18 11:35:29 +03:00
Louis Scalbert
e3d2aeac17 topotests: import vpn to default vrf in bgp_vpnv4_noretain
Test that importing VPN prefixes into the default VRF is possible with
the no retain feature.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-16 14:18:44 +02:00
Louis Scalbert
22dfa04b78 topotests: more tests in bgp_vpnv4_noretain
Add more VRFs in bgp_vpnv4_noretain and test combinations of no-retain
/ retain and import / un-import.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-16 14:18:34 +02:00
Louis Scalbert
d629c2f419 topotests: check protocol convergence at init in bgp_vpnv4_noretain
Check that the BGP session is Established before starting the tests.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-16 14:18:25 +02:00
Louis Scalbert
1a2b340892 topotests: check r2 vpn table in bgp_vpnv4_noretain
Remove no retain in r2 and check that r2 VPN table remains the same
after r1 configuration changes.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-16 14:18:25 +02:00
Louis Scalbert
9aa2e5b1cd topotests: do not import r1 vrf1 to itself bgp_vpnv4_noretain
Do not import r1 vrf1 to itself in order to check that r1 vrf1 prefixes
are only in VPN table because it is needed for advertising the prefixes
to other routers.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-16 14:18:25 +02:00
Louis Scalbert
a92a2683a3 topotests: filter out void RD in bgp_vpnv4_noretain
Filter out route-distinguishers that have no prefix in "show bgp table
json"

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-16 14:18:25 +02:00
Louis Scalbert
fe993cb25f topotests: router relative variables in bgp_vpnv4_noretain
Change IP addresses, label, RD and RT to match the router number
and VRF number.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-16 14:18:25 +02:00
Louis Scalbert
bf636d3712 topotests: apply style to bgp_vpnv4_noretain
Apply style cosmetic changes to bgp_vpnv4_noretain with "black".

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-16 14:18:25 +02:00
Louis Scalbert
c2435c67f4 topotests: cosmetic changes to bgp_vpnv4_noretain
Cosmetic changes to bgp_vpnv4_noretain to prepare the next commit.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-16 14:18:25 +02:00
Louis Scalbert
a04d32b366 bgpd: fix incorrect json output in bgp_show_table_rd()
'{}' extra output may present JSON output from bgp_show_table_rd() when
no prefix are seen.

> {
>  "vrfId": 0,
>  "vrfName": "default",
>  "tableVersion": 0,
>  "routerId": "1.1.1.1",
>  "defaultLocPrf": 100,
>  "localAS": 65500,
>  "routes": {  "routeDistinguishers" : { "444:1" : {  }  }  }  }
> {}

Do not output '{}' when bgp_show_table() returns a valid JSON.
Tested without rd in config, bgp_show_table() returns nothing and the
JSON output is only '{}'

Fixes: 0224b3296c ("bgpd: Print empty JSON `{}` if no entries under `show bgp ipv4 vpn json`")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-16 14:18:25 +02:00
Louis Scalbert
af79038c4b bgpd: cleanup un-imported vpn prefix if no retain set
After some VRF imports are removed and "no bgp retain route-target all"
is set, prefixes that are not imported anymore remain in the BGP table.

Parse the BGP table and remove un-imported prefixes in such a case.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-16 14:18:25 +02:00
Louis Scalbert
3cc70b02a9 bgpd: fix memory usage of vpn no retain
By default, bgpd stores all MPLS VPN SAFI prefixes unless the "no bgp
retain route-target all" option is used to store only prefixes that are
imported into local VRFs. The "no retain" option temporarily uses too
much memory, as all prefixes are stored in memory before the deletion of
non-imported prefixes is done.

Filter out non-imported prefixes before they are set into the BGP adj
RIB out.

Fixes: a486300b26 ("bgpd: implement retain route-target all behaviour")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-16 14:18:25 +02:00
Louis Scalbert
59bbe85d4b bgpd: revert no retain backend
Partially revert a486300b26 ("bgpd: implement retain route-target all
behaviour") in order to fix a memory consumption issue in the next
commit.

Fixes: a486300b26 ("bgpd: implement retain route-target all behaviour")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-06-16 14:18:25 +02:00
Philippe Guibert
961b898197 bgpd: fix static analysis issue in subgroup_announce_check()
Remove the check about pi->peer value different from null.
Introducing this check introduces a SA warning on the value
of the from value (derived from pi->peer).

Actually, peer is set when bgp_path_info_make() call is
performed; peer is never null.

Fixes: 23bb4a9b5c64 ("bgpd: advertise mpls vpn routes with appropriate label")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-06-16 10:55:17 +02:00
Philippe Guibert
7817cdeadc bgpd: fix accept-own routes received by a route reflector
When using the bgp-accept-own community, with the
'attribute-unchanged next-hop' command, the advertised
mpls vpn updates that are reflected by a route reflector
are received, but are not selected.

Once the accept-own community is detected, a new bgp_path
is created, in addition of the original one; then the
next-hop of the NLRI is checked, but fails for two reasons:
- the next-hop tracking returns the real IP reachability
status for prefixes that have the BGP_ROUTE_IMPORTED subtype.
This is what happens with bgp updates with the accept-own
community.
- as the next-hop was unchanged and was the peer IP in the VRF.
Consequently, the new bgp_path is considered inactive in the
default VRF, and is not selected.

The incoming bgp updates with the accept-own community should
not be checked against the next-hop tracking. As the bgp_path
subtype has been changed to BGP_ROUTE_IMPORTED, let us check
the bgp subtype before calling the 'bgp_find_or_add_nexthop()'
function in the 'bgp_update()' call.

Fixes: 46dbf9d0c0 bgpd: ("Implement ACCEPT_OWN extended community")
Fixes: 376797711f4d - bgpd: track mpls vpn nexthops
Fixes: e6110f755718 bgpd: ("fix use nexthop tracking for exported vpn paths")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-06-16 10:55:17 +02:00
Philippe Guibert
b9c7e7a1a9 bgpd: fix use nexthop tracking for exported vpn paths
When exporting redistributed prefixes from a given VRF
to an MPLS VPN network, the paths are always considered
as valid whereas it should not always be the case.

At exportation, a new MPLS VPN path is built in. Then
nexthop tracking is applied to the new path, and the
SAFI_MPLS_VPN parameter is used to tell the NHT code
to just check for the next-hop reachability. The previous
commit was wrongly considering that nexthop tracking was
never applied to mpls vpn networks. Ensure that nexthop
tracking for exported paths behaves as usual.

Fix this by not returning always 1 in the 'bgp_find_or_add_nexthop()'
function if the passed 'pi' parameter is a 'BGP_IMPORTED_ROUTE'
sub-type entry.

Fixes: 74be3f3ea9ec ("bgpd: track mpls vpn nexthops")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-06-16 10:55:17 +02:00
Philippe Guibert
346607c7d3 doc: add 'mpls bgp l3vpn-multi-domain-switching'
The 'mpls bgp l3vpn-multi-domain-switching' per-interface
command is documented.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-06-16 10:55:17 +02:00
Philippe Guibert
7b3c6f8934 topotests: mpls vpn routes redistribution, add asbr test
This setup demonstrates the redistribution and the proper
switching operations in an asbr device.
The setup interconnects an internal AS with an external
connected AS.
- the iBGP AS uses BGP-LU as MPLS transport
- the eBGP peering is directly connected and does use the
'mpls bgp forwarding' configuration to accept exterior
updates.

The setup performs the following tests:
- it checks for end to end connectivity from one interior
host h1 to two external hosts h2, and h3.
- it checks that the proper label values are advertised
by the ASBR to the iBGP peer, and the eBGP peer.
- it checks that the 'show mpls table' has additional
MPLS entries that permit transit mpls traffic to transit
across the ASBR. That behaviour is possible with the
'mpls bgp allocate-label-on-nexthop-change' command.
- it checks that withdraw of routes will remve the MPLS
entries.
- it checks that by unconfiguring the 'next-hop-self' option,
the external routes advertised to the internal maintain the
next-hop.
- it checks that a second prefix advertised by r3 with the
same RD, but different label value is using a new label on r2,
and that this new label value is used.
- it checks that when filtering out prefixes from r1, on r2,
then the MPLS label is deallocated, and the MPLS entry is not
present.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-06-16 10:55:11 +02:00