[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1411005311-11752-3-git-send-email-simon.horman@netronome.com>
Date: Thu, 18 Sep 2014 10:55:05 +0900
From: Simon Horman <simon.horman@...ronome.com>
To: dev@...nvswitch.org, netdev@...r.kernel.org
Cc: Pravin Shelar <pshelar@...ira.com>, Jesse Gross <jesse@...ira.com>,
Thomas Graf <tgraf@...g.ch>,
Simon Horman <simon.horman@...ronome.com>
Subject: [PATCH/RFC repost 2/8] netlink: Allow suppression of warnings for duplicate attributes
Add a multiple field to struct nl_policy which if set suppresses
warning of duplicate attributes in nl_parse_nested().
As is the case without this patch only the last occurrence of an
attribute is stored in attrs by nl_parse_nested(). As such
if the multiple field of struct nl_policy is set then it
is up to the caller to parse the message to extract all the attributes.
This is in preparation for allowing multiple OVS_SELECT_GROUP_ATTR_BUCKET
attributes in a nested OVS_ACTION_ATTR_SELECT_GROUP attribute.
Signed-off-by: Simon Horman <simon.horman@...ronome.com>
---
lib/netlink.c | 2 +-
lib/netlink.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/netlink.c b/lib/netlink.c
index 24b2168..bc30248 100644
--- a/lib/netlink.c
+++ b/lib/netlink.c
@@ -743,7 +743,7 @@ nl_policy_parse(const struct ofpbuf *msg, size_t nla_offset,
if (!nl_attr_validate(nla, e)) {
return false;
}
- if (attrs[type]) {
+ if (attrs[type] && !e->multiple) {
VLOG_DBG_RL(&rl, "duplicate attr %"PRIu16, type);
}
attrs[type] = nla;
diff --git a/lib/netlink.h b/lib/netlink.h
index f9234da..b0a72fd 100644
--- a/lib/netlink.h
+++ b/lib/netlink.h
@@ -195,6 +195,7 @@ struct nl_policy
enum nl_attr_type type;
size_t min_len, max_len;
bool optional;
+ bool multiple;
};
#define NL_POLICY_FOR(TYPE) \
--
2.0.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists