[PATCH 2/3] libnl-tiny: Add NLA_PUT_S32()
Hauke Mehrtens
hauke at hauke-m.de
Sun Dec 12 13:17:34 PST 2021
This function is used by iw 5.16.
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
package/libs/libnl-tiny/Makefile | 2 +-
.../patches/0001-attr.h-Add-NLA_PUT_S32.patch | 62 +++++++++++++++++++
2 files changed, 63 insertions(+), 1 deletion(-)
create mode 100644 package/libs/libnl-tiny/patches/0001-attr.h-Add-NLA_PUT_S32.patch
diff --git a/package/libs/libnl-tiny/Makefile b/package/libs/libnl-tiny/Makefile
index bdb496c48e60..7fe8b5c5f708 100644
--- a/package/libs/libnl-tiny/Makefile
+++ b/package/libs/libnl-tiny/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libnl-tiny
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/libnl-tiny.git
diff --git a/package/libs/libnl-tiny/patches/0001-attr.h-Add-NLA_PUT_S32.patch b/package/libs/libnl-tiny/patches/0001-attr.h-Add-NLA_PUT_S32.patch
new file mode 100644
index 000000000000..517d4b5c1565
--- /dev/null
+++ b/package/libs/libnl-tiny/patches/0001-attr.h-Add-NLA_PUT_S32.patch
@@ -0,0 +1,62 @@
+From f4e190cfed119fcf8db4870b0a86dd6ba95034a8 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke at hauke-m.de>
+Date: Sun, 21 Nov 2021 00:08:55 +0100
+Subject: [PATCH] attr.h: Add NLA_PUT_S32
+
+This function is used by iw now.
+
+Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
+---
+ include/netlink/attr.h | 34 ++++++++++++++++++++++++++++++++++
+ 1 file changed, 34 insertions(+)
+
+--- a/include/netlink/attr.h
++++ b/include/netlink/attr.h
+@@ -299,6 +299,31 @@ static inline uint16_t nla_get_u16(struc
+ }
+
+ /**
++ * Add 32 bit signed integer attribute to netlink message.
++ * @arg msg Netlink message.
++ * @arg attrtype Attribute type.
++ * @arg value Numeric value to store as payload.
++ *
++ * @see nla_put
++ * @return 0 on success or a negative error code.
++ */
++static inline int nla_put_s32(struct nl_msg *msg, int attrtype, int32_t value)
++{
++ return nla_put(msg, attrtype, sizeof(int32_t), &value);
++}
++
++/**
++ * Return payload of 32 bit signed integer attribute.
++ * @arg nla 32 bit integer attribute.
++ *
++ * @return Payload as 32 bit integer.
++ */
++static inline int32_t nla_get_s32(struct nlattr *nla)
++{
++ return *(int32_t *) nla_data(nla);
++}
++
++/**
+ * Add 32 bit integer attribute to netlink message.
+ * @arg msg Netlink message.
+ * @arg attrtype Attribute type.
+@@ -632,6 +657,15 @@ static inline size_t nla_strlcpy(char *d
+ NLA_PUT_TYPE(msg, uint16_t, attrtype, value)
+
+ /**
++ * Add 32 bit signed integer attribute to netlink message.
++ * @arg msg Netlink message.
++ * @arg attrtype Attribute type.
++ * @arg value Numeric value.
++ */
++#define NLA_PUT_S32(msg, attrtype, value) \
++ NLA_PUT_TYPE(msg, int32_t, attrtype, value)
++
++/**
+ * Add 32 bit integer attribute to netlink message.
+ * @arg msg Netlink message.
+ * @arg attrtype Attribute type.
--
2.30.2
More information about the openwrt-devel
mailing list