diff options
author | Thomas Haller <thaller@redhat.com> | 2022-08-08 17:37:45 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-08-09 08:02:41 +0200 |
commit | 413c1e3fa03cb11dcf2e3b1449516d8ce555bf2f (patch) | |
tree | a983b995fe2114cbfe43862ee1d8c7800bbedbfd | |
parent | 494b3d82c104903167395fa8fe61f7b263f0cc06 (diff) | |
download | NetworkManager-413c1e3fa03cb11dcf2e3b1449516d8ce555bf2f.tar.gz |
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.
-rw-r--r-- | src/libnm-platform/nm-netlink.h | 8 |
1 files changed, 8 insertions, 0 deletions
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, |