197 Commits
Author SHA1 Message Date
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
Chris StocktonandFUJITA Tomonori 38c47609a2 api: Update the grpc server to accept the local address and remote port from the transport config
This allows using the gobgp/client to send a transport config with a port number.
2016-11-23 05:43:57 -08:00
kishiguroandFUJITA Tomonori 7006ec15fe api: Fix client.AddNeighbor() API does not properly configure AFI/SAFI bug
When we use gRPC API to add neighbor. Even if we specify,
config.Neighbor.AfiSafis parameter, it is ignored in
NewPeerFromConfigStruct(). Adding to that even if we fix the issue,
NewNeighborFromAPIStruct() count Families twice. So resulting neighbor
has duplicated Families configuration. This patch fixed both problems.
2016-11-21 13:42:35 +09:00
FUJITA Tomonori e11b09d7ea server: disable advertised number calculation with multiple neighbors
AdjRibOut isn't in memory so needs to be calculated on the fly.

Doing such for multiple neighbors consumes too much CPU (especially
there are lots of routes).

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-11-18 14:00:51 +09:00
Wataru Ishida 93d1dca70a config: simplify route-disposition configuration
before:

```yaml
actions:
    route-disposition:
        accept-route: true
        reject-route: false
```

after

```yaml
action:
    router-disposition: accept-route
```

Signed-off-by: Wataru Ishida <[email protected]>
2016-11-17 23:22:55 -05:00
Wataru Ishida 1e22e529c9 config/api: create admin-state type
align with session-state

Signed-off-by: Wataru Ishida <[email protected]>
2016-11-14 02:15:47 +00:00
Wataru Ishida c4ced97e76 cli: use client library
Signed-off-by: Wataru Ishida <[email protected]>
2016-11-14 02:15:46 +00:00
Wataru Ishida 3f2dd34d37 client: add golang client library
Signed-off-by: Wataru Ishida <[email protected]>
2016-11-14 02:15:45 +00:00
Wataru Ishida 926ab34220 config: use struct type instead of []byte for capability and open msg
Signed-off-by: Wataru Ishida <[email protected]>
2016-11-14 02:15:35 +00:00
Wataru Ishida b77dc6aa54 policy: fix bug of policy with multiple statements
policy can have multiple statements. In each statement, when condition
is matched, route-action is finally evaluated after actions with mods.
When route-action is 'none', we contine to next statement if it exists.
When route-action is 'accept' or 'reject', we stop proceeding.

This patch fixes a bug that route-action can't be set to 'none' which
means route-action always be set to 'accept' or 'reject' and can't proceed
to the next statement.

Signed-off-by: Wataru Ishida <[email protected]>
2016-11-14 00:58:25 +00:00
Wataru Ishida e4cd6e08f6 bmp: fix wrong monitoring policy type translation
Signed-off-by: Wataru Ishida <[email protected]>
2016-11-05 15:54:52 +00:00
Wataru IshidaandFUJITA Tomonori a17832195c support neighbor belongs to VRF
$ gobgp vrf add red rd 100:100 rt both 100:100
$ gobgp neighbor add 10.0.0.1 as 2 vrf red
$ gobgp vrf red neighbor
Peer     AS  Up/Down State       |#Advertised Received Accepted
10.0.0.1 2   never   Active      |          0        0        0

Signed-off-by: Wataru Ishida <[email protected]>
2016-11-04 13:19:47 +09:00
FUJITA Tomonori be9918a163 remove label allocation completely
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-11-03 02:49:59 -07:00
Wataru Ishida 1f4a3192af cli/api: support getting table summary information
$ gobgp global rib summary -a ipv4
$ gobgp neighbor 10.0.0.1 local summary
$ gobgp neighbor 10.0.0.1 adj-in summary
$ gobgp neighbor 10.0.0.1 adj-out summary

Signed-off-by: Wataru Ishida <[email protected]>
2016-10-16 14:07:06 +00:00
Wataru Ishida d46da74d4f policy: support large-community match/action
close #1133

