Skip to content

Commit

Permalink
config/default: Default value of route-reflector-cluster-id
Browse files Browse the repository at this point in the history
Currently "0.0.0.0" is the default of "route-reflector-cluster-id" and
this patch fixes to use "router-id" as its default value.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
  • Loading branch information
iwaseyusuke authored and fujita committed Feb 16, 2018
1 parent f1d0788 commit d779a59
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package config

import (
"fmt"
"net"
"reflect"

"github.com/osrg/gobgp/packet/bgp"
"github.com/osrg/gobgp/packet/bmp"
"github.com/osrg/gobgp/packet/rtr"
"github.com/spf13/viper"
"net"
"reflect"
)

const (
Expand Down Expand Up @@ -235,6 +236,14 @@ func setDefaultNeighborConfigValuesWithViper(v *viper.Viper, n *Neighbor, g *Glo
}
}

if n.RouteReflector.Config.RouteReflectorClient {
if n.RouteReflector.Config.RouteReflectorClusterId == "" {
n.RouteReflector.Config.RouteReflectorClusterId = RrClusterIdType(g.Config.RouterId)
} else if id := net.ParseIP(string(n.RouteReflector.Config.RouteReflectorClusterId)).To4(); id == nil {
return fmt.Errorf("route-reflector-cluster-id should be specified in IPv4 address format")
}
}

return nil
}

Expand Down

0 comments on commit d779a59

Please sign in to comment.