Skip to content

Commit

Permalink
samples: pktgen: add missing IPv6 option to pktgen scripts
Browse files Browse the repository at this point in the history
Currently, "sample04" and "sample05" are not working properly when
running with an IPv6 option("-6"). The commit 0f06a67 ("samples:
Add an IPv6 "-6" option to the pktgen scripts") has omitted the addition
of this option at "sample04" and "sample05".

In order to support IPv6 option, this commit adds logic related to IPv6
option.

Fixes: 0f06a67 ("samples: Add an IPv6 "-6" option to the pktgen scripts")

Signed-off-by: Juhee Kang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
claudiajkang authored and davem330 committed Aug 16, 2021
1 parent 7caeabd commit 0f0c4f1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions samples/pktgen/pktgen_sample04_many_flows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ root_check_run_with_sudo "$@"
# Parameter parsing via include
source ${basedir}/parameters.sh
# Set some default params, if they didn't get set
[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
if [ -z "$DEST_IP" ]; then
[ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
fi
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
[ -z "$CLONE_SKB" ] && CLONE_SKB="0"
[ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
if [ -n "$DEST_IP" ]; then
validate_addr $DEST_IP
read -r DST_MIN DST_MAX <<< $(parse_addr $DEST_IP)
validate_addr${IP6} $DEST_IP
read -r DST_MIN DST_MAX <<< $(parse_addr${IP6} $DEST_IP)
fi
if [ -n "$DST_PORT" ]; then
read -r UDP_DST_MIN UDP_DST_MAX <<< $(parse_ports $DST_PORT)
Expand Down Expand Up @@ -62,8 +64,8 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do

# Single destination
pg_set $dev "dst_mac $DST_MAC"
pg_set $dev "dst_min $DST_MIN"
pg_set $dev "dst_max $DST_MAX"
pg_set $dev "dst${IP6}_min $DST_MIN"
pg_set $dev "dst${IP6}_max $DST_MAX"

if [ -n "$DST_PORT" ]; then
# Single destination port or random port range
Expand Down
12 changes: 7 additions & 5 deletions samples/pktgen/pktgen_sample05_flow_per_thread.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ root_check_run_with_sudo "$@"
# Parameter parsing via include
source ${basedir}/parameters.sh
# Set some default params, if they didn't get set
[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
if [ -z "$DEST_IP" ]; then
[ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
fi
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
[ -z "$CLONE_SKB" ] && CLONE_SKB="0"
[ -z "$BURST" ] && BURST=32
[ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
if [ -n "$DEST_IP" ]; then
validate_addr $DEST_IP
read -r DST_MIN DST_MAX <<< $(parse_addr $DEST_IP)
validate_addr${IP6} $DEST_IP
read -r DST_MIN DST_MAX <<< $(parse_addr${IP6} $DEST_IP)
fi
if [ -n "$DST_PORT" ]; then
read -r UDP_DST_MIN UDP_DST_MAX <<< $(parse_ports $DST_PORT)
Expand Down Expand Up @@ -52,8 +54,8 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do

# Single destination
pg_set $dev "dst_mac $DST_MAC"
pg_set $dev "dst_min $DST_MIN"
pg_set $dev "dst_max $DST_MAX"
pg_set $dev "dst${IP6}_min $DST_MIN"
pg_set $dev "dst${IP6}_max $DST_MAX"

if [ -n "$DST_PORT" ]; then
# Single destination port or random port range
Expand Down

0 comments on commit 0f0c4f1

Please sign in to comment.