]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
libnetlink: Add helper for getting a __s32 from netlink msgs
authorJesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Fri, 5 Oct 2018 23:25:19 +0000 (16:25 -0700)
committerDavid Ahern <dsahern@gmail.com>
Sun, 7 Oct 2018 17:31:35 +0000 (10:31 -0700)
This function retrieves a signed 32-bit integer from a netlink message
and returns it.

Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
include/libnetlink.h

index a133470ca7e0f85fd7c5964f901d200e2e73c145..04264b871ce45d3b19e44bfee338a8db07fdbfd1 100644 (file)
@@ -203,6 +203,10 @@ static inline __u64 rta_getattr_u64(const struct rtattr *rta)
        memcpy(&tmp, RTA_DATA(rta), sizeof(__u64));
        return tmp;
 }
+static inline __s32 rta_getattr_s32(const struct rtattr *rta)
+{
+       return *(__s32 *)RTA_DATA(rta);
+}
 static inline __s64 rta_getattr_s64(const struct rtattr *rta)
 {
        __s64 tmp;