summaryrefslogtreecommitdiffhomepage
path: root/server/fsm.go
AgeCommit message (Collapse)Author
2015-06-10server: use write deadlineFUJITA Tomonori
Seems that write() is blocked forever when a connection is not cleanly closed. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-10server: clean up sendMessageloopFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-06-09server: kill peerMsgFUJITA Tomonori
Peers send and receive messages via channels, which could lead to a deadlock. With this patch, multiple goroutines are used for network I/Os per peer but one goroutine handle all ribs (including the global rib). So there is no messages via channels between peers. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-05-12server: add logging about peer up/downFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-05-12fsm: fix homemade readAll()FUJITA Tomonori
Fix a received data corruption bug when a partial read happens. Let's use io.ReadFull() rather than the homemade one. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-05-11server: fix FSMHandler's holdTimer raceFUJITA Tomonori
FSMHandler's holdTimer could be accessed by rx goroutine before it's initialized. Let's use channel rather than sharing time.Timer pointer. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-05-10api/gobgp: show multiprotocol capabilities in detailISHIDA Wataru
/home/vagrant% gobgp -u 192.168.10.4 neighbor 192.168.10.2 BGP neighbor is 192.168.10.2, remote AS 65001 BGP version 4, remote router ID 192.168.10.2 BGP state = BGP_FSM_ESTABLISHED, up for 00:12:57 BGP OutQ = 0, Flops = 0 Neighbor capabilities: MULTIPROTOCOL(IP,UNICAST): advertised MULTIPROTOCOL(L2VPN,EVPN): advertised MULTIPROTOCOL(IP,ENCAP): advertised MULTIPROTOCOL(IP,ROUTE_TARGET_CONSTRTAINS): received ROUTE_REFRESH: advertised FOUR_OCTET_AS_NUMBER: advertised and received Message statistics: Sent Rcvd Opens: 1 1 Notifications: 0 0 Updates: 0 0 Keepalives: 26 26 Route Refesh: 0 0 Discarded: 0 0 Total: 27 27 Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-05-08server: keepalive interval should be honor a negotiated hold timeFUJITA Tomonori
If a negotiated hold time is smaller than a configured hold time, we use one third of the negotiated hold time for a keepalive interval. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-25server: support active connectionISHIDA Wataru
md5 auth is not supported yet for active conntion Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-03-14server: fix handing of a connection closed by peerFUJITA Tomonori
When a peer closed a connection (e.g. after we send a notification), rx goroutine finds it immediately since read() returns an error and kills tomb. The problem is that tx goroutine doesn't check if tomb Dying() so tx doesn't die until tx tries to write keepalive to the socket (and it doesn't never happen if keepalive interval is zero). So fsm does't become idle shortly. This fixes tx to check Dying() and makes sure that it sends notification messages befor dying if they exists. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-08server: support multiple route familes per peerFUJITA Tomonori
You can configure like the following: [Global] As = 65032 RouterId = "192.168.255.1" [[NeighborList]] NeighborAddress = "10.0.255.1" PeerAs = 65001 [NeighborList.RouteServer] RouteServerClient = true [[NeighborList.AfiSafiList]] AfiSafiName = "ipv4-unicast" [[NeighborList.AfiSafiList]] AfiSafiName = "ipv6-unicast" Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-03update the whole code for the latest openconfig yang filesFUJITA Tomonori
The modified openconfig yang files are available at: https://github.com/osrg/yang/tree/gobgp Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-03-03config: remove time.Time in BgpNeighborCommonStateTypeFUJITA Tomonori
This is part of work to remove time.Time in bgp_config.go since no nice way to represent time.Time with yang. We replace time.Time with int64. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-25server: avoid duplicated logging (debug and warning) for notification messageFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-25server: warning when sending notification messageFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-25server: handle closed passiveConnCh channelFUJITA Tomonori
When a peer is deleted, passiveConnCh is closed implicitly. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-18server: clean up zero holdtimeFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-17peer: support hold time 0Hiroshi Yokoi
2015-02-16server: check the bgp message length before sendingFUJITA Tomonori
if the length is over 4096, the message will be dropped. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-16peer: support enable/disableHiroshi Yokoi
2015-02-16server: support discarded countersFUJITA Tomonori
fujita@ubuntu:~/git/gobgp$ ./cli/gobgpcli show neighbor 10.0.255.7 BGP neighbor is 10.0.255.7, remote AS 65070 BGP version 4, remote router ID 192.168.0.7 BGP state = BGP_FSM_ACTIVE, up for 0:00:01.982115 BGP OutQ = 0, Flops = 4 Neighbor capabilities: MULTIPROTOCOL: advertised and received ROUTE_REFRESH: advertised FOUR_OCTET_AS_NUMBER: advertised and received Message statistics: Sent Rcvd Opens: 4 4 Notifications: 4 0 Updates: 8 0 Keepalives: 4 4 Route Refesh: 0 0 Discarded: 0 4 Total: 20 12 Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-02-08server: always log when sending notificaitonFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-29server: verify OpenMessageFUJITA Tomonori
- BGP version (must be 4) - AS number - holdtime (0 or 3 <= or <= 65535) Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-26fsm: check hold timer expiration and add test case for holdtimer expiration ↵Hiroshi Yokoi
at Established state Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-18server: make sure peer always read from acceptedConnChFUJITA Tomonori
When acceptedConnCh is full, the server goroutine will be blocked. It's not good even eventually the goroutine will run. This situation happens only with buggy bgp speaerk peers. But let's avoid this anyway. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-18server: fix 'deleted config' raceFUJITA Tomonori
When a config is deleted, goroutine for FSMHandler.h.Dying becomes active. sendMessageloop must send notifcation before dying. So it should not check Dying(). After sending notificaiton, it closes the conneciton and return. It makes sure that rx goroutine will die too. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-18server: support idlehold time after resetFUJITA Tomonori
After resetting a peer, the peer will remain idle for idlehold time (by default 30 seconds). It can be configured via IdleHoldTImeAfterReset. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-18server: move outgoing and incoming channels to FSMHandlerFUJITA Tomonori
This patch solves the problem that old messages in outgoing will be sent in a new established session. Peer goroutine puts some messagages in the outgoing channel. Then the state changes from established. In such case, once the state becomes established, the "stale" messages in the outgoing channel will be sent. With this patch, new outgoing and incoming channels are created at every state change. No more "stale" messages in the channles. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-16server: handle over 4096 byte size messageFUJITA Tomonori
send notification. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-16packet: handle malformed BGP HeaderFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-16api: add reset and shutdown supportFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-15server: fix a bug that conneciton is closed before sending notificationFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-14server: close the connection after sending notificationFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-12server: fix recvMessageloop() error handlingFUJITA Tomonori
We could get errors from Read(). Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-11packet: rename PacketParseError to MessageErrorFUJITA Tomonori
Handle not only parsing error. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-11packet: add data length check and notificationHiroshi Yokoi
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-09server: fix MessageStateUpdate UsageFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-08server: clean up logging messagesFUJITA Tomonori
Use Fields. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-07server: dump bgp message with peer addresssFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-03server: merge eventCh and incoming channelsFUJITA Tomonori
We need the order of events on two channles so this patch merges two channels. For example, we need to get received OpenMessage before moving to establish state. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-01server: clean up channel usage for network IOFUJITA Tomonori
- use peer.incoming channel directly. - remove state checking for outgoing messages since peer.go does. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2015-01-01server: move peerInfo to peer.go from fsm.goFUJITA Tomonori
No good reason to keep peerInfo in fsm.go Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-12-31server: handle peer not capable of four byte AS numberFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-12-27RouteFamily cleanupFUJITA Tomonori
RouteFamily is defined in two files. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-12-27support IPv6_UC route familyFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-12-25server: update state and counter properlyFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-12-23packet: define FSMStateFUJITA Tomonori
Then we can use stringer nicely. Now FSMstate shows nicely like: DEBU[0081] Peer (10.0.0.1) state changed from BGP_FSM_ACTIVE to BGP_FSM_OPENSENT Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-12-22add --log-json command line optionFUJITA Tomonori
During development, it's easy to parse a plain format by human. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-12-22server: use logger instead of stdoutFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2014-12-21server: conver PEER_MSG_PATH to bgp updateFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>