455 Commits
Author SHA1 Message Date
Satoshi Fujimoto 1c7829604d peer: Check errors in creating Dynamic Peers
Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-06-20 11:24:05 +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 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
Satoshi FujimotoandFUJITA Tomonori 6e9d5b56c4 *: Support Peer-Group Configuration
This patch enables to create peer-groups,
also supports dynamic configuration to peer-groups.

Manually set fields in neighbor configs have priority over its peer-group's config,
except some fields, like "peer-as", or "minimum-advertisement-interval" and so on.

Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-06-05 14:24:45 +09:00
IWASE YusukeandFUJITA Tomonori 1fef6db600 server: Implement event for BGP message watcher
This patch enables to watch events for monitoring received BGP messages
before the state comparison.

Note: Currently, this event nortifies UPDATE message only, because the
other messages will be handled in FSMHandler and not received at
BgpServer, so BgpServer cannot send event for these messages.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-06-03 18:18:23 +09:00
LamannaandFUJITA Tomonori 52a0f71987 Fix RouteDistinguisher parsing and VPNV6 VRF rib parsing 2017-06-01 12:46:40 +09:00
Wataru Ishida 4215941eec server: avoid sending unwanted withdrawals to iBGP peers
when the old best was from iBGP, we don't need to send withdrawals
to iBGP peers.

Signed-off-by: Wataru Ishida <[email protected]>
2017-05-14 07:25:17 -04: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 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 163ac0c327 server: fix handling bgp messages right after moving to idle state from established
currently gobgpd continues to handle update messages even if
becomedidle state from establised.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-04-27 16:17:41 +09: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
ISHIDA Wataru c8cb20e75b policy: send a withdrawal if export policy blocks an existing route
This patch fixes a bug of export policy and implicit withdrawal.

When a path is filtered by export policy, we need to check whether the
old path (implicit withdrawn path) was sent before the new path.
If it has been sent, we need to send a withdrawal message.

Signed-off-by: ISHIDA Wataru <[email protected]>
2017-04-18 07:40:15 +00: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 029852207a server: fix bug of wrongly set <nil> to PeerInfo.LocalAddress
config.TransportState.LocalAddress may have zone info with ipv6 address
like "fe80::x%eth0".
In this case, net.ParseIP() returns <nil>, which leads to set <nil> to
PeerInfo.LocalAddress.

Signed-off-by: ISHIDA Wataru <[email protected]>
2017-04-04 22:07:46 +09:00
hepengandFUJITA Tomonori 1d3225bd29 server: fix GetRib() to handle error properly
fix a bug that GetRib() doesn't return an error even if an error
happens.
2017-04-01 16:08:52 +09:00
IWASE Yusuke adcb9ac2dc server/zclient: Dampening for Nexthop Tracking
This patch implents dampening for the Nexthop Tracking as Cisco's
routers doing.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-03-06 11:23:41 +09:00
IWASE Yusuke 2c35b2446d server/zclient: Update nexthop state based on NEXTHOP_UPDATE
This patch enables server/zclient to update the metric or the reachability
state to the nexthop for implementing the Nexthop Tracking features.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-03-06 11:11:54 +09:00
FUJITA Tomonori ce8b4ee0fa server: fix withdraw with ibgp
with two ibgp peers (a and b), when peer a advertizes one route and
then withdraw it, there are two bugs:

- gobgp sends withdrawal to peer a.
- gobgp sends withdrawal to peer b.

this fixes both.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-03-05 23:11:44 +09:00
FUJITA Tomonori 3c5b07a6c8 server: avoid sending withdraw to peer just sent withdraw
Signed-off-by: FUJITA Tomonori <[email protected]>
2017-03-05 06:10:30 +09:00
FUJITA Tomonori 61890751e1 server: avoid accessing to globalRib before its initialization
Signed-off-by: FUJITA Tomonori <[email protected]>
2017-02-18 13:19:55 +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
Eiichiro Watanabe 7336d9d54f Fix End of RIB handling
- All of EoR except IPv4 unicast have MP_UNREACH only. (RFC4724)
    - length of the MP_UNREACH attr. should be 3bytes.
    - length of the value should be 0bytes.
  - Should send EoR marker in initial exchange of BMP Route Monitoring. (RFC7854)
2017-01-29 17:38:09 +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 Ishida 99ed1e73d7 server: fix a bug of error handling
when using named return for management operations, we need to substitute
the return value of (*BgpServer).mgmtOperation() to a valiable 'err' for
proper error propagation.

close #1215

Signed-off-by: Wataru Ishida <[email protected]>
2017-01-21 23:44:57 -05:00
ISHIDA WataruandFUJITA Tomonori 8798014bd0 server: refactor mgmt operation
Signed-off-by: ISHIDA Wataru <[email protected]>
2016-11-06 02:36:22 +09:00
ISHIDA WataruandFUJITA Tomonori fe486d84e3 server: check server is up before admin operation
Signed-off-by: ISHIDA Wataru <[email protected]>
2016-11-06 02:36:22 +09:00
ksangandFUJITA Tomonori b43326b2e3 GetVrf() cause bgpd panic if it is not started 2017-01-16 04:18:16 -08:00
Wataru IshidaandFUJITA Tomonori 393b7232e7 bmp: don't send paths already sent in case of softresetin happens
Signed-off-by: Wataru Ishida <[email protected]>
2016-12-19 08:50:09 +09:00
Wataru IshidaandFUJITA Tomonori 6dcb1e4ae0 server: notify post policy update when soft-reset-in is triggered
Signed-off-by: Wataru Ishida <[email protected]>
2016-12-19 08:50:09 +09:00
Wataru IshidaandFUJITA Tomonori fff2c32fb4 server: fix bug when global import policy rejects a route
routes rejected by global import policy was not deleted from RIB

Signed-off-by: Wataru Ishida <[email protected]>
2016-12-10 06:51:21 -08:00
Wataru Ishida e4a4b3e382 server: fix bug of deleteNeighbor()
cleaning outgoing channel while fsm handler is running may cause crash

Dec  2 06:14:36 g2 gobgpd[6955]: {"Topic":"Peer","level":"info","msg":"Delete a peer configuration for:10.173.176.211","time":"2016-12-02T06:14:36Z"}
Dec  2 06:14:36 g2 gobgpd[6955]: {"Data":"","Key":"10.173.176.211","Topic":"Peer","level":"warning","msg":"sent notification","time":"2016-12-02T06:14:36Z"}
Dec  2 06:14:36 g2 gobgpd[6955]: {"Key":"10.173.176.211","Reason":"notification-sent code 6(cease) subcode 3(peer deconfigured)","State":"BGP_FSM_ESTABLISHED","Topic":"Peer","level":"info","msg":"Peer Down","time":"2016-12-02T06:14:36Z"}
Dec  2 06:14:36 g2 gobgpd[6955]: panic: interface conversion: interface {} is nil, not *server.FsmOutgoingMsg
Dec  2 06:14:36 g2 gobgpd[6955]: goroutine 69 [running]:
Dec  2 06:14:36 g2 gobgpd[6955]: panic(0xd26200, 0xc82030c4c0)
Dec  2 06:14:36 g2 gobgpd[6955]: /usr/local/go/src/runtime/panic.go:481 +0x3e6
Dec  2 06:14:36 g2 gobgpd[6955]: github.com/osrg/gobgp/server.(*FSMHandler).sendMessageloop(0xc8201a66e0, 0x0, 0x0)
Dec  2 06:14:36 g2 gobgpd[6955]: /usr/local/opt/gopath/src/github.com/osrg/gobgp/server/fsm.go:1136 +0x3c3
Dec  2 06:14:36 g2 gobgpd[6955]: github.com/osrg/gobgp/server.(*FSMHandler).(github.com/osrg/gobgp/server.sendMessageloop)-fm(0x0, 0x0)
Dec  2 06:14:36 g2 gobgpd[6955]: /usr/local/opt/gopath/src/github.com/osrg/gobgp/server/fsm.go:1175 +0x2e
Dec  2 06:14:36 g2 gobgpd[6955]: gopkg.in/tomb%2ev2.(*Tomb).run(0xc8201a66e0, 0xc820278140)
Dec  2 06:14:36 g2 gobgpd[6955]: /usr/local/opt/gopath/src/gopkg.in/tomb.v2/tomb.go:163 +0x21
Dec  2 06:14:36 g2 gobgpd[6955]: created by gopkg.in/tomb%2ev2.(*Tomb).Go
Dec  2 06:14:36 g2 gobgpd[6955]: /usr/local/opt/gopath/src/gopkg.in/tomb.v2/tomb.go:159 +0x131

Signed-off-by: Wataru Ishida <[email protected]>
2016-12-02 02:18:09 -05:00
FUJITA Tomonori daca3cf3bc server: fix Watcher InfiniteChannel leak
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-11-24 14:09:53 +09:00
Wataru Ishida 5d4e9154b0 server: fix memory leak in infinite channel goroutine
infinite channel has internal goroutine which won't stop until all items in
the buffer are dequeued.

Signed-off-by: Wataru Ishida <[email protected]>
2016-11-21 19:41:38 -05: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 24e397b0f6 add go vet test
Signed-off-by: Wataru Ishida <[email protected]>
2016-11-17 21:52:20 -05:00
Wataru Ishida 25fe17c817 client: remove server package dependency
move ROA under table package

Signed-off-by: Wataru Ishida <[email protected]>
2016-11-15 07:03:53 +00:00
FUJITA Tomonori f610dc4422 server: remove adj-out usage
With this change, we could send unncessary messages but it's harmless
(wastefull though).

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-11-12 21:22:25 -08:00
FUJITA Tomonori 4dbfc1bce4 server: remove adj-out usage in filterpath
Preparation for removing in-memory adj-out.

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-11-12 21:22:00 -08:00
FUJITA Tomonori 0ef26666ef table: use old best path instead of withdrawn paths
Preparation for removing in-memory adj-out.

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-11-12 21:21:54 -08:00
Wataru Ishida 4534be2609 server: fix bug of disable/enable/softreset behavior for vrfed neighbor
Signed-off-by: Wataru Ishida <[email protected]>
2016-11-06 07:44:04 +00:00
FUJITA Tomonori b01e402739 allow route reflector client as vrf neighbor
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-11-04 23:50:41 -07:00
Wataru IshidaandFUJITA Tomonori 4bdaf1e64c cli: support adding rr-client and rs-client
$ gobgp neighbor add 10.0.0.1 route-reflector-client
$ gobgp neighbor add 10.0.0.1 route-reflector-client 1.1.1.1
$ gobgp neighbor add 10.0.0.1 route-server-client

Signed-off-by: Wataru Ishida <[email protected]>
2016-11-04 13:20:03 +09: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
FUJITA Tomonori c7653aa9d4 allow add local route with specific mpls label
Also don't allocate label for local routes. The label management needs
to work with other components rather than bgp.

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
FUJITA Tomonori 2ad40c3f1e server: handle management requests quicker under heavy load
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-10-12 12:47:07 +09:00