diff options
Diffstat (limited to 'src/platform/nm-netlink.h')
| -rw-r--r-- | src/platform/nm-netlink.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/platform/nm-netlink.h b/src/platform/nm-netlink.h index 185269ba..187685d8 100644 --- a/src/platform/nm-netlink.h +++ b/src/platform/nm-netlink.h @@ -62,7 +62,7 @@ nl_errno (int err) * normalizes the error and returns its positive value. */ return err >= 0 ? err - : ((err == G_MININT) ? NLE_BUG : -errno); + : ((err == G_MININT) ? NLE_BUG : -err); } static inline int @@ -177,6 +177,12 @@ nla_get_u8 (const struct nlattr *nla) } static inline uint8_t +nla_get_s8 (const struct nlattr *nla) +{ + return *(const int8_t *) nla_data (nla); +} + +static inline uint8_t nla_get_u8_cond (/*const*/ struct nlattr *const*tb, int attr, uint8_t default_val) { nm_assert (tb); @@ -197,6 +203,12 @@ nla_get_u32(const struct nlattr *nla) return *(const uint32_t *) nla_data (nla); } +static inline int32_t +nla_get_s32(const struct nlattr *nla) +{ + return *(const int32_t *) nla_data (nla); +} + uint64_t nla_get_u64 (const struct nlattr *nla); static inline char * @@ -232,12 +244,18 @@ nla_put_string (struct nl_msg *msg, int attrtype, const char *str) #define NLA_PUT_U8(msg, attrtype, value) \ NLA_PUT_TYPE(msg, uint8_t, attrtype, value) +#define NLA_PUT_S8(msg, attrtype, value) \ + NLA_PUT_TYPE(msg, int8_t, attrtype, value) + #define NLA_PUT_U16(msg, attrtype, value) \ NLA_PUT_TYPE(msg, uint16_t, attrtype, value) #define NLA_PUT_U32(msg, attrtype, value) \ NLA_PUT_TYPE(msg, uint32_t, attrtype, value) +#define NLA_PUT_S32(msg, attrtype, value) \ + NLA_PUT_TYPE(msg, int32_t, attrtype, value) + #define NLA_PUT_U64(msg, attrtype, value) \ NLA_PUT_TYPE(msg, uint64_t, attrtype, value) @@ -296,8 +314,6 @@ struct nl_msg *nlmsg_alloc (void); struct nl_msg *nlmsg_alloc_size (size_t max); -struct nl_msg *nlmsg_alloc_inherit (struct nlmsghdr *hdr); - struct nl_msg *nlmsg_alloc_convert (struct nlmsghdr *hdr); struct nl_msg *nlmsg_alloc_simple (int nlmsgtype, int flags); |