mirror of
https://github.com/samba-team/samba.git
synced 2025-01-03 01:18:10 +03:00
traffic_replay: Avoid Exception if no packet rate is specified
traffic_replay would throw an exception if you didn't specify some sort of packet rate. We can avoid this by using --scale-traffic=1.0 as the default if nothing else was specified. script/traffic_replay model.txt $SERVER.$REALM --duration=10 --fixed-password=blahblah12# -U$USERNAME%$PASSWORD INFO 2019-04-10 01:03:01,809 pid:47755 script/traffic_replay #280: Using the specified model file to generate conversations Traceback (most recent call last): File "script/traffic_replay", line 438, in <module> main() File "script/traffic_replay", line 293, in main opts.conversation_persistence) File "bin/python/samba/emulate/traffic.py", line 1295, in generate_conversation_sequences target_packets = int(packet_rate * duration) TypeError: unsupported operand type(s) for *: 'NoneType' and 'float' Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
641d74cb26
commit
e387cf9288
@ -235,6 +235,10 @@ def main():
|
|||||||
"are incompatible. Use one or the other.")
|
"are incompatible. Use one or the other.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
if not opts.scale_traffic and not opts.packets_per_second:
|
||||||
|
logger.info("No packet rate specified. Using --scale-traffic=1.0")
|
||||||
|
opts.scale_traffic = 1.0
|
||||||
|
|
||||||
if opts.timing_data not in ('-', None):
|
if opts.timing_data not in ('-', None):
|
||||||
try:
|
try:
|
||||||
open(opts.timing_data, 'w').close()
|
open(opts.timing_data, 'w').close()
|
||||||
|
Loading…
Reference in New Issue
Block a user