225 Commits
Author SHA1 Message Date
FUJITA Tomonori 2c2cd2bec2 table: add attribute hash value to Path structure
This is for batching paths into one bgp message.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-11-23 21:21:34 +09:00
IWASE YusukeandFUJITA Tomonori f32673bbec api: Activate address family using Peer.AfiSafis
Currently, to configure per AFI-SAFI settings when adding neighbor
via gRPC API, it is require to specify the both Peer.Families and
Peer.AfiSafis fields. If Peer.Families is omitted, settings in
Peer.AfiSafis are ignored and the given address families are not
activated.

This patch enables to configure per AFI-SAFI settings and activate
the address family with only Peer.AfiSafis (without Peer.Families).

Note: For the backward compatibility, if only Peer.Families is
specified, this patch creates per AFI-SAFI settings with the default
settings.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-16 09:59:45 +09:00
IWASE YusukeandFUJITA Tomonori 6c6cd6efad api: Define constants for address families
To call some gRPC APIs, it is required to specify the address family
value which is combined value of AFI and SAFI values, so users of gRPC
APIs need to calculate this value.

This patch introduces the constants for the address families for the
convenience.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-16 09:59:45 +09:00
IWASE Yusuke b54aa7fc46 api/grpc_server: Remove redundant loop for gRPC server
gRPC server should try to start serving only once because it send
stopped signal to the waiter if server could not start.

This patch removes redundant "for" loop to improve code inspection
result.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-13 11:20:07 +09:00
IWASE Yusuke e6a7cfd762 api/grpc_server: Avoid name collision "server"
To improve code inspection result, this patch renames "server"
variables in NewServer() to "s" because "server" collides the
imported package name "github.com/osrg/gobgp/server".

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-13 11:20:07 +09:00
IWASE Yusuke 9f330e6609 api/grpc_server: Use make() for an empty slice declaration
To improve code inspection result, this patch uses make() for an empty
slice declaration instead of using empty literal initializer.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-13 11:20:07 +09:00
IWASE Yusuke e984c6902d api/grpc_server: Avoid index error when invalid set-med value
Currently, with a invalid "set-med" value in a policy action, GoBGP will
raise panic of "index out of range" because the unmatched regular
expression is not handled.

This patch fixes to handle errors during parsing the given med value.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-13 11:20:07 +09:00
IWASE YusukeandFUJITA Tomonori ab8ba077e5 cli: Support address families when adding neighbor
Currently, "gobgp" command does not support to configure address families
capability when adding a new neighbor.

This patch introduces a new option field to "gobgp neighbor add" command
and enables to configure address families capability.

Example: Specify address family names in comma separated format
$ gobgp neighbor add 10.0.0.3 as 65003 family ipv4-unicast,l2vpn-evpn
$ gobgp neighbor 10.0.0.3
...(snip)...
  Neighbor capabilities:
    multiprotocol:
        ipv4-unicast:   advertised
        l2vpn-evpn:     advertised
    route-refresh:      advertised
    4-octet-as: advertised
...(snip)...

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-12 13:57:11 +09:00
IWASE YusukeandFUJITA Tomonori d8a897a0dd Fix some typos found by spell checker
Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-01 21:56:21 +09:00
IWASE YusukeandFUJITA Tomonori 36786073c1 api: Enable to set/get add-paths config via gRPC
Signed-off-by: IWASE Yusuke <[email protected]>
2017-10-03 14:53:44 +09:00
IWASE Yusuke 9b278ba79b api: GetPath API alternative to GetRib
With the extremely large RIBs, GetRib gRPC API hits the limits of each
message size, because this API is using simple request/response RPC.

This patch introduces a new API GetPath which using streaming RPC and
can retrieve RIBs even if extremely large.

Note: GetRib can be replaced with GetPath and obsoleted in the future.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-09-25 15:30:16 +09:00
FUJITA Tomonori 9c61711a5c api: increase the max of grpc message size
by default, 4mb, too small, easily hit the limit:

