netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Synacek <jsynacek@redhat.com>
To: yoshfuji@linux-ipv6.org
Cc: netdev@vger.kernel.org, Jan Synacek <jsynacek@redhat.com>
Subject: [PATCH] arping: Fix find_device_by_ifaddrs()
Date: Thu, 22 Nov 2012 09:51:15 +0100	[thread overview]
Message-ID: <1353574275-21742-1-git-send-email-jsynacek@redhat.com> (raw)

Look for another device if the device name and the currently found one are the
same, not different.

Also, make checking for the device's flags nonfatal.

Signed-off-by: Jan Synacek <jsynacek@redhat.com>
---
 arping.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arping.c b/arping.c
index ff77bec..d0edccf 100644
--- a/arping.c
+++ b/arping.c
@@ -550,10 +550,10 @@ static int find_device_by_ifaddrs(void)
 			continue;
 		if (ifa->ifa_addr->sa_family != AF_PACKET)
 			continue;
-		if (device.name && ifa->ifa_name && strcmp(ifa->ifa_name, device.name))
+		if (device.name && ifa->ifa_name && !strcmp(ifa->ifa_name, device.name))
 			continue;
 
-		if (check_ifflags(ifa->ifa_flags, device.name != NULL) < 0)
+		if (check_ifflags(ifa->ifa_flags, 0) < 0)
 			continue;
 
 		if (!((struct sockaddr_ll *)ifa->ifa_addr)->sll_halen)
-- 
1.7.11.7

             reply	other threads:[~2012-11-22 19:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22  8:51 Jan Synacek [this message]
2012-11-26  9:26 ` [PATCH] arping: Fix find_device_by_ifaddrs() Jan Synacek

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=1353574275-21742-1-git-send-email-jsynacek@redhat.com \
    --to=jsynacek@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).