BGP implemented in the Go Programming Language

Related tags

Network gobgp
Overview

GoBGP: BGP implementation in Go

Build Status

GoBGP is an open source BGP implementation designed from scratch for modern environment and implemented in a modern programming language, the Go Programming Language.


Install

Try a binary release.

Documentation

Using GoBGP

Externals

Community, discussion and support

We have the Slack for questions, discussion, suggestions, etc.

You have code or documentation for GoBGP? Awesome! Send a pull request. No CLA, board members, governance, or other mess. See BUILD.md for info on code contributing.

Licensing

GoBGP is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Issues
  • Support for Administrative Shutdown Communication

    Support for Administrative Shutdown Communication

    These patch enable to send and log "Administrative Shutdown Communication". issues: #1200 Reference: https://tools.ietf.org/html/draft-ietf-idr-shutdown-03

    opened by iwaseyusuke 20
  • EVPN address family can not work

    EVPN address family can not work

    Here is my config file:

    $ more conf/evpn.conf 
    [global.config]
      as = 100
      router-id = "192.168.1.2"
    
    [global.listen-config]
    # listen port (by default 179)
    port = 179
    
    # listen address list (by default "0.0.0.0" and "::")
    local-address-list = ["192.168.1.2"]
    
    [[neighbors]]
    [neighbors.config]
      neighbor-address = "192.168.1.3"
      peer-as = 100
    [[neighbors.afi-safis]]
      [neighbors.afi-safis.config]
      afi-safi-name = "l2vpn-evpn"
    

    But the Open Message that gobgp send to the peer 192.168.1.3 only can support IPv4 unicast.

    screen shot 2016-04-27 at 10 03 06 am
    opened by xiaopeng163 20
  • Big challenge with default export filters

    Big challenge with default export filters

    Hello!

    I'm using GoBGP as client for 2 BGP router servers. And I hit very_popular and ugly issue - I have reannounced all received prefixes from first uplink to the second and vice versa.

    So fortunately I have filters on opposite side and I haven;t broken Internet.

    So I have multiple questions / suggestions.

    First of all, I want to ask to set default export policy to reject or just reject re-announce prefixes received from other uplink to another.

    If somebody want it it should explicitly enable this.

    I have achieved this with following CLI command:

    gobgp global policy export set default reject    
    

    But I haven't any idea how to do same with configuration file. Could you help me here?

    opened by pavel-odintsov 20
  • extend attributes proto for Prefix SID support

    extend attributes proto for Prefix SID support

    Signed-off-by: Serguei Bezverkhi [email protected]

    It is work in progress, nevertheless comments/suggestions/critics is very welcome.

    Apologies for the large change, VSCode reformatted proto file according to the latest formatting rules.

    opened by sbezverk 18
  • Refactor code that configures a server from config file

    Refactor code that configures a server from config file

    Issue: https://github.com/osrg/gobgp/issues/2106

    Straight-forward refactoring change which greatly simplifies cmd/gobgpd/main.go making it easier to read and follow. It refactors the config file processing code from gobgpd into smaller methods which are easier to understand and makes the flow clearer.

    opened by ecbaldwin 18
  • Compilation breaks on x86

    Compilation breaks on x86

    Commit 68d2478e2ea1d8607f85e6ab3d4a792e054ce6c2 introduced a change, in packet/bgp/bgp.go:3370 that overflows an int on 32bit architectures. Compiler line: src/github.com/osrg/gobgp/packet/bgp/bgp.go:3370:18: constant 1099511627775 overflows int

    opened by shadrick 18
  • C/C++ integration code

    C/C++ integration code

    Hello, folks!

    I'm developer of https://github.com/FastVPSEestiOu/fastnetmon and I widely use BGP and Flow Spec.

    My Customers asked me about GoBGP integration https://github.com/FastVPSEestiOu/fastnetmon/issues/389 And I really like your project!

    So I have found this nice page https://github.com/osrg/gobgp/blob/master/docs/sources/grpc-client.md and looking for some way for C++/C integration.

    Thus I could add GoBGP syntax to my BGP Flow Spec library (it's generates flow spec from C structures): https://github.com/FastVPSEestiOu/fastnetmon/blob/master/src/bgp_flow_spec.h and feed it with CLI.

    But I looking for some way for more deeper integration :) Could you help me?

    opened by pavel-odintsov 17
  • Error: Missing mandatory attribute: 01

    Error: Missing mandatory attribute: 01

    Hello, if you try to install a path using the grpc interface and you forget to set the Origin field the grpc interface will install it successfully without the attribute set and will advertise that to neighbors causing the neighbors to drop the connection because a mandatory field is missing.

    Regards.

    opened by dbarrosop 16
  • server: Implement TTL security

    server: Implement TTL security

    This patch enable to configure Generalized TTL Security Mechanism (GTSM).

    TTL security enables to specify the minimum TTL(IPv4)/HOPLIMIT(IPv6) which can be accepted. For example, "ttl-min = 255" means that only directly connected peer is acceptable.

    Note: TTL Security feature is mututally exclusive with "neighbors.ebgp-multihop.config".

    fixes https://github.com/osrg/gobgp/issues/1268

    opened by iwaseyusuke 15
  • deletePath not sending withdraw when connected to RR

    deletePath not sending withdraw when connected to RR

    Hello,

    Doing some experimentation. I have gobgp configured (54.54.54.54) to talk to a vendor route reflector (35.121.146.13). Using the gobgp CLI or Java GRPC, when I addPath (ipv4), goBgp correctly sends the route and it is received on the RR.

    The RR then echo's back the route with the RR cluster ID back to gobgp. I can see this route come in via monitor and also in the global rib dump.

    When I try to deletePath, via CLI or Java GRPC, i do NOT see the [DELROUTE] log message. The entry is deleted from the gobgp but a withdraw message is not received on the RR. Therefore the route is not withdrawn.

    **Note: if i disable route-reflector on the other node, gobgp can successful add and withdraw the route. My guess is gobgp is not withdrawing the route it generated due to a collision with the reflected route **

    Here's a step through of what's happening:

    
    # Add the route in gobgp
    
    # ./gobgp global rib -a ipv4 add 5.5.5.5/24 nexthop 10.10.10.10
    
    
    # gobgp monitor outputs the new route :
    
    [ROUTE] 5.5.5.0/24 via 10.10.10.10 aspath [] attrs [{Origin: ?}]
    
    # RR receives the update
    
    116 2018/08/15 17:50:13.443 UTC MINOR: DEBUG #2001 Base Peer 1: 172.10.54.2
    "Peer 1: 172.10.54.2: UPDATE
    Peer 1: 172.10.54.2 - Received BGP UPDATE:
        Withdrawn Length = 0
        Total Path Attr Length = 21
        Flag: 0x40 Type: 1 Len: 1 Origin: 2
        Flag: 0x40 Type: 2 Len: 0 AS Path:
        Flag: 0x40 Type: 3 Len: 4 Nexthop: 10.10.10.10
        Flag: 0x40 Type: 5 Len: 4 Local Preference: 100
        NLRI: Length = 4
            5.5.5.0/24
    "
    
    
    # RR sends a bgp update with the cluster is
    
    117 2018/08/15 17:50:36.951 UTC MINOR: DEBUG #2001 Base Peer 1: 172.10.54.2
    "Peer 1: 172.10.54.2: UPDATE
    Peer 1: 172.10.54.2 - Send BGP UPDATE:
        Withdrawn Length = 0
        Total Path Attr Length = 35
        Flag: 0x40 Type: 1 Len: 1 Origin: 2
        Flag: 0x40 Type: 2 Len: 0 AS Path:
        Flag: 0x40 Type: 3 Len: 4 Nexthop: 10.10.10.10
        Flag: 0x40 Type: 5 Len: 4 Local Preference: 100
        Flag: 0x80 Type: 9 Len: 4 Originator ID: 54.54.54.54
        Flag: 0x80 Type: 10 Len: 4 Cluster ID:
            35.121.146.13
        NLRI: Length = 4
            5.5.5.0/24
    "
    
    # note: gobgp monitor does not have any new output
    
    # gobgp rib output sees both paths
    # ./gobgp global rib
       Network              Next Hop             AS_PATH              Age        Attrs
    *> 5.5.5.0/24           10.10.10.10                               00:02:51   [{Origin: ?}]
    *  5.5.5.0/24           10.10.10.10                               00:02:27   [{Origin: ?} {LocalPref: 100} {Originator: 54.54.54.54} {ClusterList: [35.121.146.13]}]
    
    
    # Sending a delete, log on the RR is empty. Log on gobgp does not show [DELROUTE] but shows [ROUTE] of the entry from the RR
    
    ./gobgp global rib -a ipv4 del 5.5.5.5/24 nexthop 10.10.10.10
    
    [ROUTE] 5.5.5.0/24 via 10.10.10.10 aspath [] attrs [{Origin: ?} {LocalPref: 100} {Originator: 54.54.54.54} {ClusterList: [35.121.146.13]}]
    
    # Attempting to delete the route again is met with:
    
    {"Key":"5.5.5.0/24","Path":{"nlri":{"prefix":"5.5.5.0/24"},"attrs":[{"type":1,"value":2},{"type":3,"nexthop":"10.10.10.10"}],"age":1534355705,"withdrawal":true,"validation":"none"},"Topic":"Table","level":"warning","msg":"No matching path for withdraw found, may be path was not installed into table","time":"2018-08-15T13:55:05-04:00"}
    
    opened by astone282 14
  • Radix tree implementation, bytes not strings

    Radix tree implementation, bytes not strings

    I notice in some parts of the code, you're using go-radix to produce a radix tree, however you're doing this by converting the prefix into a string and then converting it back with net.ParseCIDR when the result is found.

    I wondered if you'd considered using critbitgo instead, https://godoc.org/github.com/k-sone/critbitgo allows you to store prefix data in the natural []byte format that is used with the net package. It should produce some nice speedups and reduction in memory -- not just for removing the string dependency, but also because you'll be storing the data in a proper compressed trie.

    Not urgent by any means, as I don't actually tend to use the codepaths this would affect, but I figured it would be nice to remove all the string artefacts :)

    opened by dotwaffle 14
  • AddPath API Call returns OK response if uuid.NewRandom fails

    AddPath API Call returns OK response if uuid.NewRandom fails

    In this block of code here: https://github.com/osrg/gobgp/blob/2117125f0dc41671fdfc069b953059f568010ea5/pkg/server/server.go#L2141-L2145 the code checks if an error was returned by uuid.NewRandom before assigning it to s.uuidMap, but it does not return the error to the caller if it fails. This then leads to an OK response being sent back to the caller, with a Uuid set to empty.

    It seems like the final return nil line there should actually be return err to indicate to the caller there was an error.

    opened by dawn-minion 0
  • Color-Only SR-TE support

    Color-Only SR-TE support

    hello,

    Are there any plans to support color-only aware bgp-SR-TE policies as defined in https://datatracker.ietf.org/doc/html/draft-ietf-spring-segment-routing-policy#section-8.

    At this time ,if i read the code correctly the color is always 00 (type 0 ).

    opened by cpmarvin 1
  • gobgp not sending ZEBRA_ROUTE_ADD command for IPv6?

    gobgp not sending ZEBRA_ROUTE_ADD command for IPv6?

    First, thank you for this tool, it's great! (Side note, I'm especially looking forward to how the rustybgp server comes along! 😄)

    While experimenting with a simple BGP setup, we noticed that one nodes where we have FRR (v8.1) installed, only IPv4 routes are being added to the kernel routing table, not IPv6.

    Upon sniffing the /var/run/frr/zserv.api socket, we see that gobgpd sends the correct ZEBRA_ROUTE_{ADD,DEL} for IPv4, but doesn't send anything at all for IPv6; it's totally silent.

    Am I holding this wrong, or could this be a bug? A super minimal configuration that allowed me to reproduce was this:

    Node A (FRR and gobgp, host IPv4: 172.16.0.5, host IPv6: fd42:367a::a1, AS: 64512):

    [global.config]
      as = 64512
      router-id = "172.16.0.5"
    
    [[neighbors]]
      [neighbors.config]
        neighbor-address = "172.16.1.5"
        peer-as = 65001
    
    [zebra]
        [zebra.config]
            enabled = true
            url = "unix:/var/run/frr/zserv.api"
            redistribute-route-type-list = ["connect"]
            version = 6
    

    And then on Node B (gobgp, host IPv4: 172.16.1.5, host IPv6: fd42:367a::b1, AS: 65001), this node advertises the routes:

    [global.config]
      as = 65001
      router-id = "172.16.1.5"
    
    [[neighbors]]
      [neighbors.config]
        neighbor-address = "172.16.0.5"
        peer-as = 64512
    

    On Node B advertise two routes; both will show up on Node A, but only the IPv4 will show up in the kernel routing table (Note the Node before the command):

    B$ gobgp global rib add 192.168.255.254/32 -a ipv4
    B$ gobgp global rib add fdfd:1234::2/128 -a ipv6
    
      ... Then on A ...
    
    A$ gobgp global rib -a ipv4
       Network              Next Hop             AS_PATH              Age        Attrs
    *> 172.16.0.0/16        0.0.0.0                                   2d 01:15:58 [{Origin: i} {Med: 100}]
    *> 192.168.255.254/32   172.16.1.5         65001                00:00:04   [{Origin: ?} {Med: 100}]
    
    A$ gobgp global rib -a ipv6
       Network              Next Hop             AS_PATH              Age        Attrs
    *> fd42:367a::a1/128    ::                                        00:05:11   [{Origin: i} {Med: 0}]
    *> fdfd:1234::1/128      fd42:367a::b1    65001       00:05:11   [{Origin: ?} {Med: 0}]
    
    A$ ip -4 route | grep 192
    192.168.255.254 nhid 12 via 172.16.1.5 dev enp5s0 proto bgp metric 20
    
    A$ ip -6 route | grep fdfd
    
    
    opened by kbknapp 0
  • Could you please add a CLI to get subnet specific route count

    Could you please add a CLI to get subnet specific route count

    To get the total route count we have gobgp global rib summary similarly, if I wanted to get only the routes with /24 subnet, which command can we use.

    opened by rkvsgit 2
  • Support for Adj-RIB-Out monitoring

    Support for Adj-RIB-Out monitoring

    Do you know if there is currently support in place for monitoring the Adj-RIB-Out of a gobgp router connected to to a BMP collector via a BMP session? If not, is it in the roadmap? Relevant resource: https://datatracker.ietf.org/doc/rfc8671/ Current pre- and post-policy BMP settings seem to apply only to the Adj-RIB-In (https://github.com/osrg/gobgp/blob/master/docs/sources/bmp.md), not sure if supporting RIB-out monitoring is also straightforward. Thanks in advance for the clarification!

    opened by vkotronis 0
