summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-09-17 15:53:21 +0900
committerHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-09-17 18:41:18 +0900
commit0aa37e5e2487e566e6c2fbf377d8665722f40c05 (patch)
tree290736faff5d160a1591a5238c706a162fab9afd
parent033c56a6110907759108951910ba0ab85a6ccd85 (diff)
server: get zebra conf from file
Signed-off-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
-rw-r--r--gobgpd/main.go13
-rw-r--r--server/server.go12
-rw-r--r--zebra/zapi.go2
3 files changed, 12 insertions, 15 deletions
diff --git a/gobgpd/main.go b/gobgpd/main.go
index 0fcfddf6..15c5e940 100644
--- a/gobgpd/main.go
+++ b/gobgpd/main.go
@@ -42,8 +42,6 @@ func main() {
UseSyslog string `short:"s" long:"syslog" description:"use syslogd"`
Facility string `long:"syslog-facility" description:"specify syslog facility"`
DisableStdlog bool `long:"disable-stdlog" description:"disable standard logging"`
- EnableZapi bool `short:"z" long:"enable-zapi" description:"enable zebra api"`
- ZapiURL string `long:"zapi-url" description:"specify zebra api url"`
CPUs int `long:"cpus" description:"specify the number of CPUs to be used"`
}
_, err := flags.Parse(&opts)
@@ -157,17 +155,6 @@ func main() {
grpcServer := server.NewGrpcServer(server.GRPC_PORT, bgpServer.GrpcReqCh)
go grpcServer.Serve()
- if opts.EnableZapi == true {
- if opts.ZapiURL == "" {
- opts.ZapiURL = "unix:/var/run/quagga/zserv.api"
- }
- err := bgpServer.NewZclient(opts.ZapiURL)
- if err != nil {
- log.Error(err)
- os.Exit(1)
- }
- }
-
var bgpConfig *config.Bgp = nil
var policyConfig *config.RoutingPolicy = nil
for {
diff --git a/server/server.go b/server/server.go
index 9861ee7b..78744db2 100644
--- a/server/server.go
+++ b/server/server.go
@@ -167,6 +167,16 @@ func (server *BgpServer) Serve() {
}
}
+ if g.Zebra.Enabled == true {
+ if g.Zebra.Url == "" {
+ g.Zebra.Url = "unix:/var/run/quagga/zserv.api"
+ }
+ err := server.NewZclient(g.Zebra.Url)
+ if err != nil {
+ log.Error(err)
+ }
+ }
+
senderCh := make(chan *SenderMsg, 1<<16)
go func(ch chan *SenderMsg) {
for {
@@ -238,7 +248,7 @@ func (server *BgpServer) Serve() {
var zapiMsgCh chan *zebra.Message
if server.zclient != nil {
- zapiMsgCh = server.zclient.Recieve()
+ zapiMsgCh = server.zclient.Receive()
}
for {
var firstMsg *SenderMsg
diff --git a/zebra/zapi.go b/zebra/zapi.go
index d3e6abf0..da0c9e94 100644
--- a/zebra/zapi.go
+++ b/zebra/zapi.go
@@ -263,7 +263,7 @@ func readAll(conn net.Conn, length int) ([]byte, error) {
return buf, err
}
-func (c *Client) Recieve() chan *Message {
+func (c *Client) Receive() chan *Message {
return c.incoming
}