diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-08-02 10:19:47 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-04-04 22:07:46 +0900 |
commit | 6d55ba613ad9cc8635427d7c87b433d605849852 (patch) | |
tree | 1c9d6062d0cfe1f34d07749a35e8a5b416e44b89 | |
parent | 029852207a0318056edd984ae876f85eefd1df1f (diff) |
table: fix bug of UpdatePathAttrs() with ipv6 link-local peer
config.Neighbor.Transport.State.LocalAddress may have zone info and
not be valid ip address format.
Use PeerInfo.LocalAddress instead.
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
-rw-r--r-- | server/peer.go | 2 | ||||
-rw-r--r-- | table/path.go | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/server/peer.go b/server/peer.go index eeae0556..96e014db 100644 --- a/server/peer.go +++ b/server/peer.go @@ -272,7 +272,7 @@ func (peer *Peer) filterpath(path, old *table.Path) *table.Path { } path = path.Clone(path.IsWithdraw) - path.UpdatePathAttrs(peer.fsm.gConf, peer.fsm.pConf) + path.UpdatePathAttrs(peer.fsm.gConf, peer.fsm.pConf, peer.fsm.peerInfo) options := &table.PolicyOptions{ Info: peer.fsm.peerInfo, diff --git a/table/path.go b/table/path.go index f90cd06a..82af18c1 100644 --- a/table/path.go +++ b/table/path.go @@ -163,7 +163,7 @@ func cloneAsPath(asAttr *bgp.PathAttributeAsPath) *bgp.PathAttributeAsPath { return bgp.NewPathAttributeAsPath(newASparams) } -func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor) { +func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor, info *PeerInfo) { if peer.RouteServer.Config.RouteServerClient { return } @@ -176,7 +176,7 @@ func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor) } } - localAddress := net.ParseIP(peer.Transport.State.LocalAddress) + localAddress := info.LocalAddress isZero := func(ip net.IP) bool { return ip.Equal(net.ParseIP("0.0.0.0")) || ip.Equal(net.ParseIP("::")) } |