From 029852207a0318056edd984ae876f85eefd1df1f Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Tue, 2 Aug 2016 10:19:26 +0000 Subject: server: fix bug of wrongly set to PeerInfo.LocalAddress config.TransportState.LocalAddress may have zone info with ipv6 address like "fe80::x%eth0". In this case, net.ParseIP() returns , which leads to set to PeerInfo.LocalAddress. Signed-off-by: ISHIDA Wataru --- server/server.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'server') diff --git a/server/server.go b/server/server.go index d0336de3..8260e566 100644 --- a/server/server.go +++ b/server/server.go @@ -759,8 +759,11 @@ func (server *BgpServer) handleFSMMessage(peer *Peer, e *FsmMsg) { if nextState == bgp.BGP_FSM_ESTABLISHED { // update for export policy laddr, _ := peer.fsm.LocalHostPort() + // may include zone info peer.fsm.pConf.Transport.State.LocalAddress = laddr - peer.fsm.peerInfo.LocalAddress = net.ParseIP(laddr) + // exclude zone info + ipaddr, _ := net.ResolveIPAddr("ip", laddr) + peer.fsm.peerInfo.LocalAddress = ipaddr.IP deferralExpiredFunc := func(family bgp.RouteFamily) func() { return func() { server.mgmtOperation(func() error { -- cgit v1.2.3