152 Commits
Author SHA1 Message Date
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 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
LamannaandFUJITA Tomonori 52a0f71987 Fix RouteDistinguisher parsing and VPNV6 VRF rib parsing 2017-06-01 12:46:40 +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
Tatsushi DemachiandFUJITA Tomonori ae1da6974a table: Advertise local-pref set by import policy
At importing a path from an external peer, LOCAL_PREF can be set by an
import policy but at exporting a best path to an internal peer, this
learned, calculated LOCAL_PREF is never used and every time overwritten
by a default value 100.

According to RFC 4271 "5.1.5. LOCAL_PREF" and "9.1.1. Phase 1:
Calculation of Degree of Preference", the learned value should be
advertised to other internal peers.

This fixes it by just removing resetting a non-local path's LOCAL_PREF
by the default value.
2017-05-10 15:32:44 +09:00
FUJITA Tomonori 738c350a67 server: avoid unnecessary path clone with route server
Signed-off-by: FUJITA Tomonori <[email protected]>
2017-04-27 16:00:54 +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
ISHIDA WataruandFUJITA Tomonori 6f102593b7 table: handle paths with IPv4 NLRI and IPv6 nexthop properly
when a path has IPv4 NLRI and IPv6 nexthop, handle it in MPBGP manner.
(use mp-reach-nlri path attribute instead of nexthop path attibute)

Signed-off-by: ISHIDA Wataru <[email protected]>
2017-04-04 22:07:46 +09:00
ISHIDA WataruandFUJITA Tomonori 6d55ba613a table: fix bug of UpdatePathAttrs() with ipv6 link-local peer
config.Neighbor.Transport.State.LocalAddress may have zone info and
not be valid ip address format.
Use PeerInfo.LocalAddress instead.

Signed-off-by: ISHIDA Wataru <[email protected]>
2017-04-04 22:07:46 +09:00
IWASE Yusuke afcc164d9c table/path: Enable to stringify nexthop reachability
Signed-off-by: IWASE Yusuke <[email protected]>
2017-03-06 09:12:23 +09:00
IWASE Yusuke b10794afcd table: Evaluate best path based on nexthop reachability
For BGP Nexthop Tracking, this patch enables table package to evaluate
the best path based on the nexthop reachability which validated by IGB.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-03-06 09:12:23 +09: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
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
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
Wataru IshidaandFUJITA Tomonori 614746ca11 *: support long lived graceful restart
Signed-off-by: Wataru Ishida <[email protected]>
2016-10-09 07:18:13 -07:00
FUJITA Tomonori d79b23967a server: add vrf support to bestpath watch
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-09-30 20:44:12 -07:00
Wataru Ishida c790472dad server/table: don't modify/delete path attributes for route server client
RFC7947 2.2 says

Optional recognized and unrecognized BGP attributes, whether transitive
or non-transitive, SHOULD NOT be updated by the route server
(unless enforced by local IXP operator configuration) and SHOULD be passed
on to other route server clients

Signed-off-by: Wataru Ishida <[email protected]>
2016-09-16 09:45:24 +00: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
Peng XiaoandFUJITA Tomonori b0bead46c8 fixed some misspell error
Signed-off-by: Peng Xiao <[email protected]>
2016-08-21 08:29:42 +09:00
FUJITA Tomonori 43dc07d723 move gRPC-related code for REQ_ADD_PATH and REQ_DELETE_PATH to grpc_server.go
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-07-21 13:23:15 +09:00
FUJITA Tomonori f27afac154 move gRPC-related code in path.go and destination.go to grpc_server.go
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-07-20 04:25:25 +09:00
FUJITA Tomonori b8f83f8ede drop unknown optional non-transitive attributes
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-06-13 20:41:40 +09:00
ISHIDA WataruandFUJITA Tomonori 5c7df67266 server/table: support bgp multipath
This patch adds multiPathList field to watcherEventBestPathMsg and
fills it when global.use-multiple-paths.config.enable = true

Following patches add support injecting multipath to zebra and
monitoring it via gRPC

Signed-off-by: ISHIDA Wataru <[email protected]>
2016-06-06 12:43:20 +09:00
ISHIDA WataruandFUJITA Tomonori 222d4dba8e table: return default value(100) when local-pref attr doesn't exist
Signed-off-by: ISHIDA Wataru <[email protected]>
2016-06-06 12:43:20 +09:00
FUJITA Tomonori ebb2c9727a table: fix to compare new best path with old best path
The current code uses Path.Equal(), which just check out if pathes are
idential. However, it doesn't work for two cloned pathes of a path
(soft update in case).

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-05-29 19:42:47 +09:00
ISHIDA Wataru 0dbf1d87cb policy: add local-pref action
$ gobgp policy statement st01 add action local-pref 110

Signed-off-by: ISHIDA Wataru <[email protected]>
2016-05-25 02:53:42 +00:00
FUJITA Tomonori 7c42e295e2 add collector feature
dump the update messages and the state change of peers into influxdb:

[collector.config]
  url = "http://localhost:8086"
  db-name = "gobgp"

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-05-23 20:32:47 +09:00
ISHIDA WataruandFUJITA Tomonori 31342564c9 table: fix UpdatePathAttrs() to obey RFC4684
Signed-off-by: ISHIDA Wataru <[email protected]>
2016-05-23 09:46:53 +09:00
ISHIDA Wataru 43f3d009d6 server: fix not to modify Transport.Config
modify Transport.State instead

