Skip to content

Commit 4cb438b

Browse files
author
Aritra Basu
committed
fix incorrect prefix length for IPv6 neighbors
Signed-off-by: Aritra Basu <[email protected]>
1 parent 0bbdbfb commit 4cb438b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

calico-vpp-agent/routing/bgp_watcher.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,10 +543,14 @@ func (s *Server) WatchBGPPath(t *tomb.Tomb) error {
543543
peer := localPeer.Peer
544544
filters := localPeer.BGPFilterNames
545545
// create a neighbor set to apply filter only on specific peer using a global policy
546+
prefixLen := "/32"
547+
if ip := net.ParseIP(peer.Conf.NeighborAddress); ip != nil && ip.To4() == nil {
548+
prefixLen = "/128"
549+
}
546550
neighborSet := &bgpapi.DefinedSet{
547551
Name: peer.Conf.NeighborAddress + "neighbor",
548552
DefinedType: bgpapi.DefinedType_NEIGHBOR,
549-
List: []string{peer.Conf.NeighborAddress + "/32"},
553+
List: []string{peer.Conf.NeighborAddress + prefixLen},
550554
}
551555
err := s.BGPServer.AddDefinedSet(context.Background(), &bgpapi.AddDefinedSetRequest{
552556
DefinedSet: neighborSet,

0 commit comments

Comments
 (0)