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

106 Commits

Author SHA1 Message Date
Maxime Peim
9fbc03765a send-max: respect configuration 2024-04-29 17:29:42 +09:00
Nathan Skrzypczak
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
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
wenovus
aa0cf39f37 Export Generated BGP Configuration Code
Move internal/pkg/config -> pkg/config/oc

Background: #2593
2023-09-30 09:53:37 +09:00
Kirill Pletnev
155bc636cd fix CLI rd option ignore. 2023-09-06 11:15:01 +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
Rodrigo Peña
82f1eb7897 Fix panic on malformed MRT injection 2023-08-04 22:53:45 -04:00
Costas Drogos
0cc8a9880b cmd/gobgp: fix parseEvpnMacAdvArgs
default-gateway not being declared a reserved keyword led to evpn
macadv commands ending as "encap vxlan default-gateway" to fail parsing.

In that case, default-gateway was bundled with the previous argument.

To fix that, set default-gateway as a reserved keyword of paramFlag type.

While there, change the way we detect its existence later on, given that it now
exists in our reserved map m, if set.
2023-06-06 23:03:15 +02:00
Costas Drogos
a0e9ab24a2 cmd/gobgp: fix parseEvpnEthernetAutoDiscoveryArgs
esi-label follows the format:
   [esi-label <esi-label> [single-active | all-active]]

extractReserved() splits by spaces, returning a list for esi-label, hence
failing the type check.

Change its parameter value type to paramList to be able to accomodate cases
such as "... esi-label 400 single-active".
2023-06-06 22:56:32 +02:00
Costas Drogos
0ab45505ac cmd/gobgp: add tests for EVPN parsing
Add tests to validate parsing of all EVPN-related configuration.

Examples taken from docs/sources/evpn.md.
2023-06-06 22:55:48 +02:00
Enigamict
cbd1492630 Add option to register BGP-LS Attribute in gobgp command
Co-authored-by: watal <watal.i27e@gmail.com>
2023-05-21 10:52:33 +09:00
watal
573ae9158b Add option to register BGP-LS MP_REACH_NLRI in gobgp
Co-authored-by: Enigamict <mochienper@gmail.com>
2023-05-21 03:28:31 +09:00
menetelk0
7109696696 Updating support of L2VPN VPLS address family (AFI 25, SAFI 65) 2023-04-25 01:21:40 +03:00
Pavel Odintsov
22ffdc10a6 Added logic to show local ASN and local BGP peering address for gobgp neighbor command 2023-03-31 15:02:48 +01: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
Carl Kittelberger
81ad318d07 gobgp,gobgpd: implement TLS client authentication. 2023-03-07 15:20:22 +01: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
Yuya Kusakabe
82b708a954 cli,mup: show TEID,QFI,Endpoint for Type 1 ST Route 2022-11-28 09:02:36 +09:00
Yuya Kusakabe
bb6fd19889 mup: fix decode/serialize prefix in Interwork Segment Discovery Route 2022-10-29 07:31:30 +09:00
Yuya Kusakabe
cc75b037c1 cli,mup: support Prefix SID in Interwork/Direct Segment Discovery route 2022-10-16 17:01:26 +09:00
Yuya Kusakabe
b77c0cec07 cli,mup: add mup option to t2st
> When advertising the Type 2 ST route, the controller SHOULD attach a BGP MUP Extended community corresponding to the Direct segment.
https://www.ietf.org/archive/id/draft-mpmz-bess-mup-safi-01.html#name-generation-of-the-type-2-st
2022-10-16 17:01:02 +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
Tomas Vilemaitis
ed0b7f9499 cli: Add local-as attribute in neighbor cmd 2022-09-02 15:50:29 +03:00
Yuya Kusakabe
6966da918c mup: fixes for BGP-MUP
- Route Target support for MUP routes
- Only Direct Segment Discovery route needs MUP Extended Community
- TEID value of 0 is invalid
2022-09-01 15:24:40 +09:00
Yuya Kusakabe
438f2460b3 cli: initial support for BGP-MUP SAFI and Extended Community 2022-08-31 12:26:42 +09:00
Tuetuopay
4df77106b2 fix(cmd/gobgp): parse listen-port as u16, not i16
A port is in the range 0..64k, not -32k..32k. Hence unsigned.
2022-07-02 09:56:56 +09:00
FUJITA Tomonori
2768967541 cmd: avoid deprecated string.Title API
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2022-04-07 00:27:32 +00:00
Manuel Rüger
3703becd80 cmd/gobgp: Fix deprecated grpc.WithInsecure
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2022-03-24 08:00:39 +09:00
FUJITA Tomonori
5d96988932 fix gobmp mrt command downtime
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2022-02-14 04:13:00 +00:00
FUJITA Tomonori
5057add65f make output of gobgp mrt pretty
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2022-01-14 12:42:20 +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
a3aac4d572 cmd/gobgp: fix missing pre policy
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2022-01-01 11:52:28 +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
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
Jakub Chábek
42117d3909 Make iternal/pkg/apiutil public under pkg/apiutil 2021-12-08 17:51:24 +01: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
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
Xiang Liu
dc85224502 fix #2479: add route-server-client and route-reflector-client neighbor 2021-11-04 11:00:40 +08:00
Manuel Rüger
d6e7a66763 go.mod: Bump dependencies 2021-08-28 20:28:15 +09:00
bbassingthwaite
8fbb5abc7c Add support for the gRPC client to connect on a unix domain socket 2021-08-08 20:46:10 +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
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
FUJITA Tomonori
5fca0300b8 cmd/rpki: support delete api
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2021-05-06 07:58:00 +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
Sergey Elantsev
72027852e2 go fmted 2021-01-27 21:43:39 +03:00