public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jan Synacek <jsynacek@redhat•com>
To: yoshfuji@linux-ipv6•org
Cc: netdev@vger•kernel.org
Subject: Re: [PATCH 2/2] ping6: Fix -F switch.
Date: Mon, 10 Dec 2012 10:58:39 +0100	[thread overview]
Message-ID: <50C5B24F.5030900@redhat.com> (raw)
In-Reply-To: <1354868724-15549-3-git-send-email-jsynacek@redhat.com>

On 12/07/2012 09:25 AM, Jan Synacek wrote:
> Even when the flowlabel is set correctly, ping6 exits with a warning. For some
> reason, the errno is set when it should not be.
> 
> Signed-off-by: Jan Synacek <jsynacek@redhat•com>
> ---
>  ping6.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/ping6.c b/ping6.c
> index 358a035..85d3782 100644
> --- a/ping6.c
> +++ b/ping6.c
> @@ -725,7 +725,8 @@ int main(int argc, char *argv[])
>  		switch(ch) {
>  		case 'F':
>  			flowlabel = hextoui(optarg);
> -			if (errno || (flowlabel & ~IPV6_FLOWINFO_FLOWLABEL)) {
> +			if ((flowlabel < 0 && errno) ||
> +			    (flowlabel & ~IPV6_FLOWINFO_FLOWLABEL)) {
>  				fprintf(stderr, "ping: Invalid flowinfo %s\n", optarg);
>  				exit(2);
>  			}
> 

This was well meant, but it doesn't work, because flowlabel is declared as
__u32, therefore it can never be negative. I'm going to post a fixed version soon.

-- 
Jan Synacek
Software Engineer, BaseOS team Brno, Red Hat

  reply	other threads:[~2012-12-10  9:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-07  8:25 [PATCH 0/2] iputils: minor ninfod and ping6 fixes Jan Synacek
2012-12-07  8:25 ` [PATCH 1/2] ninfod: Fix more unused variables Jan Synacek
2012-12-07  8:25 ` [PATCH 2/2] ping6: Fix -F switch Jan Synacek
2012-12-10  9:58   ` Jan Synacek [this message]
2012-12-10 10:12     ` [PATCH 2/2 fixed] " Jan Synacek
2012-12-19 21:05 ` [PATCH 0/2] iputils: minor ninfod and ping6 fixes YOSHIFUJI Hideaki

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=50C5B24F.5030900@redhat.com \
    --to=jsynacek@redhat$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=yoshfuji@linux-ipv6$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox