diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2018-02-13 12:30:36 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-02-16 14:02:54 +0900 |
commit | d779a597c71268628ac794cb89fade4f77514c7d (patch) | |
tree | 727cb4ab9d5c0227b6fa5d0ce50d43e5027666bb | |
parent | f1d0788d686385f3febd52926741a7c0f1097e29 (diff) |
config/default: Default value of route-reflector-cluster-id
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>
-rw-r--r-- | config/default.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/config/default.go b/config/default.go index c3fa4eb3..5c472909 100644 --- a/config/default.go +++ b/config/default.go @@ -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 ( @@ -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 } |