📄 lect08-bb.ppt
字号:
print "ipsec spi --saref --af inet --edst $edst --spi $spi --proto $proto --del\n"; if($sanum != $saCount-1) { # delete it, by copying one from end. $edst[$sanum]=$edst[$saCount-1]; $spi[$sanum]=$spi[$saCount-1]; } $saCount--; } else { # make a new one. $choice=int(rand(100)); $edst=$edst_choices[$choice]; $spi="0x".(int(rand(16777216))+1024); #print "alloc $edst $spi $proto $src\n"; print "ipsec spi --saref --af inet --edst $edst --spi $spi --proto $proto --src $src --esp $algo --enckey $enckey --authkey $authkey\n"; $edst[$saCount]=$edst; $spi[$saCount]=$spi; $saCount++; } if($maxSa < $saCount) { $maxSa = $saCount; } print "echo saCount=$saCount $maxSa\n";}print "# maxSa = $maxSa\n";sub init_stuff { # make up 100 random edst's for($i=0; $i<100; $i++) { $a=int(rand(256)); $b=int(rand(256)); $c=int(rand(256)); $d=int(rand(256)); $edst_choices[$i]="$a.$b.$c.$d"; }}