summaryrefslogtreecommitdiffhomepage
path: root/table
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-12-06 10:20:09 +0900
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-12-29 14:47:06 +0900
commitd01c1586b9b1a25965448f9e15a05d94f2b22a5f (patch)
tree744609e474a9561dab792b60ab70d82696ab691e /table
parent58946b7924840f1effc993e95440266479c668d5 (diff)
config: use viper and support multiple configuration formats
// toml by default $ gobgpd -f gobgpd.toml // use -t to change configuration type $ gobgpd -t yaml -f gobgpd.yaml Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table')
-rw-r--r--table/destination.go4
-rw-r--r--table/path.go2
-rw-r--r--table/policy.go6
-rw-r--r--table/policy_test.go2
4 files changed, 9 insertions, 5 deletions
diff --git a/table/destination.go b/table/destination.go
index ca3a39f0..2577e7cb 100644
--- a/table/destination.go
+++ b/table/destination.go
@@ -103,8 +103,8 @@ func NewPeerInfo(g *config.Global, p *config.Neighbor) *PeerInfo {
return &PeerInfo{
AS: p.Config.PeerAs,
LocalAS: g.Config.As,
- LocalID: g.Config.RouterId,
- Address: p.Config.NeighborAddress,
+ LocalID: net.ParseIP(g.Config.RouterId).To4(),
+ Address: net.ParseIP(p.Config.NeighborAddress),
RouteReflectorClient: p.RouteReflector.Config.RouteReflectorClient,
RouteReflectorClusterID: id,
}
diff --git a/table/path.go b/table/path.go
index bfc967d2..05144812 100644
--- a/table/path.go
+++ b/table/path.go
@@ -90,7 +90,7 @@ func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor)
return
}
- localAddress := peer.Transport.Config.LocalAddress
+ localAddress := net.ParseIP(peer.Transport.Config.LocalAddress)
if peer.Config.PeerType == config.PEER_TYPE_EXTERNAL {
// NEXTHOP handling
path.SetNexthop(localAddress)
diff --git a/table/policy.go b/table/policy.go
index 52d6900c..7148b764 100644
--- a/table/policy.go
+++ b/table/policy.go
@@ -515,7 +515,11 @@ func NewNeighborSet(c config.NeighborSet) (*NeighborSet, error) {
}
list := make([]net.IP, 0, len(c.NeighborInfoList))
for _, x := range c.NeighborInfoList {
- list = append(list, x.Address)
+ addr := net.ParseIP(x.Address)
+ if addr == nil {
+ return nil, fmt.Errorf("invalid address: %s", x.Address)
+ }
+ list = append(list, addr)
}
return &NeighborSet{
name: name,
diff --git a/table/policy_test.go b/table/policy_test.go
index c29b15c1..1ab6acce 100644
--- a/table/policy_test.go
+++ b/table/policy_test.go
@@ -2839,7 +2839,7 @@ func createNeighborSet(name string, addr string) config.NeighborSet {
NeighborSetName: name,
NeighborInfoList: []config.NeighborInfo{
config.NeighborInfo{
- Address: net.ParseIP(addr),
+ Address: addr,
}},
}
return ns