[Devel] [PATCH 4/5] netlink: skip pktinfo scm if a sender group is less than 32

Andrey Vagin avagin at openvz.org
Sat Feb 18 22:58:15 PST 2017


From: Andrei Vagin <avagin at virtuozzo.com>

nl_pktinfo control messages is used to  get the extended
destination group number.

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 criu/sk-queue.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/criu/sk-queue.c b/criu/sk-queue.c
index 88e47b8..8124f75 100644
--- a/criu/sk-queue.c
+++ b/criu/sk-queue.c
@@ -10,6 +10,7 @@
 #include <sys/socket.h>
 #include <sys/sendfile.h>
 #include <linux/socket.h>
+#include <linux/netlink.h>
 
 #include "common/list.h"
 #include "imgset.h"
@@ -127,6 +128,18 @@ static int dump_packet_cmsg(struct msghdr *mh, SkPacketEntry *pe, int flags)
 				return -1;
 			continue;
 		}
+		if (ch->cmsg_level == SOL_NETLINK &&
+		    ch->cmsg_type == NETLINK_PKTINFO &&
+		    ch->cmsg_len == CMSG_LEN(sizeof(struct nl_pktinfo))) {
+			struct nl_pktinfo *info = CMSG_DATA(ch);
+
+			/* Groups less than 32 are returned in msg_address */
+			if (info->group < 32)
+				continue;
+
+			pr_err("A sender group %d isn't supported\n", info->group);
+			return -1;
+		}
 		pr_err("cmsg: len %ld type %d level %d\n",
 			ch->cmsg_len, ch->cmsg_type, ch->cmsg_level);
 		pr_err("Control messages in queue, not supported\n");
-- 
1.8.3.1



More information about the Devel mailing list