From patchwork Thu Nov 22 08:51:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Synacek X-Patchwork-Id: 201165 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 8A5CF2C008E for ; Fri, 23 Nov 2012 06:31:52 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756536Ab2KVTbZ (ORCPT ); Thu, 22 Nov 2012 14:31:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:12257 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756087Ab2KVTbW (ORCPT ); Thu, 22 Nov 2012 14:31:22 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qAM8pkQ0017193 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 22 Nov 2012 03:51:46 -0500 Received: from dhcp-24-219.brq.redhat.com (dhcp-24-219.brq.redhat.com [10.34.24.219]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qAM8pij0004929; Thu, 22 Nov 2012 03:51:45 -0500 From: Jan Synacek To: yoshfuji@linux-ipv6.org Cc: netdev@vger.kernel.org, Jan Synacek Subject: [PATCH] arping: Fix find_device_by_ifaddrs() Date: Thu, 22 Nov 2012 09:51:15 +0100 Message-Id: <1353574275-21742-1-git-send-email-jsynacek@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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)