summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorkishiguro <ishi@hash-set.com>2016-09-28 12:09:45 -0700
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-09-29 16:29:15 -0700
commit554f309c9020fa580b7ae74766b069a7ae095444 (patch)
tree1f99f9d92041c2bd5d6efec28ccf2a9add5656b2 /server
parentdb3dbd7257836521fdab3d41b57dd5f73ed30baf (diff)
Support of ZAPI version 3 (handles VRF ID).
Diffstat (limited to 'server')
-rw-r--r--server/server.go2
-rw-r--r--server/zclient.go14
2 files changed, 8 insertions, 8 deletions
diff --git a/server/server.go b/server/server.go
index befe1e53..65b23ce8 100644
--- a/server/server.go
+++ b/server/server.go
@@ -889,7 +889,7 @@ func (s *BgpServer) StartZebraClient(c *config.ZebraConfig) (err error) {
for _, p := range c.RedistributeRouteTypeList {
protos = append(protos, string(p))
}
- s.zclient, err = newZebraClient(s, c.Url, protos)
+ s.zclient, err = newZebraClient(s, c.Url, protos, c.Version)
}
}
return err
diff --git a/server/zclient.go b/server/zclient.go
index 0e20c7f9..ef51d2ce 100644
--- a/server/zclient.go
+++ b/server/zclient.go
@@ -27,7 +27,7 @@ import (
"time"
)
-func newIPRouteMessage(dst []*table.Path) *zebra.Message {
+func newIPRouteMessage(dst []*table.Path, version uint8) *zebra.Message {
paths := make([]*table.Path, 0, len(dst))
for _, path := range dst {
if path == nil || path.IsFromExternal() {
@@ -76,9 +76,9 @@ func newIPRouteMessage(dst []*table.Path) *zebra.Message {
}
return &zebra.Message{
Header: zebra.Header{
- Len: zebra.HEADER_SIZE,
+ Len: zebra.HeaderSize(version),
Marker: zebra.HEADER_MARKER,
- Version: zebra.VERSION,
+ Version: version,
Command: command,
},
Body: &zebra.IPRouteBody{
@@ -179,13 +179,13 @@ func (z *zebraClient) loop() {
msg := ev.(*WatchEventBestPath)
if table.UseMultiplePaths.Enabled {
for _, dst := range msg.MultiPathList {
- if m := newIPRouteMessage(dst); m != nil {
+ if m := newIPRouteMessage(dst, z.client.Version); m != nil {
z.client.Send(m)
}
}
} else {
for _, path := range msg.PathList {
- if m := newIPRouteMessage([]*table.Path{path}); m != nil {
+ if m := newIPRouteMessage([]*table.Path{path}, z.client.Version); m != nil {
z.client.Send(m)
}
}
@@ -194,12 +194,12 @@ func (z *zebraClient) loop() {
}
}
-func newZebraClient(s *BgpServer, url string, protos []string) (*zebraClient, error) {
+func newZebraClient(s *BgpServer, url string, protos []string, version uint8) (*zebraClient, error) {
l := strings.SplitN(url, ":", 2)
if len(l) != 2 {
return nil, fmt.Errorf("unsupported url: %s", url)
}
- cli, err := zebra.NewClient(l[0], l[1], zebra.ROUTE_BGP)
+ cli, err := zebra.NewClient(l[0], l[1], zebra.ROUTE_BGP, version)
if err != nil {
return nil, err
}