352 Commits

Author SHA1 Message Date
Maxime Peim 9fbc03765a send-max: respect configuration 2024-04-29 17:29:42 +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
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
Vladislav Grishenko 146b2b8f59 server: improve ListPath's memory consumption with batched send
With a lot of paths (hundreds of thousands) gobgp may oom or
stuck in swapping.
Allow to specify max batch size via grpc and keep unlimited batch
size by default since 21093fbc87
without preallocation on the first run, so it still should not
affect perfomance/allocations with small ammount of paths.

Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru>
2023-10-02 14:42:52 +09: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
Rinat Baygildin b8e17e06cd Use filter for watch pre/post-update watch events
Filtering by peer address worked only for initial state.
Using watch event's filter allows to use it for each event and could be extended by other conditions, e.g. peer group.

peer_address and peer_group were added to API (backward compatible).

Signed-off-by: Rinat Baygildin <bayrinat@yandex-team.ru>
2023-09-06 15:35:55 +09:00
menetelk0 7109696696 Updating support of L2VPN VPLS address family (AFI 25, SAFI 65) 2023-04-25 01:21:40 +03:00
Donatas Abraitis c556ca4f8d Add SoftwareVersion capability
https://datatracker.ietf.org/doc/html/draft-abraitis-bgp-version-capability

Working example with FRR
```
% ./gobgp neighbor 192.168.10.124
BGP neighbor is 192.168.10.124, remote AS 65001
  BGP version 4, remote router ID 200.200.200.202
  BGP state = ESTABLISHED, up for 00:01:14
  BGP OutQ = 0, Flops = 0
  Hold time is 3, keepalive interval is 1 seconds
  Configured hold time is 90, keepalive interval is 30 seconds

  Neighbor capabilities:
    multiprotocol:
        ipv6-unicast:	advertised
        ipv4-unicast:	advertised and received
    route-refresh:	advertised and received
    extended-nexthop:	advertised
        Local:  nlri: ipv4-unicast, nexthop: ipv6
    UnknownCapability(6):	received
    UnknownCapability(9):	received
    graceful-restart:	advertised and received
        Local: restart time 10 sec
	    ipv6-unicast
	    ipv4-unicast
        Remote: restart time 120 sec, notification flag set
	    ipv4-unicast, forward flag set
    4-octet-as:	advertised and received
    add-path:	received
      Remote:
         ipv4-unicast:	receive
    enhanced-route-refresh:	received
    long-lived-graceful-restart:	advertised and received
        Local:
	    ipv6-unicast, restart time 10 sec
	    ipv4-unicast, restart time 20 sec
        Remote:
	    ipv4-unicast, restart time 0 sec, forward flag set
    fqdn:	advertised and received
      Local:
         name: donatas-pc, domain:
      Remote:
         name: spine1-debian-11, domain:
    software-version:	advertised and received
      Local:
         GoBGP/3.10.0
      Remote:
         FRRouting/8.5-dev-MyOwnFRRVersion-gdc92f44a4
    cisco-route-refresh:	received
  Message statistics:
```

FRR side:

