| .. | .. |
|---|
| 22 | 22 | # Example enforce param "-m" for dst_mac |
|---|
| 23 | 23 | [ -z "$DST_MAC" ] && usage && err 2 "Must specify -m dst_mac" |
|---|
| 24 | 24 | [ -z "$COUNT" ] && COUNT="100000" # Zero means indefinitely |
|---|
| 25 | +if [ -n "$DEST_IP" ]; then |
|---|
| 26 | + validate_addr${IP6} $DEST_IP |
|---|
| 27 | + read -r DST_MIN DST_MAX <<< $(parse_addr${IP6} $DEST_IP) |
|---|
| 28 | +fi |
|---|
| 29 | +if [ -n "$DST_PORT" ]; then |
|---|
| 30 | + read -r UDP_DST_MIN UDP_DST_MAX <<< $(parse_ports $DST_PORT) |
|---|
| 31 | + validate_ports $UDP_DST_MIN $UDP_DST_MAX |
|---|
| 32 | +fi |
|---|
| 25 | 33 | |
|---|
| 26 | 34 | # Base Config |
|---|
| 27 | 35 | DELAY="0" # Zero means max speed |
|---|
| 28 | 36 | |
|---|
| 29 | 37 | # Flow variation random source port between min and max |
|---|
| 30 | | -UDP_MIN=9 |
|---|
| 31 | | -UDP_MAX=109 |
|---|
| 38 | +UDP_SRC_MIN=9 |
|---|
| 39 | +UDP_SRC_MAX=109 |
|---|
| 32 | 40 | |
|---|
| 33 | 41 | # General cleanup everything since last run |
|---|
| 34 | 42 | # (especially important if other threads were configured by other scripts) |
|---|
| .. | .. |
|---|
| 57 | 65 | |
|---|
| 58 | 66 | # Destination |
|---|
| 59 | 67 | pg_set $DEV "dst_mac $DST_MAC" |
|---|
| 60 | | -pg_set $DEV "dst$IP6 $DEST_IP" |
|---|
| 68 | +pg_set $DEV "dst${IP6}_min $DST_MIN" |
|---|
| 69 | +pg_set $DEV "dst${IP6}_max $DST_MAX" |
|---|
| 70 | + |
|---|
| 71 | +if [ -n "$DST_PORT" ]; then |
|---|
| 72 | + # Single destination port or random port range |
|---|
| 73 | + pg_set $DEV "flag UDPDST_RND" |
|---|
| 74 | + pg_set $DEV "udp_dst_min $UDP_DST_MIN" |
|---|
| 75 | + pg_set $DEV "udp_dst_max $UDP_DST_MAX" |
|---|
| 76 | +fi |
|---|
| 61 | 77 | |
|---|
| 62 | 78 | # Setup random UDP port src range |
|---|
| 63 | 79 | pg_set $DEV "flag UDPSRC_RND" |
|---|
| 64 | | -pg_set $DEV "udp_src_min $UDP_MIN" |
|---|
| 65 | | -pg_set $DEV "udp_src_max $UDP_MAX" |
|---|
| 80 | +pg_set $DEV "udp_src_min $UDP_SRC_MIN" |
|---|
| 81 | +pg_set $DEV "udp_src_max $UDP_SRC_MAX" |
|---|
| 66 | 82 | |
|---|
| 67 | 83 | # start_run |
|---|
| 68 | 84 | echo "Running... ctrl^C to stop" >&2 |
|---|