From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.179 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796306017; b=gXooWoIWu86oSx6Dr4OfaKtPcmUqgGCpN677tfDMFHhkLevNpQkfEE1Kbh9FbzagvkbQ 6DXowWwmVdunHqkA2qAdPNW+6hcN0QEHdBEFa0ueZzZaSYOBvsDHRC/GQx6cGjJ2+iLnr TJu6gqevYWc60GxlM0xR/Q8XhUFja+r24C8GtWKNF3yQ09YLOe59H77iTKqrHUAiqBFSX u+Q2k3TpIuUPqaJrrwWo4xcPcoZ/yqYQt6OrmvGPuOb7aqyFcwx6x16n5avF0yAyJ6mWb Z1mQn8zLtM9rYRIOBrtXjEZ8uT8VcLPnlrdbjZS+lxbwIsK8GD2goZfWIirwVJq+rQQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796306017; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Subject:Date: Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=7PDY2lcRaomoqUTr5jhRIDKzYxtKaePPHCQDsDxeito=; b=OHYmR3nTsoe+EI/5h1Tz5rgXS6gSMQ7nupAkwc0NOIg+gdnGevdo5EZIDdY9RvQ/lhvc 3UQVfcQGK9f1IDDc/cF/Qo5hRo8jQAsjRlmhXAi2eCfN1qNyjQ1y7O3FmVQJOpN9e+abR qlF0KrE5oTd0sBu1t+8HCG6Yq1PkWk4pE34RqaPUkS9z3WbriwDHMgoSoDstLnWh2+VGa 20anEwh9IdVSLnDEYLN3keTDBkfxPiSgFsMJ+WmWHc8/6wQ9RLMjHV6SqrN3/PXgplpDA c1F2hh4naCIccwKVYnvPwch567JrskRGNMgHQhUTlxFKHuc1PRlvUpapDAkH+IDUt1A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=xPFFsmg9; arc=none smtp.remote-ip=74.125.82.179 Received: from mail-dy1-f179.google.com (mail-dy1-f179.google.com [74.125.82.179]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30C19606A322 for ; Thu, 3 Dec 2026 13:53:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 30C19606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=xPFFsmg9 Received: by mail-dy1-f179.google.com with SMTP id 5a478bee46e88-385d8a00598so24730033eec.1 for ; Thu, 03 Dec 2026 05:53:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796306016; x=1796910816; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=7PDY2lcRaomoqUTr5jhRIDKzYxtKaePPHCQDsDxeito=; b=xPFFsmg9TtFt4VGiY1JazQ/9HCGE5uAmcPBVPU8S0fIdUcarwiLCBPYTeylBtp2alL G87iBe9PEEZHW1qCUMUMVeidEig1N3reVAvuFjLNUS3dPAPQ9s7zAXNwieaoeFtw+89R EZiU94IkUtBbDGfCOBK8ksoexFSyz0GqWGGYuIkP5E1WPGlBRYERWBGz8BDQFAxPpLvv 8EFAtCSRzmx40dkD2PdqKmML9A6BGOIBpd/1G/c1EyvvvpPenw5bob+Hpd84MdKSaFxK rZq3mMmtrHF2iRT9zl2JBzikxVCo3HtHl/G0K3PsZ1S9oTLMnZaMpauDBPBvoUewi5Va K/EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796306016; x=1796910816; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=7PDY2lcRaomoqUTr5jhRIDKzYxtKaePPHCQDsDxeito=; b=cDa2WfB9829Vi1MDePKBMF0ZWkeQ6VZo3/GrHhRGuRV80PTH7Y3vy/myqum2XpwIxH fI83sVGBGIGypPksLVWdYQeAufKB7+U+wy9mT9CHzBw5sVT0Q8YIX7xSKfcH9Kw3x/M9 DJu8+W/n5MkiIfJIo6/YwD3nCBPaVCV2uU7I89h4z5Kn9WBXGbza2wCo6SqkwkEJPuHm jhlrhmLo5l9ow8T9cU4jGDBr/fu/yFJCDXnk2ID/bWj4x2ItQl4+vpTUjVPBqGS2rhcB hWzPN9ljaWd6gtnjiEr7XOdvilLEUngxgk4Qv9zd5XwGlXhjkWTOPHgZaVW/kq3ZMCFg V6Cg== X-Gm-Message-State: APuU4Z9c6WmZ/p2Uby7ZIWdP2fmRNfsrTN2rdTKpXKeLXRyL9YLyTNf4 zoiPCkquPDb7cGMbFo68W5JoegkSQ7SFoHoqTJFO9oPx1PikMkfZVP7CW7xn4UKt/T4= X-Gm-Gg: AZFdTZcAUtvZFqxjpZcsXJnqJwwDE5FnyaCtCSVy1kmTD/780K3CEDw+coc9nMFotde 6F8Qj3nSr5mWRCwR2jUUKg915vIEhZJa6tUrsnlbq5+p9aB3cpe1jHR1TCOgSVXxfYQkXtN1aCN ZXEEbII0x/nKRUkpvIvgdYariELrF2oxDWOCts4uf7tahPvcg6cpxPe6orRmtjOfpR+OgIc69jq S3jSXB6X2tg1J/Bd4WFDQSzJpzTQdrZKdi07k6PDZuxkT0R7Clm0TCox+u1dt0auhU/6QY7F7g7 lCLN7YUeLNI1LAMjDWcWiyyn8U19i0zXxt8MHGLCPOYvRQFflq/mn27WMdqBaPAhCZt4seXIBCu paUkvXNUkvHy4SM5Z251sIt6O77HfI/FxvplFWxTSwGYCHIfSzQqywhQ1oPaTxqEDmBkdE25cih a1Z5ECVdyr9sPg9cIHaQaL9CM6/KbIC3A4lcm2L/82TewU+OdwE7CrNPrK1rVV9A94CDlPxVzuW hw0kMcIgfqZFOxnCLwxtst/37sgnBRBkoMT+axSKUS8jnfiHOD/JFkE7mgem+PxAWSLhhIrFxzS upax/571/3RmxGhBsVoFUTbgwAso4R8r85oGAtyP+e/5ThmloNPAo1n5tsVX4z4j+2l0xvxQYPK nVRfZ8KG/cGMXRXT63BLZ5dJQe428ytcSYGvBu/Y= X-Received: by 2002:a05:7301:488d:b0:366:83dd:46f7 with SMTP id 5a478bee46e88-3856f85220amr45344176eec.17.1796306015854; Thu, 03 Dec 2026 05:53:35 -0800 (PST) Received: from zibuyu-fedora ([38.255.17.51]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-38707b612cbsm78770404eec.4.2026.12.03.05.53.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 05:53:35 -0800 (PST) From: zibuyu To: mptcp@lists.linux.dev Subject: [PATCH mptcp-next v2] selftests: mptcp: cover mixed accepts on one listener Date: Thu, 3 Dec 2026 21:51:51 +0800 Message-ID: <179630585724.2.6064655453761563853@gmail.com> X-Mailer: git-send-email 2.56.1 X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The socket option test handles one MPTCP connection per listener. It leaves the passive TCP fallback path untested when other children of the same listener negotiate MPTCP. Connect an MPTCP client, a TCP client and another MPTCP client to the same listener. Keep all three connections open, check SO_PROTOCOL on each accepted socket and verify that it reads its own client's byte. The existing socket option test runs this sequence for IPv4 and IPv6. OpenAI Codex generated the test and ran the socket option selftests. Link: https://github.com/multipath-tcp/mptcp_net-next/issues/426 Signed-off-by: zibuyu --- Changes in v2: - Include kselftest.h for ARRAY_SIZE(). With the UAPI headers installed, resolves to the exported header and the build fails. Built the MPTCP selftests with the installed UAPI headers. All 11 mptcp_sockopt.sh subtests passed, including IPv4 and IPv6. The host kernel skipped the optional IP_RECVERR and IPV6_RECVERR checks. v1: https://lore.kernel.org/mptcp/20261203094509.3382752-1-zibuyu423@gmail.com/ tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 54 ++++++++++++++++++----- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c index b8158a1..aa90fe5 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c @@ -27,6 +27,8 @@ #include #include +#include "../../kselftest.h" + static int pf = AF_INET; #ifndef IPPROTO_MPTCP @@ -705,22 +707,49 @@ static int xaccept(int s) return fd; } -static int server(int pipefd) +static void test_mixed_accept(int listener, const char *addr, const char *port) { - int fd = -1, r; + static const int protos[] = { IPPROTO_MPTCP, IPPROTO_TCP, IPPROTO_MPTCP }; + int clients[ARRAY_SIZE(protos)], accepted[ARRAY_SIZE(protos)]; + size_t i; - switch (pf) { - case AF_INET: - fd = sock_listen_mptcp("127.0.0.1", "15432"); - break; - case AF_INET6: - fd = sock_listen_mptcp("::1", "15432"); - break; - default: - xerror("Unknown pf %d\n", pf); - break; + for (i = 0; i < ARRAY_SIZE(protos); i++) { + char tag = 'A' + i; + + clients[i] = sock_connect_mptcp(addr, port, protos[i]); + accepted[i] = xaccept(listener); + if (write(clients[i], &tag, 1) != 1) + die_perror("write client tag"); } + /* Check each child while the negotiated and fallback sockets coexist. */ + for (i = 0; i < ARRAY_SIZE(protos); i++) { + int proto; + socklen_t len = sizeof(proto); + char tag; + + if (getsockopt(accepted[i], SOL_SOCKET, SO_PROTOCOL, &proto, &len)) + die_perror("getsockopt SO_PROTOCOL"); + if (proto != protos[i]) + xerror("accept %zu: got protocol %d, expected %d", i, proto, protos[i]); + + if (read(accepted[i], &tag, 1) != 1 || tag != 'A' + i) + xerror("accept %zu: did not receive its client tag", i); + } + + for (i = 0; i < ARRAY_SIZE(protos); i++) { + close(accepted[i]); + close(clients[i]); + } +} + +static int server(int pipefd) +{ + const char *addr = pf == AF_INET6 ? "::1" : "127.0.0.1"; + const char *port = "15432"; + int fd, r; + + fd = sock_listen_mptcp(addr, port); r = write(pipefd, "conn", 4); assert(r == 4); @@ -728,6 +757,7 @@ static int server(int pipefd) r = xaccept(fd); process_one_client(r, pipefd); + test_mixed_accept(fd, addr, port); close(fd); return 0;