Signed-off-by: Wataru Ishida <[email protected]>
2016-10-10 05:18:17 +00:00
Vincent BernatandFUJITA Tomonori ddb9303bb5 table: ensure compatibility with archs where int == int32
MED actions are expected to be int64 and AS are expected to be
uint32. Use ParseInt/ParseUint instead of Atoi for those until the tests
pass on ARM.
2016-10-08 06:11:08 -07:00
Chris Stockton 60ebbb99b4 Allow creating a server with a user specified grpc server. 2016-10-04 15:03:44 -07:00
Wataru Ishida 7c8b1973e7 cli: support specifying vrf-id when creating vrf
Signed-off-by: Wataru Ishida <[email protected]>
2016-10-04 05:04:26 +00:00
FUJITA Tomonori dfe1b71fd2 api: add id to VrfRequest
to support VRF ID for Zebra Protocol v3.

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-09-30 05:50:25 -07:00
kishiguroandFUJITA Tomonori 554f309c90 Support of ZAPI version 3 (handles VRF ID). 2016-09-29 16:29:15 -07:00
Wataru IshidaandFUJITA Tomonori 10142c11f9 server/table: fix a bug of vrf route injection
regression due to 43dc07d723

before:
$ gobgp vrf add vrf01 rd 100:100 rt both 100:100
$ gobgp vrf vrf01 rib add 10.0.0.0/24
$ gobgp global rib -a ipv4
    Network      Next Hop  AS_PATH  Age        Attrs
*>  10.0.0.0/24  0.0.0.0            00:00:19   [{Origin: ?} {Extcomms: [100:100]}]

after:
$ gobgp vrf add vrf01 rd 100:100 rt both 100:100
$ gobgp vrf vrf01 rib add 10.0.0.0/24
$ gobgp global rib -a ipv4
Network not in table
$ gobgp global rib -a vpnv4
    Network             Labels     Next Hop  AS_PATH  Age        Attrs
*>  100:100:10.0.0.0/24 [16000]    0.0.0.0            00:00:19   [{Origin: ?} {Extcomms: [100:100]}]

Signed-off-by: Wataru Ishida <[email protected]>
2016-09-13 00:49:17 -07:00
FUJITA Tomonori eef1fc0a75 add RemoteRouterId to config.NeighborState
Stop using config.NeighborState's Description in a hacky way for the
remote Router Id.

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-08-26 18:15:03 +09:00
FUJITA Tomonori 982a5b448f zebra: add grpc api
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-08-26 17:29:38 +09:00
Wataru IshidaandFUJITA Tomonori 26c232f2c4 api: publish ToPathApi(*table.Path)
Signed-off-by: Wataru Ishida <[email protected]>
2016-08-25 15:53:14 +09:00
Wataru IshidaandFUJITA Tomonori 3235c0618c api/cli: kill cmd package custom path/destination structs
reuse table package

Signed-off-by: Wataru Ishida <[email protected]>
2016-08-25 15:53:14 +09:00
Wataru IshidaandFUJITA Tomonori b3c874da25 server/api: fix GetRib API to return sorted destination
the feature has been broken.

Signed-off-by: Wataru Ishida <[email protected]>
2016-08-25 15:53:14 +09:00
Wataru Ishida 430a4f93e8 api: enable to set/get UseMultiplePaths global setting
Signed-off-by: Wataru Ishida <[email protected]>
2016-08-21 07:17:34 +00:00
ISHIDA WataruandFUJITA Tomonori cd4b0107c3 policy: support route-type condition
// match with routes locally generated
$ gobgp policy statement s0 add condition route-type local

// match with routes received from eBGP peers
$ gobgp policy statement s0 add condition route-type external

// match with routes received from iBGP peers
$ gobgp policy statement s0 add condition route-type internal

Signed-off-by: ISHIDA Wataru <[email protected]>
2016-08-17 21:23:08 +09:00
ISHIDA Wataru 0a9375a40e api: support address family filtering of MonitorRib API
the feature was somehow dropped

Signed-off-by: ISHIDA Wataru <[email protected]>
2016-08-16 03:47:03 +00:00