diff options
author | matthubb <matthubb@gmail.com> | 2017-08-09 11:16:11 +0100 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-08-11 15:50:59 +0900 |
commit | 534531b1b1887ac7146adcbbbef906f440abec37 (patch) | |
tree | 2362b09a3b815e618fd15303a0dfc289a01e095a /gobgpd | |
parent | 2bad24a07764ff413b9222581c282ab12a16fdf1 (diff) |
gobgpd: fix AddDynamicNeighbor()
The temporary pointer from the range function is being passed to
AddDynamicNeighbor which is the same for every iteration of the
loop. So the PeerGroup.DynamicNeighbors all end up with the same
config.DynamicNeighbor.
Diffstat (limited to 'gobgpd')
-rw-r--r-- | gobgpd/main.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gobgpd/main.go b/gobgpd/main.go index 0c42878f..afdd71c9 100644 --- a/gobgpd/main.go +++ b/gobgpd/main.go @@ -277,9 +277,9 @@ func main() { } updatePolicy = updatePolicy || u } - for _, dn := range newConfig.DynamicNeighbors { + for i, dn := range newConfig.DynamicNeighbors { log.Infof("Dynamic Neighbor %s is added to PeerGroup %s", dn.Config.Prefix, dn.Config.PeerGroup) - if err := bgpServer.AddDynamicNeighbor(&dn); err != nil { + if err := bgpServer.AddDynamicNeighbor(&newConfig.DynamicNeighbors[i]); err != nil { log.Warn(err) } } |