[PATCH 2/4] netlink: store MSG_CMSG_COMPAT flag in netlink_skb_parms

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Florian Westphal
Date: Monday, April 5, 2010 - 3:27 pm

This allows the netlink processing context to determine if the data
needs any 32 bit fixups.

Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 include/linux/netlink.h  |    1 +
 net/netlink/af_netlink.c |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 6eaca5e..031e528 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -164,6 +164,7 @@ struct netlink_skb_parms {
 	__u32			loginuid;	/* Login (audit) uid */
 	__u32			sessionid;	/* Session id (audit) */
 	__u32			sid;		/* SELinux security id */
+	bool			msg_compat;	/* Message needs 32bit fixups */
 };
 
 #define NETLINK_CB(skb)		(*(struct netlink_skb_parms*)&((skb)->cb))
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index beaada0..47c8314 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1339,6 +1339,9 @@ static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock,
 	NETLINK_CB(skb).dst_group = dst_group;
 	NETLINK_CB(skb).loginuid = audit_get_loginuid(current);
 	NETLINK_CB(skb).sessionid = audit_get_sessionid(current);
+#ifdef CONFIG_COMPAT_NETLINK_MESSAGES
+	NETLINK_CB(skb).msg_compat = !!(msg->msg_flags & MSG_CMSG_COMPAT);
+#endif
 	security_task_getsecid(current, &(NETLINK_CB(skb).sid));
 	memcpy(NETLINK_CREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
 
-- 
1.6.4.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v3 0/4] xfrm: add x86 CONFIG_COMPAT support, Florian Westphal, (Mon Apr 5, 3:27 pm)
[PATCH 1/4] netlink: append NLMSG_DONE to compatskb, too, Florian Westphal, (Mon Apr 5, 3:27 pm)
[PATCH 2/4] netlink: store MSG_CMSG_COMPAT flag in netlink ..., Florian Westphal, (Mon Apr 5, 3:27 pm)
[PATCH 3/4] xfrm: split nlmsg allocation and data copying, Florian Westphal, (Mon Apr 5, 3:27 pm)
[PATCH 4/4] xfrm: CONFIG_COMPAT support for x86 architecture, Florian Westphal, (Mon Apr 5, 3:27 pm)
Re: [PATCH v3 0/4] xfrm: add x86 CONFIG_COMPAT support, David Miller, (Wed Apr 7, 3:08 am)
Re: [PATCH v3 0/4] xfrm: add x86 CONFIG_COMPAT support, Florian Westphal, (Wed Apr 7, 6:35 am)
Re: [PATCH v3 0/4] xfrm: add x86 CONFIG_COMPAT support, Patrick McHardy, (Wed Apr 7, 6:45 am)
Re: [PATCH v3 0/4] xfrm: add x86 CONFIG_COMPAT support, David Miller, (Wed Apr 7, 4:48 pm)
Re: [PATCH v3 0/4] xfrm: add x86 CONFIG_COMPAT support, David Miller, (Wed Apr 7, 10:00 pm)
Re: [PATCH v3 0/4] xfrm: add x86 CONFIG_COMPAT support, Patrick McHardy, (Thu Apr 8, 2:44 am)
Re: [PATCH v3 0/4] xfrm: add x86 CONFIG_COMPAT support, David Miller, (Thu Apr 8, 2:54 am)
Re: [PATCH v3 0/4] xfrm: add x86 CONFIG_COMPAT support, Patrick McHardy, (Thu Apr 8, 4:24 am)
Re: [PATCH v3 0/4] xfrm: add x86 CONFIG_COMPAT support, David Miller, (Wed May 12, 11:41 pm)