Signed-off-by: ISHIDA Wataru <[email protected]>
2016-04-27 10:32:42 +00:00
ISHIDA WataruandFUJITA Tomonori 2b60347cfd path: improve Path.String()
Signed-off-by: ISHIDA Wataru <[email protected]>
2016-04-20 13:14:09 +09:00
FUJITA Tomonori 311324fab8 move packet/*.go to packet/bgp/*.go for Go's convention
Later, we move non-bgp protocol stuff like mrt under their own
direcotries.

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-03-31 13:19:17 +09:00
ISHIDA Wataru 77f0e6acf1 table: support advertising local route with specified nexthop via eBGP
we support this for iBGP. why not for eBGP.

Signed-off-by: ISHIDA Wataru <[email protected]>
2016-03-15 22:44:14 +09:00
FUJITA Tomonori c46d6be52f table: use raw data for age instead of duration
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-03-02 08:44:39 +09:00
ISHIDA WataruandFUJITA Tomonori a45bd1f290 api: add neighbor-ip field to grpc Path message
Signed-off-by: ISHIDA Wataru <[email protected]>
2016-03-02 03:22:28 -08:00
FUJITA Tomonori d6998affcf cli: delete duplicated code
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-02-29 16:53:01 -08:00
ISHIDA WataruandFUJITA Tomonori 0b78f57ccd config/server: support per-peer asn
you can override `global.config.as` by `neighbor.config.local-as`

Signed-off-by: ISHIDA Wataru <[email protected]>
2016-02-29 15:59:42 -08:00
Naoto HanaueandFUJITA Tomonori a53d194505 ops: fix and integration the attribute name that indicates the route received from an external resource 2016-02-27 03:47:00 -08:00
FUJITA Tomonori ae41a9f07e table: sort path attributes
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-02-25 05:55:28 -08:00
FUJITA Tomonori b387a7b29c cli: sort Flowspec components
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-02-24 04:31:21 -08:00
FUJITA Tomonori 00a592ef3a table: sort Flowspec components
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-02-24 14:13:22 +09:00
Naoto HanaueandFUJITA Tomonori b67befc30a ops: maintenance of two-way route exchange 2016-02-19 21:14:59 -08:00
FUJITA Tomonori 9f54df2208 table: fix gracefull restart regression
eor path needs a filter map. Otherwise gobgpd crashes.

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-02-12 10:18:13 +09:00
ISHIDA WataruandFUJITA Tomonori 023a498e4a server: support graceful-restart helper-speaker behavior
Signed-off-by: ISHIDA Wataru <[email protected]>
2016-02-10 23:41:44 -08:00
ISHIDA WataruandFUJITA Tomonori 36f8911cee table: support sending/receiving EOR msg
Signed-off-by: ISHIDA Wataru <[email protected]>
2016-02-10 22:15:04 -08:00
ISHIDA Wataru c9959836a6 table: add source-asn and source-id to api struct
Signed-off-by: ISHIDA Wataru <[email protected]>
2016-02-07 06:31:48 +09:00
ISHIDA Wataru 21b7301e04 server: fix soft-reset-in to handle in-policy change properly
Signed-off-by: ISHIDA Wataru <[email protected]>
2016-02-01 23:11:12 +09:00
FUJITA Tomonori 1e564f2d30 table: fix NewBitmap's size calculation
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-01-17 06:01:49 -08:00
ISHIDA Wataru 6403c80663 server: reduce number of path.Clone() call to reduce memory footprint
the result of memory profile (500 route-server-clients each of them
advertises 100 routes)

before:
(pprof) top5
3913.02MB of 3978.69MB total (98.35%)
Dropped 148 nodes (cum <= 19.89MB)
Showing top 10 nodes out of 11 (cum >= 21MB)
flat       flat%   sum%        cum   cum%
2970.30MB 74.66% 74.66%  2975.80MB 74.79% github.com/osrg/gobgp/server.filterpath
810.09MB  20.36% 95.02%   810.59MB 20.37% github.com/osrg/gobgp/table.(*AdjRib).Update
115.60MB   2.91% 97.92%   119.10MB  2.99% github.com/osrg/gobgp/table.createUpdateMsgFromPath
10MB       0.25% 98.17%  1878.02MB 47.20% github.com/osrg/gobgp/server.(*BgpServer).propagateUpdate
4.50MB     0.11% 98.29%   144.60MB  3.63% github.com/osrg/gobgp/table.CreateUpdateMsgFromPaths

after:
(pprof) top5
1259.49MB of 1284.27MB total (98.07%)
Dropped 175 nodes (cum <= 6.42MB)
Showing top 10 nodes out of 26 (cum >= 36.51MB)
flat     flat%  sum%        cum   cum%
975.81MB 75.98% 75.98%   976.31MB 76.02% github.com/osrg/gobgp/table.(*AdjRib).Update
198.67MB 15.47% 91.45%   208.17MB 16.21% github.com/osrg/gobgp/table.createUpdateMsgFromPath
22MB      1.71% 93.16%       22MB  1.71% github.com/osrg/gobgp/packet.(*IPAddrPrefix).Serialize
20MB      1.56% 94.72%   707.19MB 55.07% github.com/osrg/gobgp/server.(*BgpServer).propagateUpdate
13.50MB   1.05% 95.77%    13.50MB  1.05% github.com/osrg/gobgp/table.NewPath

Signed-off-by: ISHIDA Wataru <[email protected]>
2016-01-16 18:25:35 +09:00
ISHIDA Wataru 40ce51137a table: remove unnecessary copy of path attributes
the result of memory profile (500 route-server-clients each of them advertises
100 routes)

before:
(pprof) top5
9330.48MB of 9367.53MB total (99.60%)
Dropped 157 nodes (cum <= 46.84MB)
Showing top 10 nodes out of 17 (cum >= 9334.17MB)
flat       flat%   sum%        cum   cum%
6163.04MB 65.79% 65.79%  6163.04MB 65.79% github.com/osrg/gobgp/table.NewPath
1155.05MB 12.33% 78.12%  7302.59MB 77.96% github.com/osrg/gobgp/table.(*Path).Clone
986.31MB  10.53% 88.65%  1388.81MB 14.83% github.com/osrg/gobgp/table.(*AdjRib).Update
402.51MB   4.30% 92.95%   402.51MB  4.30%  fmt.Sprintf
402.51MB   4.30% 97.24%   402.51MB  4.30% net.parseIPv4

after:
(pprof) top
3913.02MB of 3978.69MB total (98.35%)
Dropped 148 nodes (cum <= 19.89MB)
Showing top 10 nodes out of 11 (cum >= 21MB)
flat       flat%   sum%        cum   cum%
2970.30MB 74.66% 74.66%  2975.80MB 74.79% github.com/osrg/gobgp/server.filterpath
810.09MB  20.36% 95.02%   810.59MB 20.37% github.com/osrg/gobgp/table.(*AdjRib).Update
115.60MB   2.91% 97.92%   119.10MB  2.99% github.com/osrg/gobgp/table.createUpdateMsgFromPath
10MB       0.25% 98.17%  1878.02MB 47.20% github.com/osrg/gobgp/server.(*BgpServer).propagateUpdate
4.50MB     0.11% 98.29%   144.60MB  3.63% github.com/osrg/gobgp/table.CreateUpdateMsgFromPaths

Signed-off-by: ISHIDA Wataru <[email protected]>
2016-01-16 18:22:13 +09:00