Releases(v3.4.0)
A simple wrapper around libpcap for the Go programming language

PCAP This is a simple wrapper around libpcap for Go. Originally written by Andreas Krennmair [email protected] and only minorly touched up by Mark Smith

Andreas Krennmair 445 Jul 27, 2022
Diameter stack and Base Protocol (RFC 6733) for the Go programming language

Diameter Base Protocol Package go-diameter is an implementation of the Diameter Base Protocol RFC 6733 and a stack for the Go programming language. St

Alexandre Fiori 204 Jul 27, 2022
SMPP 3.4 Protocol for the Go programming language

SMPP 3.4 This is an implementation of SMPP 3.4 for Go, based on the original smpp34 from Kevin Patel. The API has been refactored to idiomatic Go code

Alexandre Fiori 191 Jul 25, 2022
Basic LDAP v3 functionality for the GO programming language.

Basic LDAP v3 functionality for the GO programming language. Install For the latest version use: go get gopkg.in/ldap.v2 Import the latest version wi

null 137 May 24, 2022
Go-web-dev - Web Development With Google's Golang Programming Language Code Snippet and Exercises.

Web Development With Google's Golang Programming Language Code Snippet and Exercises This repository contains my code snippets, hands on exercises and

null 2 Jan 16, 2022
A persistent queue implemented in Go.

