MCPcopy
hub / github.com/osrg/gobgp / TestTableDestinationsCollisionAttack

Function TestTableDestinationsCollisionAttack

internal/pkg/table/table_test.go:778–816  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

776}
777
778func 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
818func buildPrefixesWithLabels() []bgp.NLRI {
819 label1 := *bgp.NewMPLSLabelStack(1, 2, 3)

Callers

nothing calls this directly

Calls 12

setDestinationMethod · 0.95
InfoMethod · 0.95
GetDestinationsMethod · 0.95
NewTableFunction · 0.85
newDestinationFunction · 0.85
createRandomAddrPrefixFunction · 0.85
LogMethod · 0.80
SystemMemoryAvailableMiBFunction · 0.70
StringMethod · 0.65
EqualMethod · 0.45
GetNlriMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…