1
0
mirror of https://github.com/osrg/gobgp.git synced 2024-05-11 05:55:10 +00:00

3163 Commits

Author SHA1 Message Date
a74149f9ef v3.26.0
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
v3.26.0
2024-05-01 07:59:46 +09:00
3ae91215be graceful restart: send initial paths list to all neighbors
Before this PR, when graceful restart was configured for a neighbor
and when the restart flag was set by the restarting speaker, if
the neighbor was not advertising the GR capability, the initial
paths list was never sent by the restarting speaker to its neighbor

This is a problem when the server is configured with graceful
restart for all its peers without knowing if the peer supports it.
If some of the peers don't support it, they may never receive the
routes from the restarting speaker, leading to an inconsistent
routing state.
2024-04-30 16:05:51 +02:00
5aaabf0a0e Bump golang.org/x/net from 0.17.0 to 0.23.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.17.0 to 0.23.0.
- [Commits](https://github.com/golang/net/compare/v0.17.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-29 10:36:14 +00:00
78516cf8af server: fix nil pointer exception in evpn mac mobility
With large EVPN fabrics, it can happen that some paths are nil in the
mac mobility codepath, causing crashes of the process.

    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xb8e03a]
    goroutine 25 [running]:
    github.com/osrg/gobgp/v3/internal/pkg/table.(*Path).root(...)
        /home/tuetuopay/dev/gobgp/internal/pkg/table/path.go:341
    github.com/osrg/gobgp/v3/internal/pkg/table.(*Path).OriginInfo(...)
        /home/tuetuopay/dev/gobgp/internal/pkg/table/path.go:348
    github.com/osrg/gobgp/v3/internal/pkg/table.(*Path).GetNlri(...)
        /home/tuetuopay/dev/gobgp/internal/pkg/table/path.go:460
    github.com/osrg/gobgp/v3/pkg/server.getMacMobilityExtendedCommunity(0x0, {0xc002833520, 0x6, 0xc00033ec00?}, {0xc001a52008, 0xa72, 0xc000000000?})
        /home/tuetuopay/dev/gobgp/pkg/server/server.go:2044 +0x1da
    github.com/osrg/gobgp/v3/pkg/server.(*BgpServer).fixupApiPath(0xc000372008, {0x0, 0x0}, {0xc0008fbe48, 0x1, 0x0?})
        /home/tuetuopay/dev/gobgp/pkg/server/server.go:2120 +0x4bc
    github.com/osrg/gobgp/v3/pkg/server.(*BgpServer).addPathList(0xc000372008, {0x0?, 0x0?}, {0xc0008fbe48, 0x1, 0x1})
        /home/tuetuopay/dev/gobgp/pkg/server/server.go:2162 +0x2c
    github.com/osrg/gobgp/v3/pkg/server.(*BgpServer).AddPath.func1()
        /home/tuetuopay/dev/gobgp/pkg/server/server.go:2191 +0xa5
    github.com/osrg/gobgp/v3/pkg/server.(*BgpServer).handleMGMTOp(0xc0b4e0?, 0xc001243140)
        /home/tuetuopay/dev/gobgp/pkg/server/server.go:280 +0x82
    github.com/osrg/gobgp/v3/pkg/server.(*BgpServer).Serve(0xc000372008)
        /home/tuetuopay/dev/gobgp/pkg/server/server.go:490 +0x53a
    created by main.main in goroutine 1
        /home/tuetuopay/dev/gobgp/cmd/gobgpd/main.go:202 +0x13ea
2024-04-29 19:34:56 +09:00
9fbc03765a send-max: respect configuration 2024-04-29 17:29:42 +09:00
bbde806641 evpn: fix quadratic mac-mobility handling for gRPC routes
The gRPC code paths uses different functions than the BGP code path.
Thus is did not receive the fix for the mac mobility handling.

