libnetlink: Add helper for getting a __s32 from netlink msgs

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>
This commit is contained in:
Jesus Sanchez-Palencia 2018-10-05 16:25:19 -07:00 committed by David Ahern
parent de63cd9044
commit d791f3ad86
1 changed files with 4 additions and 0 deletions

View 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;