From patchwork Sat Jan 30 10:42:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirsher, Jeffrey T" X-Patchwork-Id: 44056 X-Patchwork-Delegate: shemminger@vyatta.com 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 E6574B7D39 for ; Sat, 30 Jan 2010 21:43:12 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752583Ab0A3KnH (ORCPT ); Sat, 30 Jan 2010 05:43:07 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752543Ab0A3KnH (ORCPT ); Sat, 30 Jan 2010 05:43:07 -0500 Received: from qmta07.emeryville.ca.mail.comcast.net ([76.96.30.64]:37685 "EHLO qmta07.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750879Ab0A3KnG (ORCPT ); Sat, 30 Jan 2010 05:43:06 -0500 Received: from omta17.emeryville.ca.mail.comcast.net ([76.96.30.73]) by qmta07.emeryville.ca.mail.comcast.net with comcast id bmj71d0011afHeLA7mj7HT; Sat, 30 Jan 2010 10:43:07 +0000 Received: from localhost.localdomain ([63.64.152.142]) by omta17.emeryville.ca.mail.comcast.net with comcast id bmio1d00134bfcX8dmiqA1; Sat, 30 Jan 2010 10:43:05 +0000 From: Jeff Kirsher Subject: [iproute2 PATCH 2/4] libnetlink: Modify parser to track the first duplicated attributes To: davem@davemloft.net, shemminger@vyatta.com Cc: netdev@vger.kernel.org, gospo@redhat.com, Mitch Williams , Jeff Kirsher Date: Sat, 30 Jan 2010 02:42:46 -0800 Message-ID: <20100130104246.26719.34306.stgit@localhost.localdomain> In-Reply-To: <20100130104226.26719.21774.stgit@localhost.localdomain> References: <20100130104226.26719.21774.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Williams, Mitch A Modify the parser to keep track of the first of any duplicated attributes, instead of the last. This is required for VF configuration reporting, where multiple attributes of the same type are added sequentially. Signed-off-by: Mitch Williams Signed-off-by: Jeff Kirsher --- lib/libnetlink.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/lib/libnetlink.c b/lib/libnetlink.c index 4ba6019..cfeb894 100644 --- a/lib/libnetlink.c +++ b/lib/libnetlink.c @@ -644,7 +644,7 @@ int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) { memset(tb, 0, sizeof(struct rtattr *) * (max + 1)); while (RTA_OK(rta, len)) { - if (rta->rta_type <= max) + if ((rta->rta_type <= max) && (!tb[rta->rta_type])) tb[rta->rta_type] = rta; rta = RTA_NEXT(rta,len); }