[PATCH] utils: Add translations for NETLINK_RDMA and NETLINK_CRYPTO
Tobias Klauser
tklauser at distanz.ch
Mon Apr 27 08:01:07 PDT 2015
Add translations for NETLINK_RDMA and NETLINK_CRYPTO to nlfamilies,
allowing to use nl_nlfamily2str() and nl_str2nlfamily() for these
families.
This makes it necessary to update the private copy of linux/netlink.h
and also includes the rename of NETLINK_INET_DIAG to NETLINK_SOCK_DIAG
in upstream commit 7f1fb60c4fc9fb29 ("inet_diag: Partly rename inet_ to
sock_") and the removal of the duplicate NLMSG_ALIGN in the
NLMSG_LENGTH() macro in upstream commit a88b9ce5ad4fc633 ("netlink:
remove duplicated NLMSG_ALIGN").
Signed-off-by: Tobias Klauser <tklauser at distanz.ch>
---
include/linux-private/linux/netlink.h | 9 ++++++---
lib/utils.c | 2 ++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/linux-private/linux/netlink.h b/include/linux-private/linux/netlink.h
index 3925254..8219d37 100644
--- a/include/linux-private/linux/netlink.h
+++ b/include/linux-private/linux/netlink.h
@@ -7,8 +7,8 @@
#define NETLINK_ROUTE 0 /* Routing/device hook */
#define NETLINK_UNUSED 1 /* Unused number */
#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
-#define NETLINK_FIREWALL 3 /* Firewalling hook */
-#define NETLINK_INET_DIAG 4 /* INET socket monitoring */
+#define NETLINK_FIREWALL 3 /* Unused number, formerly ip_queue */
+#define NETLINK_SOCK_DIAG 4 /* socket monitoring */
#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
#define NETLINK_XFRM 6 /* ipsec */
#define NETLINK_SELINUX 7 /* SELinux event notifications */
@@ -25,6 +25,9 @@
#define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */
#define NETLINK_ECRYPTFS 19
#define NETLINK_RDMA 20
+#define NETLINK_CRYPTO 21 /* Crypto layer */
+
+#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
#define MAX_LINKS 32
@@ -75,7 +78,7 @@ struct nlmsghdr {
#define NLMSG_ALIGNTO 4U
#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
-#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN))
+#define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN)
#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
diff --git a/lib/utils.c b/lib/utils.c
index 68ea762..ca11fea 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -603,6 +603,8 @@ static const struct trans_tbl nlfamilies[] = {
__ADD(NETLINK_GENERIC,generic),
__ADD(NETLINK_SCSITRANSPORT,scsitransport),
__ADD(NETLINK_ECRYPTFS,ecryptfs),
+ __ADD(NETLINK_RDMA,rdma),
+ __ADD(NETLINK_CRYPTO,crypto),
};
char * nl_nlfamily2str(int family, char *buf, size_t size)
--
2.2.2
More information about the libnl
mailing list