[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190916085317.02e4d985@carbon>
Date: Mon, 16 Sep 2019 08:53:17 +0200
From: Jesper Dangaard Brouer <brouer@...hat.com>
To: "Daniel T. Lee" <danieltimlee@...il.com>
Cc: "David S . Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
brouer@...hat.com,
Toke Høiland-Jørgensen <toke@...hat.com>
Subject: Re: [v3 2/3] samples: pktgen: add helper functions for IP(v4/v6)
CIDR parsing
On Sun, 15 Sep 2019 00:13:52 +0900
"Daniel T. Lee" <danieltimlee@...il.com> wrote:
> This commit adds CIDR parsing and IP validate helper function to parse
> single IP or range of IP with CIDR. (e.g. 198.18.0.0/15)
>
> Helpers will be used in prior to set target address in samples/pktgen.
>
> Signed-off-by: Daniel T. Lee <danieltimlee@...il.com>
> ---
> Changes since v3:
> * Set errexit option to stop script execution on error
>
> samples/pktgen/functions.sh | 124 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 124 insertions(+)
>
> diff --git a/samples/pktgen/functions.sh b/samples/pktgen/functions.sh
> index 4af4046d71be..87ae61701904 100644
> --- a/samples/pktgen/functions.sh
> +++ b/samples/pktgen/functions.sh
> @@ -5,6 +5,8 @@
> # Author: Jesper Dangaaard Brouer
> # License: GPL
>
> +set -o errexit
Unfortunately, this breaks the scripts.
The function proc_cmd are designed to grep after "Result: OK:" which
might fail, and your patch/change makes the script stop immediately.
We actually want to continue, and output what command that failed (and
also grep again after "Result:" to provide the kernel reason).
Even if you somehow "fix" function proc_cmd, then we in general want to
catch different error situations by looking at status $?, and output
meaning full errors via calling err() function. IHMO as minimum with
errexit you need a 'trap' function that can help/inform the user of
what went wrong.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
Powered by blists - more mailing lists