Fixes: c393f43 ("evpn: fix quadratic evpn mac-mobility handling")
2024-04-29 17:25:29 +09:00
7ec4af4818 fix data race when getting capabilities from neighbor config
Func capabilitiesFromConfig was always taken under the read lock.
However, when graceful restart is enabled for some families, this
function writes to the neighbor config which creates a data race.
2024-04-29 17:22:48 +09:00
d0bf8138ff Update the reference of draft-ietf-idr-bgp-gr-notification
draft-ietf-idr-bgp-gr-notification is promoted to RFC8538.

Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
2024-04-27 23:51:16 +09:00
0ccd87db55 Sending Cease/Hard Reset notification
Send Cease/Hard Reset notification for certain scenario when graceful
restart + notification support (RFC8538) are enabled. In this
implementation, we follow the suggestion of RFC8538 and map following
notification subcodes to Hard Reset subcode.

1. BGP_ERROR_SUB_MAXIMUM_NUMBER_OF_PREFIXES_REACHED

In this case, GoBGP is in the resource shortage and not working
properly. Thus, the peer should stop forwarding packet immediately.

2. BGP_ERROR_SUB_ADMINISTRATIVE_SHUTDOWN

This happens when the user uses DisablePeer API. This clearly indicates
user's intention of shutting down the session. Thus, we should send Hard
Reset.

3. BGP_ERROR_SUB_PEER_DECONFIGURED

This happens when the user uses DeletePeer API or StopBgp API or there's
an ASN mismatch found in the Open phase. The former two cases, the user
shows the intention to shutdown the session, so we should Hard Reset.
The latter case is not so obvious, but I think it's ok to do Hard Reset
because it is an unrecoverable error that cannot be solved without
user's involvement.

4. BGP_ERROR_SUB_HARD_RESET

This case currently doesn't exist, but obviously we should send Hard
Reset when someone explicitly specifies it.

