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

94 Commits

Author SHA1 Message Date
Maxime Peim
9fbc03765a send-max: respect configuration 2024-04-29 17:29:42 +09:00
Tuetuopay
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
wenovus
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
Rinat Baygildin
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
FUJITA Tomonori
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
Rinat Baygildin
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
Britton Payne
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
Dawn Minion
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
Tuetuopay
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
Yuya Kusakabe
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
Jeremiah Millay
16412bfc03 Add replace option to AddDefinedSet rpc 2023-11-10 13:35:24 -05:00
wenovus
aa0cf39f37 Export Generated BGP Configuration Code
Move internal/pkg/config -> pkg/config/oc

Background: #2593
2023-09-30 09:53:37 +09:00
Rodrigo Peña
b6be999f90 Fix crash on ListPathRequest with malformed prefix
When ListPathRequest is done by a gRPC client including a malformed prefix,
 the server would crash an invalid memory address reference.

This commit fixes the crash by checking whether the parseCIDR method returned
an error.
2023-09-07 10:50:37 -03:00
Kirill Pletnev
35bfc9605c CLI VPNv4/VPNv6 filtering
gobgp CLI can filter VPNv4/VPNv6 prefixes with or without rd.
2023-09-06 11:14:47 +03:00
Kirill Pletnev
002690b848 ListPath can filter VPNv4/v6 routes
ListPath gRPC endpoint can filter VPNv4/VPNv6 prefixes. All lookup options are supported.
2023-09-06 11:11:35 +03:00
Jeremiah Millay
79d301f75b Fix UpdatePathAggregator4ByteAs() ignores 32bit value
Signed-off-by: Jeremiah Millay <jmillay@fastly.com>
2023-06-12 17:19:09 -04:00
Yuya Kusakabe
b1ed1f1795 cli,mup: fix prefix and route type handling 2023-03-26 12:15:00 +09:00
Yuya Kusakabe
cbd1d66d8b mup: fix TEID processing in Type 1/2 ST Route
Fix TEID processing in Type 2 ST Route:
- TEID can be 0-32 bits value as described in I-D.

Accept hex and IPv4 format for TEID in CLI and show TEID as IPv4 format in CLI.
- TEID is generally represented in hexadecimal format.
- IPv4 format is useful because Type 2 ST Route can be used in the longest match algorithm as described in I-D.
2023-03-23 16:19:33 +09:00
liangrq
9026872ab3 evpn type2 use in graceful restart crash
Gobgp will crash when use evpn type2 sync in graceful restart and peer(crash or out by kill -9/reboot)
2023-01-04 12:06:26 +08:00
Yuya Kusakabe
dc328dccf6 cli,mup: add support for filtering MUP routes with route type 2022-11-28 09:02:54 +09:00
Yuya Kusakabe
438f2460b3 cli: initial support for BGP-MUP SAFI and Extended Community 2022-08-31 12:26:42 +09:00
FUJITA Tomonori
f862a96ba4 fix staticcheck warnings
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2022-08-05 10:34:23 +00:00
Jeremiah Millay
89735e937b fix S1001 linter error 2022-07-01 12:25:49 -04:00
Jeremiah Millay
1519b5b654 Fix panic in table.GetLongerPrefixDestinations() with invalid cidr 2022-07-01 12:10:30 -04:00
Sergey Elantsev
1ee336ca4a optimised ExtCommunityCondition.Evaluate() by caching community string
It saves a lot of resources when there is a lot of communities to match against,
say hundreds of RTs. The same approach is used in some other conditions,
ex. AsPathCondition.
2022-03-23 22:54:02 +03:00
Rinat Baygildin
26ed14ac8a Enable match-prefix-set policy for vpnv4/vpnv6 prefixes
#2527
2022-01-17 16:03:00 +03:00
FUJITA Tomonori
8397b1a165 table: fix Path ToLocal() to set PathId
ToLocal() is used to copy Path in rib for advertising/exporting via
API (like ListPath). Needs to copy PathId.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2021-12-18 00:58:13 +00:00
FUJITA Tomonori
6fc43b1114 proto: avoid global enum definitions when possible
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2021-12-11 10:13:12 +00:00
Manuel Rüger
dc67485336 .github/ci: Replace staticcheck with golang-ci-lint 2021-12-08 13:40:16 +01:00
FUJITA Tomonori
97aefbb24a decouple logging
gobgp is tightly coupled with logrus and uses the global logrus logger
instance. The uses of gobgp library can't use other logging libraries.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2021-12-08 10:39:16 +00:00
FUJITA Tomonori
c593d7c8b3 switch to Go API v2 for protobuf
seems that sticking to Go API v1 for protobuf is headache for projects
using GoBGP.

This breaks the compatibility so bumps up the major version to 3.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2021-12-08 07:22:50 +00:00
Donatas Abraitis
59386648fc tests: Add BGP link-bandwidth extended community basic tests
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-04 20:12:58 +09:00
Donatas Abraitis
27b80a935b bgp: Implement BGP link-bandwidth extended community
Receiving
=========