https://github.com/osrg/gobgp/issues/1430

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-09-15 08:00:54 +09:00
IWASE Yusukeandfujita bb7d2f2541 config: Introduce Family field into AfiSafiState
To reduce the translations of "AfiSafiName" into "bgp.RouteFamily", this
patch introduces "Family" field into "AfiSafiState" and stores the
translated value.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-09-14 09:22:04 +09:00
Eiichiro WatanabeandFUJITA Tomonori d92d319931 gobgp: support local-rib/all option in command "gobgp bmp add" 2017-08-29 18:38:33 +09:00
FUJITA Tomonori 0719619767 table: allocate bitmap for path id dynamically
allocating 256 bytes per prefix isn't a good idea. Let's allocate 8
bytes by default and expand dynamically if necessary.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-08-02 00:16:33 +09:00
FUJITA Tomonori 4381055dae api: change the license of gobgp.proto from Apache to MIT
To make it easier for other projects to include gobgp.proto file,
let's use more permissive license, MIT.

[skip ci]

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-07-26 14:37:46 +09:00
FUJITA Tomonori d712de0dc6 api: add addpath support to AddPath API and cli
$gobgp global rib add 10.0.0.0/24 identifier 20

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-07-26 08:09:02 +09:00
FUJITA Tomonori 22772c0e62 add LocalPathIdentifier
add-path support needs two identifiers, remote (rx) and local
(tx). The remote identifiers are assigined by remote peers, the local
ones are assigned by gobgpd itself.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-07-26 08:09:02 +09:00
Satoshi Fujimoto c7ff8580f7 cli: get detailed RPKI information
This patch adds the feature in the neighbor subcommand
to get detailed information about RPKI validation.
The command receives a prefix in Adj-RIB-In,
and gives the detailed RPKI information for the route.
The informaton includes the validation status, the reason if it is invalid,
and matched/unmatched VRPs.

Example:
$ gobgp neighbor 172.17.0.3 adj-in 2.1.0.0/16 validation
Target Prefix: 2.1.0.0/16, AS: 65001
  This route is invalid  reason: as
  No VRP ASN matches the route origin ASN.
  Matched VRPs:
    No Entry
  Unmatched AS VRPs:
    Network            AS     MaxLen
    2.0.0.0/12         3215   16
    2.1.0.0/16         3215   16
  Unmatched Length VRPs:
    No Entry

Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-07-19 09:44:20 +09:00
Satoshi Fujimoto 1aa5bf7f21 table: Include detailed information about RPKI in originInfo
Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-07-19 09:44:20 +09:00
Satoshi Fujimoto 810ba2f791 api: Add RPKI detailed information structure
Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-07-19 09:44:20 +09:00
Wataru IshidaandFUJITA Tomonori 87f0b0bdc5 api/cli: support showing path-identifier
$ gobgp neighbor <neighbor address>
ID  Network              Next Hop             AS_PATH              Age        Attrs
2   10.0.0.10/32         10.10.1.2                                 01:05:35   [{Origin: i} {LocalPref: 100}]
1   10.0.0.10/32         10.10.1.1                                 01:05:35   [{Origin: i} {LocalPref: 100}]
3   10.1.0.10/32         10.10.1.3                                 01:05:35   [{Origin: i} {LocalPref: 100}]

Signed-off-by: Wataru Ishida <[email protected]>
2017-07-04 15:02:10 +09:00
IWASE YusukeandFUJITA Tomonori 0111219af1 api: Enable to compose AfiSafi message structure
Signed-off-by: IWASE Yusuke <[email protected]>
2017-06-26 14:21:57 +09:00
IWASE YusukeandFUJITA Tomonori f257609804 api: Introduce AfiSafi message structure in Peer
Signed-off-by: IWASE Yusuke <[email protected]>
2017-06-26 14:21:57 +09:00
Satoshi Fujimoto d75edf18d7 server: Support Dynamic Neighbor
Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-06-16 15:53:18 +09:00
Satoshi Fujimoto be2524ee3e config: Use State to get NeighborAddress instead of Config
By introducing dynamic neighbor feature,
GoBGP can have dynamic neighbors,
and corresponding Config.NeighboAddress can be empty.

