From bbe1f68ded15a3579d26d8c3f23e9c3941296193 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Mon, 22 Nov 2010 21:51:48 +0100 Subject: attr: add mnl_attr_nest_cancel() This patch adds mnl_attr_nest_cancel() that allows to cancel the current nest that we are building. Signed-off-by: Pablo Neira Ayuso --- src/attr.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/attr.c') diff --git a/src/attr.c b/src/attr.c index 7357f43..16f390a 100644 --- a/src/attr.c +++ b/src/attr.c @@ -503,6 +503,19 @@ mnl_attr_nest_end(struct nlmsghdr *nlh, struct nlattr *start) start->nla_len = mnl_nlmsg_get_payload_tail(nlh) - (void *)start; } +/** + * mnl_attr_nest_cancel - cancel an attribute nest + * \param nlh pointer to the netlink message + * \param start pointer to the attribute nest returned by mnl_attr_nest_start() + * + * This function updates the attribute header that identifies the nest. + */ +EXPORT_SYMBOL void +mnl_attr_nest_cancel(struct nlmsghdr *nlh, struct nlattr *start) +{ + nlh->nlmsg_len -= mnl_nlmsg_get_payload_tail(nlh) - (void *)start; +} + /** * @} */ -- cgit v1.2.3