| 670 | } |
| 671 | |
| 672 | func (t *Table) setDestination(dst *destination) { |
| 673 | if collision := t.destinations.InsertUpdate(dst); collision { |
| 674 | // Get the first prefix in this collision bucket |
| 675 | shard := t.destinations.getShard(dst.GetNlri()) |
| 676 | shard.mu.RLock() |
| 677 | key := tableKey(dst.GetNlri()) |
| 678 | firstPrefix := "" |
| 679 | if dests, ok := shard.mp[key]; ok && len(dests) > 0 { |
| 680 | firstPrefix = dests[0].GetNlri().String() |
| 681 | } |
| 682 | shard.mu.RUnlock() |
| 683 | |
| 684 | t.logger.Warn("insert collision detected", |
| 685 | slog.String("Topic", "Table"), |
| 686 | slog.String("Key", t.Family.String()), |
| 687 | slog.String("1stPrefix", firstPrefix), |
| 688 | slog.String("Prefix", dst.GetNlri().String()), |
| 689 | ) |
| 690 | } |
| 691 | |
| 692 | if nlri, ok := dst.nlri.(*bgp.EVPNNLRI); ok { |
| 693 | if macadv, ok := nlri.RouteTypeData.(*bgp.EVPNMacIPAdvertisementRoute); ok { |
| 694 | for _, path := range dst.knownPathList { |
| 695 | for _, ec := range path.GetRouteTargets() { |
| 696 | t.macIndex.Insert(ec, macadv.MacAddress, dst) |
| 697 | } |
| 698 | } |
| 699 | } |
| 700 | } |
| 701 | } |
| 702 | |
| 703 | func (t *Table) Bests(id string, as uint32) []*Path { |
| 704 | paths := make([]*Path, 0) |