129 Commits
Author SHA1 Message Date
Yutaro Hayakawa 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 <[email protected]>
2024-04-27 23:51:16 +09:00
Yutaro Hayakawa 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 <[email protected]>
2024-04-27 23:51:11 +09: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
Lauri HuotariandFUJITA Tomonori 7ddcd293dd Add initial support for evpn subtype 4 2023-12-09 11:37:17 +09:00
FUJITA Tomonori d210224493 packet: fix software version capability parser
Fixes #2732

Signed-off-by: FUJITA Tomonori <[email protected]>
2023-11-02 10:39:02 +09:00
wenovusandFUJITA Tomonori 7a77f281c5 Export zebra package to /pkg/zebra 2023-10-31 22:42:13 +09:00
FUJITA Tomonori e26631ceb4 packet: fix FQDN capability parser
Fixes #2708
2023-10-31 21:46:34 +09:00
Jeremiah Millay 286c887775 fix: call validatePathAttributeFlags after parsing and setting path attribute length 2023-10-30 10:58:13 -04:00
wenovusandFUJITA Tomonori 419c50dfac Check Address and LocalAddress instead of RouterId 2023-10-15 21:33:50 +09:00
wenovusandFUJITA Tomonori 16a9c95393 Allow testing multiple GoBGP instances on localhost.
Currently GoBGP does not accept UPDATE messages with nexthops pointing
to a loopback address. This disallows multiple GoBGP instances from
running at the same time on 127.0.0.0/8.

This PR proposes removing this constraint when the RouterID of the
current GoBGP instance itself resides within the testing subnet of
127.0.0.0/8.
2023-10-15 21:32:04 +09:00
Arjun Singh 60bcfc20f2 [Fuzzing] fuzzing support for oss-fuzz
Signed-off-by: Arjun Singh <[email protected]>
2023-09-19 20:39:25 +05:30
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 PletnevandKirill 'horseinthesky' 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 PletnevandKirill 'horseinthesky' 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
Rastislav SzaboandFUJITA Tomonori f617588415 Enhance AsPath attribute String() format
Signed-off-by: Rastislav Szabo <[email protected]>
2023-07-16 20:43:43 +09:00
FUJITA Tomonori d4d97da220 pkg/packet/mrt: restore compatibility
restore the API breakage due to c801e18495.

However, this is a hack. Should be removed with the major version updated.

Signed-off-by: FUJITA Tomonori <[email protected]>
2023-07-01 13:35:40 +09:00
Harry FreeboroughandFUJITA Tomonori c801e18495 Add MRT-specific MP_REACH_NLRI encoding
This form, as defined in RFC 6396 4.3.4, is found in many public MRT
dumps.
2023-07-01 13:05:51 +09:00
Linus MellbergandFUJITA Tomonori 9c969eb763 fixes #2645 Panic when adding FlowspecComponentItem with to large value 2023-05-22 16:35:12 +09:00
Enigamictandwatal ba162b37b4 Fix node/adjacency/peer-set SID type
Co-authored-by: watal <[email protected]>
2023-05-21 10:52:37 +09:00
Enigamictandwatal 1a6dc92b95 Fix Serialize() method to advertise BGP Router ID
Co-authored-by: watal <[email protected]>
2023-05-21 03:28:35 +09:00
menetelk0 7109696696 Updating support of L2VPN VPLS address family (AFI 25, SAFI 65) 2023-04-25 01:21:40 +03:00
Yuya KusakabeandFUJITA Tomonori 43cb0f5a9d pkg/packet/bgp: fix Type 2 ST route JSON format 2023-03-26 16:17:02 +09:00
Yuya KusakabeandFUJITA Tomonori 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
Yuya KusakabeandFUJITA Tomonori 305fc65a1f test(rtr): remove deprecated function rand.Seed()
See https://pkg.go.dev/math/[email protected]#Seed
2023-03-23 16:19:33 +09:00
Yuya Kusakabe e15e76f9d2 packet/bgp,mup: fix prefix format in Type 1 ST route
https://www.ietf.org/archive/id/draft-mpmz-bess-mup-safi-01.html#section-3.1.3
The Prefix field must be encoded as described in RFC4271 4.3. UPDATE Message Format.
https://www.rfc-editor.org/rfc/rfc4271.html#section-4.3
2023-02-11 21:18:01 +09:00
Donatas AbraitisandFUJITA Tomonori 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 <[email protected]>
2023-01-31 23:09:24 +09:00
Rinat Baygildin 1a948205ed Use concat instead of Sprintf for PathAttributeInterface
Sprintf is a dramatically slower than silmple concatenation.