Extended communities sent from FRR side:

```
route-map lb permit 10
 set extcommunity bandwidth 10
 set extcommunity soo 65001:123
exit
```

On GoBGP side it's decoded as 125000 as IEEE floating-point.

```
% sudo ./gobgp global rib 192.168.100.1/32 --json | jq '."192.168.100.1/32"'
[
  {
    "nlri": {
      "prefix": "192.168.100.1/32"
    },
    "age": 1632128843,
    "best": true,
    "attrs": [
      {
        "type": 1,
        "value": 2
      },
      {
        "type": 2,
        "as_paths": [
          {
            "segment_type": 2,
            "num": 1,
            "asns": [
              65534
            ]
          }
        ]
      },
      {
        "type": 3,
        "nexthop": "192.168.10.123"
      },
      {
        "type": 4,
        "metric": 0
      },
      {
        "type": 16,
        "value": [
          {
            "type": 64,
            "subtype": 4,
            "asn": 65534,
            "bandwidth": 1250000
          },
          {
            "type": 0,
            "subtype": 3,
            "value": "65001:123"
          }
        ]
      }
    ],
    "stale": false,
    "source-id": "192.168.100.2",
    "neighbor-ip": "192.168.10.123"
  }
]
```

Sending
=======

When sending from GoBGP side:

```
[[policy-definitions]]
    name = "policy1"
    [[policy-definitions.statements]]
        [policy-definitions.statements.actions.bgp-actions.set-ext-community]
			options = "replace"
			[policy-definitions.statements.actions.bgp-actions.set-ext-community.set-ext-community-method]
				communities-list = ["lb:65021:125000"]

```

We get properly encoded/decoded in FRR as well:

```
~# vtysh -c 'show ip bgp 10.33.0.0/16 json' | grep 'LB:'
        "string":"RT:300:400 SoO:100:200 LB:65021:125000 (1.000 Mbps)"
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-04 20:12:58 +09:00
Sunny Liu
3510a6f2d8 table: keep receiver name the same
keep receiver name the same, it's more readable for IDE.
2021-10-29 15:22:01 +08:00
Matt Layher
b931ccd056 internal/pkg/table: remove debug logging from Destination.Calculate
Signed-off-by: Matt Layher <mlayher@fastly.com>
2021-09-08 23:50:37 +09:00
zvfvrv
188778603e fixed possible crash if nlriToIPNet result is null 2021-07-25 08:18:26 +09:00
Guangtong Cao
8260b60afe Add support for encapsulation tunnel type in the extended community support in gobgp policy. 2021-06-13 15:51:10 -07:00
Imcom Jin
d277950d0f refactor: nlri/nexthop requires MP will get MP explicitly already.
so we can safely remove the MP_REACH_NLRI from ipv4_uc with ipv4 nexthop
2021-06-07 09:25:54 +09:00
Faicker Mo
cd5671baee policy: add nexthop unchanged
Support config set-next-hop = "unchanged" and also cli command.

Signed-off-by: Faicker Mo <faicker.mo@ucloud.cn>
2021-03-03 09:47:50 +09:00
Imcom Jin
2d73cf8eba bugfix: should check if next-hop attr exists or not before append 2021-03-03 09:28:08 +09:00
Imcom Jin
82d2877c70 fixing an issue when gobgp sits between a MP-capable peer and a non-MP-capable peer
whereby MP-capable peer uses MP_REACH_NLRI to send updates to gobgp
gobgp accepts it but without setting NEXT_HOP pathattr
then gobgp propagates the paths to the non-MP-capable peer with update.NLRI set but without NEXT_HOP
the non-MP-capable peer will treat the update as withdraw message cause routes cannot propagate properly
2021-03-03 09:28:08 +09:00
FUJITA Tomonori
635128d3e5 table: fix longer-prefixes lookup
probably regression due to the introduction of critbitgo.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2021-01-12 14:25:27 +09:00
Tahir Azim
5aa7108d85 Enable IPv6 and IPv4 labeled prefixes to match against prefix set in policy 2020-12-16 18:12:24 +11:00
Thomas Rosenstein
0aff30a742 fix #2289: improve regex to give expected results 2020-10-20 09:01:40 +09:00
Jordan Whited
a4d5d004cc best path selection - compare neigh addr 2020-08-12 20:56:11 +09:00
Sergey Elantsev
136c8222c4 fixed style: unnecessary type cast after type switch and some minor issues. 2020-03-11 06:21:16 +09:00
Pavel Vorontsov
789664e8c3 add support GetTable method for vrfs #2235 2020-02-19 13:35:10 +09:00
FUJITA Tomonori
ce62ea68d8 table: handle staticcheck's warnings
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2019-10-26 22:19:30 +09:00
FUJITA Tomonori
2e05695f68 avoid installing routes with originator ID to global when softresetin
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2019-10-26 07:02:54 +09:00
FUJITA Tomonori
b4e2d9e440 table: replace radix with crit-bit algo for longer-prefixes search
faster and less memory usage.

Now go-radix has gone.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2019-10-25 20:38:33 +09:00