(t *testing.T)
| 776 | } |
| 777 | |
| 778 | func TestTableDestinationsCollisionAttack(t *testing.T) { |
| 779 | t.Skip() |
| 780 | if !strings.Contains(runtime.GOARCH, "64") { |
| 781 | t.Skip("This test is only for 64bit architecture") |
| 782 | } |
| 783 | |
| 784 | ipv4t := NewTable(logger, bgp.RF_IPv4_UC) |
| 785 | |
| 786 | i := 0 |
| 787 | for { |
| 788 | // filled until 1GB |
| 789 | mem := SystemMemoryAvailableMiB() |
| 790 | if mem < 1024 { |
| 791 | break |
| 792 | } |
| 793 | |
| 794 | for _, p := range createAddrPrefixBaseIndex(i) { |
| 795 | dest := newDestination(p, 0) |
| 796 | ipv4t.setDestination(dest) |
| 797 | } |
| 798 | |
| 799 | for _, p := range createRandomAddrPrefix() { |
| 800 | dest := newDestination(p, 0) |
| 801 | ipv4t.setDestination(dest) |
| 802 | } |
| 803 | |
| 804 | i++ |
| 805 | } |
| 806 | |
| 807 | assert.Equal(t, 0, ipv4t.Info().NumCollision) |
| 808 | |
| 809 | dests := ipv4t.GetDestinations() |
| 810 | rand.Shuffle(len(dests), func(i, j int) { |
| 811 | dests[i], dests[j] = dests[j], dests[i] |
| 812 | }) |
| 813 | for i := range min(len(dests), 10) { |
| 814 | t.Log(dests[i].GetNlri().String()) |
| 815 | } |
| 816 | } |
| 817 | |
| 818 | func buildPrefixesWithLabels() []bgp.NLRI { |
| 819 | label1 := *bgp.NewMPLSLabelStack(1, 2, 3) |
nothing calls this directly
no test coverage detected
searching dependent graphs…