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 /table | |
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>
Diffstat (limited to 'table')
-rw-r--r-- | table/path.go | 4 |
1 files changed, 2 insertions, 2 deletions
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("::")) } |