goq goq is a persistent queue implemented in Go. Features Communication over HTTP RESTful with JSON responses (trivial to write client libraries) Mini

Kunal Anand 29 Feb 10, 2022
URI Templates (RFC 6570) implemented in Go

uritemplates -- import "github.com/jtacoma/uritemplates" Package uritemplates is a level 4 implementation of RFC 6570 (URI Template, http://tools.ietf

Joshua Tacoma 71 Jan 15, 2022
communicate with iOS devices implemented with Golang

Golang-iDevice much more easy to use ?? electricbubble/gidevice-cli Installation go get github.com/electricbubble/gidevice Devices package main impor

雷系泡泡 191 Aug 2, 2022
A TCP socket based chat server implemented using Go

Go Chat Server A better TCP socket chat server implemented using Go Connecting nc localhost 5000 Docker Build the container image docker build -t grub

Christopher Gruber 0 Oct 16, 2021
many tools implemented in Golang

Go-Tools many tools implemented in Golang tools project comments abtest AB测试分流 dag_flow DAG工作流 hugo_themes Hugo主题 log_monitor 日志监控服务 pepper_cache 内存kv

殷雅俊 0 Dec 12, 2021
A Twirp RPC OpenAPI generator implemented as `protoc` plugin

twirp-openapi-gen A Twirp RPC OpenAPI generator implemented as protoc plugin Currently supports only OpenAPI 2.0 Usage Installing the generator for pr

Albenik's Golang Projects 1 May 26, 2022
A simple FTP protocol with client and server implemented in TypeScript and Golang

websocket-ftp A simple FTP protocol with client and server implemented in TypeScript and Golang. Example (Client) const buffer: Uint8Array = (new Text

LQR471814 0 Apr 14, 2022
Pacemaker - Rate limit library. Currently implemented rate limits are

PaceMaker Rate limit library. Currently implemented rate limits are Fixed window

Marquitos 2 Apr 2, 2022
Absystem - Golang implemented absystem core api

环境初始化 export GOPROXY=https://goproxy.cn,direct && export GO111MODULE=on # OR go

liangchengming 2 Feb 16, 2022
The HomeKit Accessory Protocol (hap) implemented in Go

hap hap (previously hc) is a lightweight library to develop HomeKit accessories in Go. It abstracts the HomeKit Accessory Protocol (HAP) and makes it

Matthias 84 Aug 2, 2022
Go network programming framework, supports multiplexing, synchronous and asynchronous IO mode, modular design, and provides flexible custom interfaces

Go network programming framework, supports multiplexing, synchronous and asynchronous IO mode, modular design, and provides flexible custom interfaces。The key is the transport layer, application layer protocol has nothing to do

rick.wu 10 Jun 27, 2022
A go module supply Java-Like generic stream programming (while do type check at runtime)

gostream A go module supplying Java-Like generic stream programming (while do type check at runtime) Using Get a Stream To get a Stream, using SliceSt

Sad_Dog 0 Jan 16, 2022