[03/12] netlink: add nla_get_s32()

Submitted by Andrei Vagin on Feb. 28, 2017, 11:52 p.m.

Details

Message ID 1488325988-28456-4-git-send-email-avagin@openvz.org
State New
Series "Dump and restore internal veth devices"
Headers show

Commit Message

Andrei Vagin Feb. 28, 2017, 11:52 p.m.
From: Andrei Vagin <avagin@virtuozzo.com>

This function was added into libnl3 recently,
but we have to support old versions of this library.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
---
 criu/include/libnetlink.h | 2 ++
 criu/libnetlink.c         | 5 +++++
 2 files changed, 7 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/include/libnetlink.h b/criu/include/libnetlink.h
index b2980ff..bf2eb24 100644
--- a/criu/include/libnetlink.h
+++ b/criu/include/libnetlink.h
@@ -11,6 +11,8 @@  extern int do_rtnl_req(int nl, void *req, int size,
 extern int addattr_l(struct nlmsghdr *n, int maxlen, int type,
 		const void *data, int alen);
 
+extern int32_t nla_get_s32(const struct nlattr *nla);
+
 #define NLMSG_TAIL(nmsg) \
 	((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
 
diff --git a/criu/libnetlink.c b/criu/libnetlink.c
index f585f09..986a05b 100644
--- a/criu/libnetlink.c
+++ b/criu/libnetlink.c
@@ -219,3 +219,8 @@  int __wrap_nlmsg_parse(struct nlmsghdr *nlh, int hdrlen, struct nlattr *tb[],
 	return nla_parse(tb, maxtype, nlmsg_attrdata(nlh, hdrlen),
 			 nlmsg_attrlen(nlh, hdrlen), policy);
 }
+
+int32_t nla_get_s32(const struct nlattr *nla)
+{
+        return *(const int32_t *) nla_data(nla);
+}