internet_checksum.run: don't use bad trafgen seeds

This commit is contained in:
Christian Helmuth 2024-07-31 16:48:48 +02:00
parent e5c0d5247e
commit e64b07d7a4

View File

@ -17,13 +17,21 @@ proc exit {{code 0}} {
build { core init lib/ld lib/vfs test/internet_checksum server/lx_fs } build { core init lib/ld lib/vfs test/internet_checksum server/lx_fs }
create_boot_directory create_boot_directory
set seed "" proc gen_seed { } {
set min_seed 0
set max_seed [expr 2**32]
return [expr int($min_seed + floor(rand() * $max_seed))]
}
set seed 0
if {[info exists ::env(SEED)]} { if {[info exists ::env(SEED)]} {
set seed $::env(SEED) set seed $::env(SEED)
} else { } else {
set min_seed 0 # in some cases trafgen generates bad checksums in encapsulated packets
set max_seed [expr 2**32] set bad_seeds [list 0 875727356 ]
set seed [expr int($min_seed + floor(rand() * $max_seed))] while {[lsearch -exact $bad_seeds $seed] != -1} {
set seed [gen_seed]
}
} }
puts "\nUse script with SEED=$seed in order to get reproducible results\n" puts "\nUse script with SEED=$seed in order to get reproducible results\n"