diff options
author | Thomas Haller <thaller@redhat.com> | 2018-12-27 14:28:23 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-01-09 16:46:41 +0100 |
commit | fb79c79d872f941bae5603cf0832b1af7d456cce (patch) | |
tree | 012221dfb317e4c3731e3941a81594085bc77ea4 /src/platform/nm-netlink.h | |
parent | 7a105c2191a00f077539b4948453d032b9018097 (diff) | |
download | NetworkManager-fb79c79d872f941bae5603cf0832b1af7d456cce.tar.gz |
netlink: add nla_put() helpers to set integers
Diffstat (limited to 'src/platform/nm-netlink.h')
-rw-r--r-- | src/platform/nm-netlink.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/platform/nm-netlink.h b/src/platform/nm-netlink.h index f1f8394052..84bbe27b22 100644 --- a/src/platform/nm-netlink.h +++ b/src/platform/nm-netlink.h @@ -187,6 +187,24 @@ nla_put_string (struct nl_msg *msg, int attrtype, const char *str) return nla_put(msg, attrtype, strlen(str) + 1, str); } +static inline int +nla_put_uint8 (struct nl_msg *msg, int attrtype, uint8_t val) +{ + return nla_put (msg, attrtype, sizeof (val), &val); +} + +static inline int +nla_put_uint16 (struct nl_msg *msg, int attrtype, uint16_t val) +{ + return nla_put (msg, attrtype, sizeof (val), &val); +} + +static inline int +nla_put_uint32 (struct nl_msg *msg, int attrtype, uint32_t val) +{ + return nla_put (msg, attrtype, sizeof (val), &val); +} + #define NLA_PUT(msg, attrtype, attrlen, data) \ do { \ if (nla_put(msg, attrtype, attrlen, data) < 0) \ |