From: Jesper Dangaard Brouer <brouer@redhat.com>
To: "Daniel T. Lee" <danieltimlee@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, brouer@redhat.com
Subject: Re: [v2 3/3] samples: pktgen: allow to specify destination IP range (CIDR)
Date: Fri, 13 Sep 2019 14:31:44 +0200 [thread overview]
Message-ID: <20190913143144.2b8c18ed@carbon> (raw)
In-Reply-To: <20190911184807.21770-3-danieltimlee@gmail.com>
On Thu, 12 Sep 2019 03:48:07 +0900
"Daniel T. Lee" <danieltimlee@gmail.com> wrote:
> diff --git a/samples/pktgen/pktgen_sample01_simple.sh b/samples/pktgen/pktgen_sample01_simple.sh
> index 063ec0998906..08995fa70025 100755
> --- a/samples/pktgen/pktgen_sample01_simple.sh
> +++ b/samples/pktgen/pktgen_sample01_simple.sh
> @@ -22,6 +22,7 @@ fi
> # Example enforce param "-m" for dst_mac
> [ -z "$DST_MAC" ] && usage && err 2 "Must specify -m dst_mac"
> [ -z "$COUNT" ] && COUNT="100000" # Zero means indefinitely
> +[ -n "$DEST_IP" ] && read -r DST_MIN DST_MAX <<< $(parse_addr${IP6} $DEST_IP)
The way the function "parse_addr" is called, in case of errors the
'err()' function is called inside, but it will not stop the program
flow. Instead that function will "only" echo the "ERROR", but program
flow continues (even-thought 'err()' uses exit $exitcode).
Maybe it is not solveable to get the exit/$?/status out? (I've tried
different options, but didn't find a way).
Alternatively we can just add one extra line to validate result:
[ -z "$DST_MIN" ] && err 5 "Stop: Invalid IP${IP6} address input"
As if it fails then $DST_MIN isn't set.
> if [ -n "$DST_PORT" ]; then
> read -r UDP_DST_MIN UDP_DST_MAX <<< $(parse_ports $DST_PORT)
> validate_ports $UDP_DST_MIN $UDP_DST_MAX
> @@ -61,7 +62,8 @@ pg_set $DEV "flag NO_TIMESTAMP"
>
> # Destination
> pg_set $DEV "dst_mac $DST_MAC"
> -pg_set $DEV "dst$IP6 $DEST_IP"
> +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
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
next prev parent reply other threads:[~2019-09-13 12:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-11 18:48 [v2 1/3] samples: pktgen: make variable consistent with option Daniel T. Lee
2019-09-11 18:48 ` [v2 2/3] samples: pktgen: add helper functions for IP(v4/v6) CIDR parsing Daniel T. Lee
2019-09-12 15:59 ` Jesper Dangaard Brouer
2019-09-12 17:53 ` Daniel T. Lee
2019-09-13 12:32 ` Jesper Dangaard Brouer
2019-09-13 12:43 ` Jesper Dangaard Brouer
2019-09-14 15:02 ` Daniel T. Lee
2019-09-11 18:48 ` [v2 3/3] samples: pktgen: allow to specify destination IP range (CIDR) Daniel T. Lee
2019-09-13 12:31 ` Jesper Dangaard Brouer [this message]
2019-09-13 12:37 ` Toke Høiland-Jørgensen
2019-09-14 14:51 ` Daniel T. Lee
2019-09-13 12:04 ` [v2 1/3] samples: pktgen: make variable consistent with option Jesper Dangaard Brouer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190913143144.2b8c18ed@carbon \
--to=brouer@redhat.com \
--cc=danieltimlee@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.