From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3597F567C for ; Tue, 15 Aug 2023 06:24:10 +0000 (UTC) Received: from out-65.mta1.migadu.com (out-65.mta1.migadu.com [IPv6:2001:41d0:203:375::41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A6F8183 for ; Mon, 14 Aug 2023 23:24:06 -0700 (PDT) Message-ID: <00809f4a-e7ca-bf53-7824-e22791ee6738@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692080644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RXs3mjgqnXvJbDWmMqsJFyBV4L79LKcBz77qKeWFKs0=; b=n5Z7aeODmFnpxRq1tq/1towSY5Vnmq8J3If4HVdOILRY9tGldVJelfEK7OflTEghT2ylaT FwevqkJ08/wDoAnDCisAFJIVXCpY4HjTBwvs77ikhfhubWGREzp6Yk3cZTkumhx89307Ls TZY9i5fhGm35TwOvttEx3Cm5S6DlzyQ= Date: Mon, 14 Aug 2023 23:23:49 -0700 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH mptcp-next v13 4/4] selftests/bpf: Add mptcpify test Content-Language: en-US To: Geliang Tang Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, linux-kselftest@vger.kernel.org, Yonghong Song , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Florent Revest , Brendan Jackman , Matthieu Baerts , Mat Martineau , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , Eric Paris , Mykola Lysenko , Shuah Khan , Simon Horman References: <15a618b03f65177166adf2850d4159cd4b77dfb1.1691808484.git.geliang.tang@suse.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: <15a618b03f65177166adf2850d4159cd4b77dfb1.1691808484.git.geliang.tang@suse.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net On 8/11/23 7:54 PM, Geliang Tang wrote: > +static int verify_mptcpify(int server_fd) > +{ > + socklen_t optlen; > + char cmd[256]; > + int protocol; > + int err = 0; > + > + optlen = sizeof(protocol); > + if (!ASSERT_OK(getsockopt(server_fd, SOL_SOCKET, SO_PROTOCOL, &protocol, &optlen), > + "getsockopt(SOL_PROTOCOL)")) > + return -1; > + > + if (!ASSERT_EQ(protocol, IPPROTO_MPTCP, "protocol isn't MPTCP")) > + err++; > + > + /* Output of nstat: > + * > + * #kernel > + * MPTcpExtMPCapableSYNACKRX 1 0.0 > + */ > + snprintf(cmd, sizeof(cmd), > + "ip netns exec %s nstat -asz %s | awk '%s' | grep -q '%s'", > + NS_TEST, "MPTcpExtMPCapableSYNACKRX", > + "NR==1 {next} {print $2}", "1"); Is the mp-capable something that the regular mptcp user want to learn from a fd also? Does it have a simpler way like to learn this, eg. getsockopt(fd, SOL_MPTCP, MPTCP_xxx), instead of parsing text output? > + if (!ASSERT_OK(system(cmd), "No MPTcpExtMPCapableSYNACKRX found!"))