This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 3d5cbdbd8e9c71971c29b475f17c5ab2549bf730
Author: daichuan <[email protected]>
AuthorDate: Mon May 11 16:55:26 2026 +0800

    net/netlink: move the NLA type enum to the public header.
    
    The NLA_UNSPEC..NLA_TYPE_MAX enum described the attribute types of the
    netlink protocol itself, but lived in the private net/netlink/netlink.h,
    so an application had to redefine the values to build a netlink
    attribute policy.
    
    Move the enum to include/netpacket/netlink.h, next to the other netlink
    protocol definitions, and add NLMSG_ALIGNTO, which the attribute macros
    of libnl expect.
    
    No functional change: the only in-tree users are in net/netlink, which
    includes both headers.
    
    Assisted-by: Kiro:claude-opus-4
    Signed-off-by: daichuan <[email protected]>
---
 include/netpacket/netlink.h | 25 +++++++++++++++++++++++++
 net/netlink/netlink.h       | 24 ------------------------
 2 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/include/netpacket/netlink.h b/include/netpacket/netlink.h
index a6f85a4b71c..9d67b6d1aa7 100644
--- a/include/netpacket/netlink.h
+++ b/include/netpacket/netlink.h
@@ -116,6 +116,7 @@
 
 /* Definitions for struct nlmsghdr ******************************************/
 
+#define NLMSG_ALIGNTO                    4
 #define NLMSG_MASK                       (sizeof(uint32_t) - 1)
 #define NLMSG_ALIGN(n)                   (((n) + NLMSG_MASK) & ~NLMSG_MASK)
 #define NLMSG_HDRLEN                     sizeof(struct nlmsghdr)
@@ -592,6 +593,30 @@
  * Public Type Definitions
  ****************************************************************************/
 
+/* Standard attribute types to specify validation policy */
+
+enum
+{
+  NLA_UNSPEC,
+  NLA_U8,
+  NLA_U16,
+  NLA_U32,
+  NLA_U64,
+  NLA_STRING,
+  NLA_FLAG,
+  NLA_MSECS,
+  NLA_NESTED,
+  NLA_NESTED_COMPAT,
+  NLA_NUL_STRING,
+  NLA_BINARY,
+  NLA_S8,
+  NLA_S16,
+  NLA_S32,
+  NLA_S64,
+  NLA_BITFIELD32,
+  NLA_TYPE_MAX = NLA_BITFIELD32,
+};
+
 /* Netlink socket address type. */
 
 struct sockaddr_nl
diff --git a/net/netlink/netlink.h b/net/netlink/netlink.h
index 2f54a6f8f09..e06f5590212 100644
--- a/net/netlink/netlink.h
+++ b/net/netlink/netlink.h
@@ -205,30 +205,6 @@ struct netlink_conn_s
   sq_queue_t resplist;               /* Singly linked list of responses */
 };
 
-/* Standard attribute types to specify validation policy */
-
-enum
-{
-  NLA_UNSPEC,
-  NLA_U8,
-  NLA_U16,
-  NLA_U32,
-  NLA_U64,
-  NLA_STRING,
-  NLA_FLAG,
-  NLA_MSECS,
-  NLA_NESTED,
-  NLA_NESTED_COMPAT,
-  NLA_NUL_STRING,
-  NLA_BINARY,
-  NLA_S8,
-  NLA_S16,
-  NLA_S32,
-  NLA_S64,
-  NLA_BITFIELD32,
-  NLA_TYPE_MAX = NLA_BITFIELD32,
-};
-
 /* struct netlink_ext_ack - netlink extended ACK report struct
  * _msg: message string to report - don't access directly, use
  *  nl_set_err_msg_attr

Reply via email to