[CRIU] [PATCH 03/12] netlink: add nla_get_s32()

Andrei Vagin avagin at openvz.org
Tue Feb 28 15:52:59 PST 2017


From: Andrei Vagin <avagin at 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 at virtuozzo.com>
---
 criu/include/libnetlink.h | 2 ++
 criu/libnetlink.c         | 5 +++++
 2 files changed, 7 insertions(+)

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);
+}
-- 
2.7.4



More information about the CRIU mailing list