This patch sets State.NeighborAddress for all neighbors,
and gets the neighbor's address from them.

Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-06-16 09:09:47 +09:00
FUJITA Tomonori 83684d5e62 api: add graceful restart support to AddNeighbor API
Signed-off-by: FUJITA Tomonori <[email protected]>
2017-06-12 12:53:14 +09:00
FUJITA Tomonori d65df0b045 replace github.com/Sirupsen/logrus with github.com/sirupsen/logrus
The usage of "github.com/sirupsen/logrus" is recommended.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-06-07 21:04:11 +09:00
IWASE Yusukeandfujita c28f127f5f bgp: Advertise IPv4 routes with IPv6 Next Hop
RFC5549 allows IPv6 Next Hop address for the advertisement of IPv4
related NLRIs for <AFI/SAFI> of <1/1>, <1/2>, <1/4> and <1/128>.
Currently, the advertisement using the MP_REACH_NLRI is supported,
but IPv4 routes with IPv6 Next Hop is not enough.

This patch enable to advertise IPv4 routes for <AFI/SAFI> of <1/1>
through GoBGP CLI command.
e.g.)
  $ gobgp global rib add -a ipv4 10.2.1.0/24 nexthop 2001:2::1

Signed-off-by: IWASE Yusuke <[email protected]>
2017-05-15 15:14:24 +09:00
Wataru Ishida 9b9a65d410 *: support replace-peer-as (aka as-override)
we use the term replace-peer-as instead of as-override
since openconfig is using it.

cli

```
$ gobgp n add <neighbor-addr> as <asn> replace-peer-as
```

config

```
neighbor:
  config:
    peer-as: <asn>
    neighbor-address: <neighbor-addr>
  as-path-options:
    config:
      replace-peer-as: true
```

Signed-off-by: Wataru Ishida <[email protected]>
2017-05-10 08:15:00 +00:00
Wataru Ishida 1f053c25c4 *: support remove private as
cli

```
$ gobgp n add <neighbor-addr> as <asn> remove-private-as (all|replace)
```

config

```
neighbor:
  config:
    peer-as: <asn>
    neighbor-address: <neighbor-addr>
    remove-private-as: all
```

Signed-off-by: Wataru Ishida <[email protected]>
2017-05-10 08:05:47 +00:00
ISHIDA Wataru 0f62519cd7 server: ignore routes when local AS is in AS_PATH
RFC4271 9.1.2 Phase 2: Route Selection

If the AS_PATH attribute of a BGP route contains an AS loop, the BGP
route should be excluded from the Phase 2 decision function.  AS loop
detection is done by scanning the full AS path (as specified in the
AS_PATH attribute), and checking that the autonomous system number of
the local system does not appear in the AS path.  Operations of a BGP
speaker that is configured to accept routes with its own autonomous
system number in the AS path are outside the scope of this document.

Also this commit adds support for allow-own-as option to relax this.

Signed-off-by: ISHIDA Wataru <[email protected]>
2017-05-09 11:10:45 -04:00
Wataru IshidaandFUJITA Tomonori 485b882440 api: fix api/server struct conversion
convert default in/import/export policy type
remove remote-private-as, send-community since we are not using them

Signed-off-by: Wataru Ishida <[email protected]>
2017-05-09 02:52:29 -07:00
Wataru Ishida 86d9587f75 cli: speed up showing a specific defined-set
Signed-off-by: Wataru Ishida <[email protected]>
2017-05-06 09:30:10 -04:00
FUJITA Tomonori 7fc7956946 improve performance of getting single neighbor information
avoid calculation of the number of adjout that will not be used.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-04-20 15:31:27 +09:00
FUJITA Tomonori 86d709fa3f cli: show neighbor max prefix config
fix NewNeighborFromAPIStruct() regression.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-04-18 13:57:39 +09:00
ISHIDA WataruandFUJITA Tomonori bba54bdaa1 skip asn negotiation for BGP unnumbered peers
since BGP unnumbered peers are typically trusted, skip asn negotiation
for easy configuration.

from configuration file:

```toml
[[neighbors]]
[[neighbors.config]]
neighbor-interface = "eth0"
```

