From: Williams, Mitch A Date: Wed, 10 Feb 2010 01:46:47 +0000 (+0000) Subject: libnetlink: Modify the parser to track first duplicated attributes X-Git-Tag: v2.6.34~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e46ec813b7f06a85acb5a348dfc1a25ea488024;p=thirdparty%2Fiproute2.git libnetlink: Modify the parser to track first duplicated attributes 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 --- diff --git a/lib/libnetlink.c b/lib/libnetlink.c index 4ba60190d..cfeb8941c 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); }