summaryrefslogtreecommitdiffstats
path: root/meta-oe
diff options
context:
space:
mode:
authorLi Zhou <li.zhou@windriver.com>2019-09-02 13:42:46 +0800
committerKhem Raj <raj.khem@gmail.com>2019-09-02 12:52:45 -0700
commita7c19fc9a45b5a1f4d9a91f14184eb7d51b03800 (patch)
treee39e493f342ce58b61885dd86234bb93a346556e /meta-oe
parentdc66ca8495eb051e1e6de5333e36f7f8054094a1 (diff)
downloadmeta-openembedded-a7c19fc9a45b5a1f4d9a91f14184eb7d51b03800.tar.gz
tipcutils: ptts: Set recv buffer size to max to receive as many packets as possible
Flooding multicast may make the rcv buffer overrun and is considered premature messages later and thus cause the following error. "Ignoring premature msg 16, currently handling 12" This patch sets SO_RCVBUF the of socket to max int value to receive as many packets as possible, and give a hint to user when possible overrun occurs. Note that the value of SO_RCVBUF will be limited up to min(INT_MAX/2, sysctl_rmem_max) in kernel. Signed-off-by: Li Zhou <li.zhou@windriver.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe')
-rw-r--r--meta-oe/recipes-extended/tipcutils/tipcutils/0001-test-ptts-Set-recv-buffer-size-too-max-to-receive-as.patch66
-rw-r--r--meta-oe/recipes-extended/tipcutils/tipcutils_git.bb1
2 files changed, 67 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/tipcutils/tipcutils/0001-test-ptts-Set-recv-buffer-size-too-max-to-receive-as.patch b/meta-oe/recipes-extended/tipcutils/tipcutils/0001-test-ptts-Set-recv-buffer-size-too-max-to-receive-as.patch
new file mode 100644
index 000000000..39f899cf1
--- /dev/null
+++ b/meta-oe/recipes-extended/tipcutils/tipcutils/0001-test-ptts-Set-recv-buffer-size-too-max-to-receive-as.patch
@@ -0,0 +1,66 @@
1From 4e4c8c7a1cca2125e2bf2a67cbab0bdbd78fdb86 Mon Sep 17 00:00:00 2001
2From: He Zhe <zhe.he@windriver.com>
3Date: Tue, 30 Jul 2019 13:24:22 +0800
4Subject: [PATCH] ptts: Set recv buffer size too max to receive as many
5 packets as possible
6
7Flooding multicast may make the rcv buffer overrun and is considered
8premature messages later and thus cause the following error.
9
10"Ignoring premature msg 16, currently handling 12"
11
12This patch sets SO_RCVBUF the of socket to max int value to receive as many
13packets as possible, and give a hint to user when possible overrun occurs. Note
14that the value of SO_RCVBUF will be limited up to min(INT_MAX/2,
15sysctl_rmem_max) in kernel.
16
17Signed-off-by: He Zhe <zhe.he@windriver.com>
18
19Upstream-Status: Backport
20
21Signed-off-by: Li Zhou <li.zhou@windriver.com>
22---
23 ptts/tipc_ts_server.c | 18 ++++++++++++++++--
24 1 file changed, 16 insertions(+), 2 deletions(-)
25
26diff --git a/ptts/tipc_ts_server.c b/ptts/tipc_ts_server.c
27index a286daa..3a2f96f 100644
28--- a/ptts/tipc_ts_server.c
29+++ b/ptts/tipc_ts_server.c
30@@ -641,8 +641,9 @@ void server_mcast
31 if (rc < 0)
32 err("multicast message not received");
33 if (msgno != *(int*) buf) {
34- dbg1("Ignoring premature msg %u, currently handling %u\n",
35- *(int*)buf, msgno);
36+ dbg1("Ignoring premature msg %u, currently handling %u\n"
37+ "You can enlarge /proc/sys/net/core/rmem_max and try again\n",
38+ *(int*)buf, msgno);
39 continue;
40 }
41 rc = recvfrom(sd[i], buf, expected_szs[numSubTest],
42@@ -687,8 +688,21 @@ void server_test_multicast(void)
43 FD_ZERO(&readfds);
44
45 for (i = 0; i < TIPC_MCAST_SOCKETS; i++) {
46+ int optval = (int)(~0U >> 1);
47+ socklen_t optlen = sizeof(optval);
48+ int rc = 0;
49+
50 sd[i] = createSocketTIPC (SOCK_RDM);
51 FD_SET(sd[i], &readfds);
52+
53+ /*
54+ * Flooding multicast may make the rcv buffer overrun and considered premature msg later.
55+ * Set SO_RCVBUF to max int value to receive as many packets as possible.
56+ * Note that it will be limited up to min(INT_MAX/2, sysctl_rmem_max) in kernel.
57+ */
58+ rc = setsockopt(sd[i], SOL_SOCKET, SO_RCVBUF, (const char*)&optval, optlen);
59+ if(rc != 0)
60+ printf("Failed to set SO_RCVBUF of %d: %s\n", sd[i], strerror(errno));
61 }
62
63 server_bindMulticast( 0, 99, sd[0]);
64--
652.17.1
66
diff --git a/meta-oe/recipes-extended/tipcutils/tipcutils_git.bb b/meta-oe/recipes-extended/tipcutils/tipcutils_git.bb
index 054e0acc8..637770af2 100644
--- a/meta-oe/recipes-extended/tipcutils/tipcutils_git.bb
+++ b/meta-oe/recipes-extended/tipcutils/tipcutils_git.bb
@@ -6,6 +6,7 @@ SRC_URI = "git://git.code.sf.net/p/tipc/tipcutils \
6 file://0001-include-sys-select.h-for-FD_-definitions.patch \ 6 file://0001-include-sys-select.h-for-FD_-definitions.patch \
7 file://0002-replace-non-standard-uint-with-unsigned-int.patch \ 7 file://0002-replace-non-standard-uint-with-unsigned-int.patch \
8 file://0001-multicast_blast-tipcc-Fix-struct-type-for-TIPC_GROUP.patch \ 8 file://0001-multicast_blast-tipcc-Fix-struct-type-for-TIPC_GROUP.patch \
9 file://0001-test-ptts-Set-recv-buffer-size-too-max-to-receive-as.patch \
9 " 10 "
10SRCREV = "7ab2211b87414ba240b0b2e4af219c1057c9cf9a" 11SRCREV = "7ab2211b87414ba240b0b2e4af219c1057c9cf9a"
11PV = "2.2.0+git${SRCPV}" 12PV = "2.2.0+git${SRCPV}"