Signed-off-by: Rinat Baygildin <[email protected]>
2023-01-30 17:26:02 +04:00
Rinat Baygildin ac6e229d79 Use concat instead of Sprintf for RouteDistinguisherInterface
Sprintf is a dramatically slower than silmple concatenation.

Signed-off-by: Rinat Baygildin <[email protected]>
2023-01-30 16:40:51 +04:00
Rinat Baygildin a5c3b0b6a2 Use concat instead of Sprintf AddrPrefixInterface
Sprintf is a dramatically slower than silmple concatenation.

Signed-off-by: Rinat Baygildin <[email protected]>
2023-01-30 16:07:24 +04:00
Yuya Kusakabe c61ef6209d packet/bgp,mup: fix decode Interwork Segment Discovery route 2023-01-28 16:02:18 +09:00
yas-nyanandwatal 033cfdb4be add Extract for LsBgpPeerSegmentSID
Co-authored-by: watal <[email protected]>
2023-01-10 21:19:50 +09:00
82aebc2a68 Create LsBgpPeerSegmentSID struct
Co-authored-by: watal <[email protected]>
Co-authored-by: kanaya516 <[email protected]>
2023-01-10 21:16:07 +09:00
yas-nyanandwatal 37f04b3dad Refine LsNodeNLRI and LsLinkNLRI stringify 2023-01-10 14:59:21 +09:00
watal a55507462a Fix show results of LsAttributes 2023-01-10 14:59:21 +09:00
7651e60a41 Add NewLsAttributeTLVs functions
Co-authored-by: yas-nyan <[email protected]>
Co-authored-by: kanaya516 <[email protected]>
2023-01-10 14:59:17 +09:00
5b9a306809 Add BGP-LS gRPC
Co-authored-by: yas-nyan <[email protected]>
Co-authored-by: kanaya516 <[email protected]>
2023-01-09 19:46:05 +09:00
kanaya516 17eb68a12d add test for BGP-LS EPE 2023-01-08 08:04:35 +00:00
kanaya516 d1cd6b300a BGP-Confederation for BGP-LS EPE 2023-01-08 06:19:19 +00:00
yas-nyanandkanaya516 4db6e77ec9 add test for PeerNodeSID 2022-12-28 15:22:50 +00:00
kanaya516 70f4e8a566 add BGP-LS EPE 2022-12-28 15:22:45 +00: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 411667d052 mup: fix route key for Type 1 ST Route 2022-11-28 09:01:43 +09:00
Vincent BernatandFUJITA Tomonori 9d89241c47 pkg/packet/bgp: initial support for BGP VPLS
This includes BGP VPLS NLRI and extended community. There is no CLI/API
support yet. Also, VPLS AFI/SAFI is shared with RFC 6074 which says:

> Both BGP-AD and VPLS-BGP [RFC4761] use the same AFI/SAFI.  In order
> for both BGP-AD and VPLS-BGP to co-exist, the NLRI length must be
> used as a demultiplexer.
>
> The BGP-AD NLRI has an NLRI length of 12 bytes, containing only an
> 8-byte RD and a 4-byte VSI-ID.  VPLS-BGP [RFC4761] uses a 17-byte
> NLRI length.  Therefore, implementations of BGP-AD must ignore NLRI
> that are greater than 12 bytes.

This is not handled in this PR.

The generic transitive experimental extended community types are shared
with FlowSpec. The parsing is extended to handle VPLS as well, but not
other L2 encapsulations.

Fix #2590
2022-11-02 17:53:48 +09:00
Yuya KusakabeandFUJITA Tomonori bb6fd19889 mup: fix decode/serialize prefix in Interwork Segment Discovery Route 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 KusakabeandFUJITA Tomonori 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 KusakabeandFUJITA Tomonori 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 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 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