from cli:

```
$ gobgp neighbor add interface eth0
```

Signed-off-by: ISHIDA Wataru <[email protected]>
2017-04-04 22:07:46 +09:00
FUJITA Tomonori 448160257e table: handle IPv4-Mapped IPv6 Address as v6
Currently, Prefix structure wrongly handles IPv4-Mapped IPv6 Address
as v4.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-03-19 23:31:48 +09:00
IWASE Yusuke 59ec403de7 config: Config values for Nexthop Tracking with ZClient
For configuring the Nexthop Tracking features with ZClient, this patch
adds the config values:
 - "nexthop-trigger-enable" enables to the Nexthop Tracking features.
   Please note this features is only available with version 3 or later,
   and "true" by the default with that version.
 - "nexthop-trigger-delay" specifies the delay sec to update the
   nexthops triggered by the events from Zebra daemon. The default is
   5 secs and the same with the default of Cisco's routers.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-03-06 11:11:54 +09:00
IWASE Yusuke c06423e60b cli: Enable to get nexthop reachability state
This patch enables GoBGP CLI to get the best path based on the nexthop
reachability state.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-03-06 11:11:54 +09:00
ISHIDA WataruandFUJITA Tomonori 9a45ed09b0 cli: add current option to monitor commands
Signed-off-by: ISHIDA Wataru <[email protected]>
2017-02-15 00:10:15 +09:00
ISHIDA WataruandFUJITA Tomonori 52356c26f8 server: add a current option to WatchBestPath()
also, use it for zebra integration

Signed-off-by: ISHIDA Wataru <[email protected]>
2017-02-15 00:10:15 +09:00
IWASE YusukeandFUJITA Tomonori 64360afd45 cli: Administrative Shutdown Communication on disable neighbor
This patch adds "--reason" option support into the disable neighbor command
which can specify "Administrative Shutdown Communication" on the BGP Cease
NOTIFICATION message.

Usage:
  $ gobgp neighbor <neighbor address> disable --reason "some messages"

Signed-off-by: IWASE Yusuke <[email protected]>
2017-02-03 22:47:34 -08:00
IWASE YusukeandFUJITA Tomonori 1063bcab1e cli: Communication on Administrative Shutdown NOTIFICATION
This patch enable to send an arbitrary message on the Cease NOTIFICATION
message with "Administrative Shutdown" and "Administrative Reset" subcodes
with "--reason" option.

Usage:
  $ gobgp neighbor <neighbor address> shutdown --reason "some messages"
  $ gobgp neighbor <neighbor address> reset --reason "some messages"

Reference: https://tools.ietf.org/html/draft-ietf-idr-shutdown-04

Signed-off-by: IWASE Yusuke <[email protected]>
2017-02-03 22:47:34 -08:00
Wataru Ishida bb42a6832f api: add a UUID field to Path structure
Signed-off-by: Wataru Ishida <[email protected]>
2017-01-22 00:37:58 -05:00
ISHIDA WataruandFUJITA Tomonori 10b91fbb3f api: check grpc request is not nil
Signed-off-by: ISHIDA Wataru <[email protected]>
2016-11-06 02:36:22 +09:00
Hiroshi Yokoi ae496021e0 policy: allow using invert condition in statement
Signed-off-by: Hiroshi Yokoi <[email protected]>
2016-12-14 15:28:37 -08:00
Hiroshi YokoiandFUJITA Tomonori 2c66865d5e policy: ext-community and large-community can be included in conditions
Signed-off-by: Hiroshi Yokoi <[email protected]>
2016-12-10 07:51:20 -08:00
Wataru IshidaandFUJITA Tomonori cbf72956de server: don't assume (*api.Path).Nlri is ipv4 NLRI
use (*api.Path).Family to decide how to decode (*api.Path).Nlri

closes #1185

Signed-off-by: Wataru Ishida <[email protected]>
2016-12-10 06:55:36 -08:00
kishiguroandFUJITA Tomonori 499a5fd6c3 client: AddNeighbor API doesn't include apply-policy information 2016-12-04 19:41:41 -08:00