diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-04-27 09:45:42 +0000 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-04-27 10:32:39 +0000 |
commit | f99362e876873ebab5bcfa8a9e88e65200a9bac1 (patch) | |
tree | e26599591299f84e7001836694194d19a50356f4 /server/server.go | |
parent | f6c70e980d41066df51ce8cf63f2351911391e47 (diff) |
config: make listen config struct aligned with open-config model
have config/state container
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/server/server.go b/server/server.go index bed5029f..4d0d5308 100644 --- a/server/server.go +++ b/server/server.go @@ -1590,10 +1590,8 @@ func (server *BgpServer) handleModConfig(grpcReq *GrpcRequest) error { b := &config.BgpConfigSet{ Global: config.Global{ Config: config.GlobalConfig{ - As: g.As, - RouterId: g.RouterId, - }, - ListenConfig: config.ListenConfig{ + As: g.As, + RouterId: g.RouterId, Port: g.ListenPort, LocalAddressList: g.ListenAddresses, }, @@ -1620,10 +1618,10 @@ func (server *BgpServer) handleModConfig(grpcReq *GrpcRequest) error { return fmt.Errorf("gobgp is already started") } - if c.ListenConfig.Port > 0 { + if c.Config.Port > 0 { acceptCh := make(chan *net.TCPConn, 4096) - for _, addr := range c.ListenConfig.LocalAddressList { - l, err := NewTCPListener(addr, uint32(c.ListenConfig.Port), acceptCh) + for _, addr := range c.Config.LocalAddressList { + l, err := NewTCPListener(addr, uint32(c.Config.Port), acceptCh) if err != nil { return err } @@ -1733,8 +1731,8 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { Data: &api.Global{ As: g.Config.As, RouterId: g.Config.RouterId, - ListenPort: g.ListenConfig.Port, - ListenAddresses: g.ListenConfig.LocalAddressList, + ListenPort: g.Config.Port, + ListenAddresses: g.Config.LocalAddressList, MplsLabelMin: g.MplsLabelRange.MinLabel, MplsLabelMax: g.MplsLabelRange.MaxLabel, }, @@ -2312,7 +2310,7 @@ func (server *BgpServer) handleAddNeighbor(c *config.Neighbor) ([]*SenderMsg, er return nil, fmt.Errorf("Can't overwrite the exising peer: %s", addr) } - if server.bgpConfig.Global.ListenConfig.Port > 0 { + if server.bgpConfig.Global.Config.Port > 0 { for _, l := range server.Listeners(addr) { SetTcpMD5SigSockopts(l, addr, c.Config.AuthPassword) } |