```
root@spine1-debian-11:~# vtysh -c 'show bgp neighbor 192.168.10.17 json' | \
> jq '."192.168.10.17".neighborCapabilities.softwareVersion.receivedSoftwareVersion'
"GoBGP/3.10.0"
root@spine1-debian-11:~#
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-31 23:09:24 +09:00
yas-nyan cfb39b1761 re-design BgpPeerSegment protobuf 2023-01-10 21:19:33 +09:00
kanaya516 d1cd6b300a BGP-Confederation for BGP-LS EPE 2023-01-08 06:19:19 +00:00
kanaya516 70f4e8a566 add BGP-LS EPE 2022-12-28 15:22:45 +00:00
Rinat Baygildin a3f1d8c19a Add enable_only_binary flag to grpc ListPath method
Adding enable_only_binary allows using only binary representation of nlri and attributes on the ListPath call.
For clients who uses only binary representation it helps to significantly reduce
resource consumption by refusing unnecessary conversion.

It is vital while processing a large number of paths, e.g. full-view.

This change doesn't break backward compatibility.
2022-11-18 16:04:41 +04:00
Yuya Kusakabe 629b2c10ab api,mup: remove unused prefix_length field in MUPInterworkSegmentDiscoveryRoute 2022-10-29 07:31:30 +09:00
Yuya Kusakabe 0f377b3a4f api,pkg/packet/bgp: fix SRv6 Endpoint Behavior for MUP values 2022-10-16 17:01:13 +09:00
Yuya Kusakabe 30b95991ad pkg/packet/bgp: refactor Prefix-SID
- Add TLVType contant values.
- Add NewPathAttributePrefixSID().
- Add SRv6ServiceTLV to support SRv6 L2 Service TLV.
- Move reserved field handling to each type of TLV,
  because header and reserved field size are different for each type.
  For more details, see https://www.rfc-editor.org/rfc/rfc8669.html
  and https://www.rfc-editor.org/rfc/rfc9252.html.
2022-10-16 16:42:59 +09:00
Yuya Kusakabe 0a18fce70d Fix typo in SRv6 SID Structure Sub-Sub-TLV
See https://www.rfc-editor.org/rfc/rfc9252.html#section-3.2.1
2022-10-16 16:42:59 +09:00
Yuya Kusakabe 975db96b86 mup: handle Type 1 ST Route Prefix as Prefix instead of single address
See https://www.ietf.org/archive/id/draft-mpmz-bess-mup-safi-01.html#name-bgp-type-1-session-transfor for details.
2022-09-28 11:38:26 +09:00
Yuya Kusakabe 06af56ebb4 pkg/packet/bgp,api: add SRv6 behavior for SRv6 MUP
- End.M.GTP6.D: 45
- End.M.GTP6.Di: 46
- End.M.GTP6.E: 47
- End.M.GTP4.E: 48
https://www.iana.org/assignments/segment-routing/segment-routing.xhtml
2022-09-01 10:34:52 +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 229d11635e clean up FQDNCapability message
- we don't need hostlen and domainlen.
- use camel case.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2022-01-16 23:45:44 +00:00
FUJITA Tomonori 2032f591ad add filename variable DisableMrtRequest
needs to specify which mrt instance is supposed to be disabled.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2022-01-13 05:26:58 +00:00
FUJITA Tomonori 711063a9f5 Add ListBmp API
Get the status of BMP stations.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2022-01-13 02:07:20 +00:00
FUJITA Tomonori c9374d31f2 fix mrt proto typo
also make it consistent with config definition.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2022-01-12 23:32:42 +00:00
FUJITA Tomonori ea58a919f4 Add WatchEvent API to replace MonitorPeer and MonitorTable
get peer and path events in order.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2021-12-14 01:11:24 +00:00
night 030274eb86 Fix spelling of LinkBandwidth 2021-12-12 04:59:26 +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
FUJITA Tomonori 6eeabdf01b proto: replace 'as' with 'asn'
For consistency, always use 'asn' instead of 'as', 'as_number', etc.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2021-12-11 01:36:20 +00:00
FUJITA Tomonori 15920c9c99 proto: clean up peer messages
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2021-12-10 14:51:29 +00:00
FUJITA Tomonori f75661f1c3 proto: add DumpType to EnableMrtRequest
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2021-12-10 13:43:06 +00:00
FUJITA Tomonori 24ae33b208 proto: define AsSegment Type enum
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2021-12-10 13:26:22 +00:00
Vallimamod Abdullah dd270fc087 api: defines LsOspfRouteType enum for LsPrefixDescriptor
Allows better serialization as this field is automatically removed from
prefix descriptor when empty/unknown instead of getting
`LsOspfRouteType(0)` default value from Stringer.
2021-12-08 07:23:16 +00:00
Vallimamod Abdullah 4b11fc7bd6 api: corrects typo in validation reason enum (s/reasot/reason/) 2021-12-08 07:23:12 +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 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
Donatas Abraitis c114e04958 Handle ttl-security option correctly
It wasn't configurable at all.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-06-30 10:55:06 +09:00
zvfvrv 92f37d65aa SegmentTypeB proto definition 2021-06-30 07:38:00 +09:00
Donatas Abraitis 94d720ff40 Add FQDN capability
It's not kinda RFC (draft), but it's implemented and used in various
other open-source software like FRRouting, Bird, ExaBGP.

It's very handy when dealing with lots of peers.

Exampe between GoBGP and FRRouting:
```
% ./cmd/gobgp/gobgp neighbor 192.168.10.123 | grep -A4 fqdn:
    fqdn:       advertised and received
      Local:
         name: donatas-pc, domain:
      Remote:
         name: exit1-debian-9, domain:
```

```
% vtysh -c 'show bgp neighbors 192.168.10.17 json' | jq .'"192.168.10.17".neighborCapabilities.hostName'
{
  "advHostName": "exit1-debian-9",
  "advDomainName": "n/a",
  "rcvHostName": "donatas-pc",
  "rcvDomainName": "n/a"
}
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-05-24 09:55:03 +03:00
Carl Baldwin 9e98fcf1d6 Do not suppress initial non-established peer state in MonitorPeer
The issue with the initial update was that sometimes a connection had
not yet been established. Trying to get remote and local connection
data caused a segmentation violation because `fsm.conn` was nil.

Also adds a flag to MonitorPeerRequest in the GRPC API to enable the
new behavior to avoid backward incompatibility.

fixes #2047
2021-04-22 17:40:15 -06:00
Marcus Wichelmann 34ed2a2ce5 Update proto 2021-03-29 20:57:36 +02:00
Marcus Wichelmann 3c437e5aec Added ListDynamicNeighbor message to API 2021-03-29 20:53:53 +02:00
Marcus Wichelmann 76f40ede0d Added DeleteDynamicNeighbor message to API 2021-03-29 20:53:45 +02:00
Marcus Wichelmann c1e7463e36 Added ListPeerGroup message to API 2021-03-29 20:53:25 +02:00
Mikael Magnusson 390e3127ce add support for tunnel egress endpoint sub-TLV
As specified in draft-ietf-idr-tunnel-encaps-22.

Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
2021-03-14 08:46:44 +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
Milan Lenco 3339f97722 feat: add option to bind listener to a (VRF) device
Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
2021-02-13 18:54:31 +09:00
Mikael Magnusson c70d99cc91 add pb for UDP destination port sub-TLV
Generated with tools/grpc/genproto.sh

Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
2021-01-23 09:03:18 +09:00