The behavior for the remaining subcodes are unchanged. We may want to
expose a knob to adjust the behavior of BGP_ERROR_SUB_ADMINISTRATIVE_RESET
as suggested by RFC8538, but for this initial implementation, we kept it
as is.

Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
2024-04-27 23:51:11 +09:00
7ef2f0bb82 Add CommunityCount BGP Policy Condition
This is intended to have the same behaviour as [these OpenConfig paths](https://openconfig.net/projects/models/schemadocs/yangdoc/openconfig-routing-policy.html#routing-policy-policy-definitions-policy-definition-statements-statement-conditions-bgp-conditions-community-count):
* /routing-policy/policy-definitions/policy-definition/statements/statement/conditions/bgp-conditions/community-count/config/operator
* /routing-policy/policy-definitions/policy-definition/statements/statement/conditions/bgp-conditions/community-count/config/value
2024-04-11 07:48:16 +09:00
7fed268caf v3.25.0
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
v3.25.0
2024-04-04 08:26:35 +09:00
5d5a6b9afe Do not check enabling when EOR received
Signed-off-by: Rinat Baygildin <bayrinat@yandex-team.ru>
2024-03-20 08:45:34 +00:00
ed87360952 Add EOR type to Table's filter on Watch method
Signed-off-by: Rinat Baygildin <bayrinat@yandex-team.ru>
2024-03-20 08:45:34 +00:00
82cc205403 allow to pass add/del route -a vpnv46 identifier
This patch adds an 'identifier %d' option to the route add / del
CLI. This is helpful for testing add-paths capabilities in vpv46
contexts.

Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2024-03-20 08:35:45 +00:00
912eb5a920 Bump google.golang.org/protobuf from 1.30.0 to 1.33.0
Bumps google.golang.org/protobuf from 1.30.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-17 05:45:55 +00:00
829bbcf0a2 Fix ListPath for ADJ_IN and EnableFiltered=true and add tests.
Currently, even though `ApplyPolicy` is called for determining the
accepted routes after apply policy, the new route with attribute
modifications is not returned. This is problematic for gRPC API users.

Tests are added for all four cases that were described in
https://github.com/osrg/gobgp/issues/2765. This PR makes the behaviour
correct for "Case/Attempt 2" described in the issue.
2024-03-15 16:11:55 -07:00
9d05544d1e Revert "Add EOR type to Table's filter on Watch method"
This reverts commit aff055b44d.

This breaks WatchEvent API:
https://github.com/osrg/gobgp/issues/2777
2024-03-05 07:42:25 +00:00
84a264e618 Revert "Do not check enabling when EOR received"
This reverts commit fbeaa1c668.

This breaks WatchEvent API:
https://github.com/osrg/gobgp/issues/2777
2024-03-05 07:41:28 +00:00
d67f568150 v3.24.0
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
v3.24.0
2024-03-02 09:49:28 +00:00
fbeaa1c668 Do not check enabling when EOR received
Signed-off-by: Rinat Baygildin <bayrinat@yandex-team.ru>
2024-03-02 08:35:54 +00:00
aff055b44d Add EOR type to Table's filter on Watch method
Signed-off-by: Rinat Baygildin <bayrinat@yandex-team.ru>
2024-03-02 08:35:54 +00:00
34e4845765 Adjust size of packing slice before allocating
- Changes table.(*packerV4).pack.func1 (split) to adjust the max
  parameter before using it to allocate slice size.  Previously the full
  max size was allocated then max was (possibly) truncated before
  further use.
2024-03-02 07:48:16 +00:00
3448996706 Use net.IP.Equal in peer.filterPathFromSourcePeer
- Compares IPs using net.IP.Equal instead of using a string comparison
  in order to avoid unnecessary allocations.

- Adds peer.routerID to access IP, called by peer.RouterID.
2024-03-02 07:45:40 +00:00
003745affe logs: Guard frequently called logs behind if check
Moves a number of heavily called debug lines behind if checks to avoid
needless allocations of Fields objects and stringification of fields.
For cases where the server is not set to "debug" log level, these fields
were allocated on the heap and then immediately discarded - as well a
number of these were stringifying state / NLRIs regardless of log level.

In servers with significant amounts of routes and BGP peers, this lead
to a large amount of wasted allocations - in our case looking at Go's
memory profiler, 25% of all allocations were from these lines alone.
2024-03-02 06:12:45 +00:00
87e5b819e4 server: Fix deadlock if StopBgp is called when conn queue is full
Fixes a deadlock condition that can happen if StopBgp is called when the
pending connection queue is full. During teardown, StopBgp calls a
mgmtOp on the server goroutine which attempts to stop the goroutine
accepting inbound connections, and waits for it to finish before
continuing.

This connection goroutine can block if the connection queue is full,
which is read by the same goroutine that processes all mgmtOps. This
means that if the queue is full and the goroutine is currently blocked,
then calling StopBgp will lead to a complete deadlock, as the connection
goroutine will never close as it is trying to send to the queue, but the
queue will not be read as the server goroutine is currently waiting for
the connection goroutine to exit.

To correct this, a context has been added that gets passed to the
connection goroutine. This is then checked in a new select statement on
the connection queue which gets cancelled by tcpListener.Close() ensuring
the goroutine exits correctly even if the queue is full.
2024-02-27 12:24:45 -08:00
8fdda5dd2d v3.23.0
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
v3.23.0
2024-02-01 08:00:14 +09:00
ce7e5d3296 server: only log warning if grpcServer.Serve() returned an error.
Additionally change the `Key` to be the listener address, which is hopefully
more useful than a difficult-to-decipher dump of the listener struct.

The previous behavior would result in log lines like the following, even if
nothing went wrong:
```
time="2024-01-31T17:30:25Z" level=warning msg="accept failed" Error="<nil>" Key="&{0x140002e4000 {<nil> 0 0}}" Topic=grpc
```
With this change, the message is only logged if there was an error, and it will look like this:
```
time="2024-01-31T17:40:25Z" level=warning msg="accept failed" Error="lolol just testing" Key="127.0.0.1:59289" Topic=grpc
```
2024-01-31 17:42:41 +00:00
815683fa5e Only wait for GR End of RIB for the received address family
Currently, graceful restart waits for the EoR message for all address
families "enabled" for the peer, but it should only wait for "received"
address families (the address families the peer is capable of handling).

Fixes: #2524

Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
2024-01-29 11:15:08 +09:00
2558b5a069 v3.22.0
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
v3.22.0
2024-01-03 22:58:24 +09:00
c393f4382c evpn: fix quadratic evpn mac-mobility handling
This patch adds a special case in the destination hashmap for EVPN
Type-2 routes, to index them by MAC address. This allows for direct
access to the destination struct, instead of iterating over all
destination and all paths.

In effect, this replaces an iteration over all known paths by a quick
lookup to the MAC, leaving only an iteration to multiple paths to the
same MAC (e.g. multihoming or through multiple VNIs).

The practical effect is a reasonable convergence time for large EVPN
instances.

- before: 6m 7s
- after: 11s

The comparison was performed on a Xeon Silver 4209T, and an EVPN
instance comprising of 13k EVPN type-2 routes. The time is measured
by comparing the timestamp of the first and the last routes logged by
the cli's monitor mode.

Given the extreme difference, no further work was done for a more
accurate measurment.
2023-12-17 01:20:00 +01:00
99d96acddf allows duplicate-heading for markdownlint
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2023-12-16 09:55:49 +09:00
270ee41d9a mup: add Source Address to Type 1 ST Route
This patch adds Source Address to Type 1 ST Route as defined in draft-mpmz-bess-mup-safi-03.
See https://datatracker.ietf.org/doc/html/draft-mpmz-bess-mup-safi-03#section-3.1.3
2023-12-15 15:24:24 +09:00
7ddcd293dd Add initial support for evpn subtype 4 2023-12-09 11:37:17 +09:00
08529d6cc4 Make sure the TCP connection is closed when a peer is deleted
It could be that a peer gets deleted and added back during the
transition from active state to open confirm. In that case, the TCP
connection from the old version of the peer could still be up. This
is a problem if the server is a listener only as the remote peer
would consider the old TCP connection as being valid and it won't
be able to connect until the TCP connection is eventually cleaned
by the Golang GC.
2023-12-04 13:32:37 +01:00
95cf2c10c5 v3.21.0
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
v3.21.0
2023-12-01 14:04:43 +09:00
0d57904082 add test case for AddDefinedSet with replace 2023-11-10 13:59:11 -05:00
16412bfc03 Add replace option to AddDefinedSet rpc 2023-11-10 13:35:24 -05:00
02fa6129af Implementation of Dynamic Neighbor MD5 (Issue #2589)
Adds usage of the "prefix-based" TCP MD5 for dynamic
neighbors. Non-dynamic neighbors will continue to use
non-prefix based, which makes it more compatible with
running on older kernels, as only 4.14+ includes the
necessary support.

This change also includes tests of dynamic peers in general.
2023-11-07 11:28:12 -08:00
d210224493 packet: fix software version capability parser
Fixes #2732

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2023-11-02 10:39:02 +09:00
66e8f5c592 v3.20.0
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
v3.20.0
2023-11-01 07:48:52 +09:00
140ca9b96a CODEOWNERS: update zebra path
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2023-10-31 23:03:31 +09:00
868ac6d7ff Add MaxSoftware 2023-10-31 22:42:13 +09:00
340030dc28 Fix imports 2023-10-31 22:42:13 +09:00
0e7420d8a1 Export some zebra symbols. 2023-10-31 22:42:13 +09:00
7a77f281c5 Export zebra package to /pkg/zebra 2023-10-31 22:42:13 +09:00
64d69cc6d4 Bump google.golang.org/grpc from 1.55.0 to 1.56.3
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.55.0 to 1.56.3.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.55.0...v1.56.3)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-31 22:28:18 +09:00
e26631ceb4 packet: fix FQDN capability parser
Fixes #2708
2023-10-31 21:46:34 +09:00
286c887775 fix: call validatePathAttributeFlags after parsing and setting path attribute length 2023-10-30 10:58:13 -04:00
1b975be057 Fix data race in newWatchEventPeer
This method was attempting to read from peer.fsm before acquiring a read
lock, leading to a data race as this struct is written by a different
goroutine in parallel. Commit moves the call to RLock before the first
read from the struct.
2023-10-24 22:26:02 +09:00
0f7273c372 Bump golang.org/x/net from 0.10.0 to 0.17.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.10.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.10.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-24 20:24:28 +09:00