From 413c1e3fa03cb11dcf2e3b1449516d8ce555bf2f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 8 Aug 2022 17:37:45 +0200 Subject: [PATCH] platform/netlink: add NLA_NEST_END() helper macro It's upper case like NLA_PUT(), which also does a goto nla_put_failure; on error. Otherwise, the upper case naming is a bit odd. --- src/libnm-platform/nm-netlink.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libnm-platform/nm-netlink.h b/src/libnm-platform/nm-netlink.h index fd1450cc12..44ed70af75 100644 --- a/src/libnm-platform/nm-netlink.h +++ b/src/libnm-platform/nm-netlink.h @@ -354,6 +354,14 @@ void nla_nest_cancel(struct nl_msg *msg, const struct nlattr *attr); struct nlattr *nla_nest_start(struct nl_msg *msg, int attrtype); int nla_nest_end(struct nl_msg *msg, struct nlattr *start); +#define NLA_NEST_END(msg, nest_start) \ + G_STMT_START \ + { \ + if (nla_nest_end((msg), (nest_start)) < 0) \ + goto nla_put_failure; \ + } \ + G_STMT_END + int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head,