diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-09-01 13:23:52 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-09-01 13:23:52 +0900 |
commit | f8d437ec0ea65656ca4c6d81ec48fe0f7099c60e (patch) | |
tree | 1992a2151c10f04975438e84d79217dd2fe927ac | |
parent | 920d4752783e0512a76f2bd7711b5810bc7cd460 (diff) |
support multihop ttl
You can enable the feature like the following:
[Neighbors]
[[Neighbors.NeighborList]]
[Neighbors.NeighborList.NeighborConfig]
PeerAs = 65001
NeighborAddress = "10.0.255.1"
[Neighbors.NeighborList.EbgpMultihop]
[Neighbors.NeighborList.EbgpMultihop.EbgpMultihopConfig]
Enabled = true
MultihopTtl = 8
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | server/fsm.go | 12 | ||||
-rw-r--r-- | server/peer.go | 4 |
2 files changed, 7 insertions, 9 deletions
diff --git a/server/fsm.go b/server/fsm.go index 0191f9d3..6c048acd 100644 --- a/server/fsm.go +++ b/server/fsm.go @@ -225,11 +225,6 @@ func (fsm *FSM) connectLoop() error { conn, err := net.DialTimeout("tcp", host, time.Duration(MIN_CONNECT_RETRY-1)*time.Second) if err == nil { - isEBGP := fsm.gConf.GlobalConfig.As != fsm.pConf.NeighborConfig.PeerAs - if isEBGP { - ttl := 1 - SetTcpTTLSockopts(conn.(*net.TCPConn), ttl) - } fsm.connCh <- conn } else { log.WithFields(log.Fields{ @@ -341,6 +336,13 @@ func (h *FSMHandler) active() bgp.FSMState { break } fsm.conn = conn + if fsm.gConf.GlobalConfig.As != fsm.pConf.NeighborConfig.PeerAs { + ttl := 1 + if fsm.pConf.EbgpMultihop.EbgpMultihopConfig.Enabled == true { + ttl = int(fsm.pConf.EbgpMultihop.EbgpMultihopConfig.MultihopTtl) + } + SetTcpTTLSockopts(conn.(*net.TCPConn), ttl) + } // we don't implement delayed open timer so move to opensent right // away. return bgp.BGP_FSM_OPENSENT diff --git a/server/peer.go b/server/peer.go index 80d4d0dc..fef1aa07 100644 --- a/server/peer.go +++ b/server/peer.go @@ -226,10 +226,6 @@ func (peer *Peer) startFSMHandler(incoming chan *fsmMsg) { } func (peer *Peer) PassConn(conn *net.TCPConn) { - if peer.isEBGPPeer() { - ttl := 1 - SetTcpTTLSockopts(conn, ttl) - } select { case peer.fsm.connCh <- conn: default: |