From patchwork Fri Dec 15 02:36:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Safonov X-Patchwork-Id: 755053 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDCF5EBB for ; Fri, 15 Dec 2023 02:37:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=arista.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arista.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arista.com header.i=@arista.com header.b="EnUQUHLs" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-40c39e936b4so2228875e9.1 for ; Thu, 14 Dec 2023 18:37:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=google; t=1702607841; x=1703212641; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=bYz2YDovoffYMSa4/zt2c6fJDejkIPeUObMVDQAFjYg=; b=EnUQUHLso2bJoZzpVpsdG4ctct12GXL3By9n82TGmsW2NIrDsDZTXBooFmNqLj/25g dY9q2tsQD36GKwqj/tTawg8Hlm9ujzPmrc5n1P8i6dQU/7lD73irHbr3KAx8ceJJOj3+ RpU3m4b7y5yzzgcm+d2Jcijecx2VRIseKm0kRrNU5cNA/37n6etEnuFQqOKTMa0tmBMO fbsu56nK1I5mnmFzy5/2l8a34EYY/lXsJbyw2iNC5f0Zx5y9TpAYIZYCWaRG2HIsxRVA B3B6yaAklgpRvTT/XcJy74KkerY8JAJQFkmG1807TxYEqrkJrpOnoFLCT39NA4h9Ki1u 2xwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702607841; x=1703212641; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bYz2YDovoffYMSa4/zt2c6fJDejkIPeUObMVDQAFjYg=; b=saIKYXuYpJCz+vJ05zBmdJDxAdVy1qAmJ0CqVkFEZ0/nje7FadZjBY+dEhDe06WItr aUnNSHVrYMw9q/QeRu6Xr1/Jq2jb5CxFPXvf0xAoYC0aQf3lWt2bMqKdkFoCcvJy/ndU l6nZgHx9DjVf1xhtkX0tJY2uIwBLk9ZiUJ2JN2R8I3JGzN3VX7SfwnalYn3CFQXNjoJ6 I0Hws5mTo49ie9GGRIO4cYIVqNJ7YMKTVSbZHr+nMNSGVMHpaTQh/EPFoUrSO3ot/6Z6 yDBA5pwLk/Him6XkCBy0dQA47mr70+9JNTXO26p4/BLXMBfA+mIqnP0FPsDnZoNdOWxS VJHg== X-Gm-Message-State: AOJu0Yz9wD8UUUHse4u/oHSjhn/IwzJqnGU83ai5BdscoNqw+ndD9iRE xIAJ0qfJ5FAiHLgJxGm15j5T0Q== X-Google-Smtp-Source: AGHT+IF86Mjo74VxERkyFN6vt9WC45W73e0nDA7ynhnMhCCC7OmOqa7UZVr24CynY0BJeTZO/2khnQ== X-Received: by 2002:a05:600c:468d:b0:40b:5f03:b448 with SMTP id p13-20020a05600c468d00b0040b5f03b448mr2985045wmo.362.1702607840937; Thu, 14 Dec 2023 18:37:20 -0800 (PST) Received: from Mindolluin.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id fc17-20020a05600c525100b0040c42681fcesm20096363wmb.15.2023.12.14.18.37.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 18:37:20 -0800 (PST) From: Dmitry Safonov To: Shuah Khan , David Ahern , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Dmitry Safonov , Salam Noureddine , Bob Gilligan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com> Subject: [PATCH 00/12] selftests/net: Add TCP-AO tests Date: Fri, 15 Dec 2023 02:36:14 +0000 Message-ID: <20231215-tcp-ao-selftests-v1-0-f6c08180b985@arista.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.13-dev-b6b4b X-Developer-Signature: v=1; a=ed25519-sha256; t=1702607832; l=9521; i=dima@arista.com; s=20231212; h=from:subject:message-id; bh=W1hsIMO4LWnCVygW8noyKhfTOhAmhJbmRGN9bR0Kyic=; b=UYvU7yeQKvGEO6P+PhMVNO2YTTolMsXDTJQzjUR6ysys853p5jc6zcd9VFl6taZISs1rKfXSE pERiA1wgd7JAuT62ZDTtllhvCqkXkVzY/giYpbeTQ7DX0/8/u5Zfl+p X-Developer-Key: i=dima@arista.com; a=ed25519; pk=hXINUhX25b0D/zWBKvd6zkvH7W2rcwh/CH6cjEa3OTk= Hi, An essential part of any big kernel submissions is selftests. At the beginning of TCP-AO project, I made patches to fcnal-test.sh and nettest.c to have the benefits of easy refactoring, early noticing breakages, putting a moat around the code, documenting and designing uAPI. While tests based on fcnal-test.sh/nettest.c provided initial testing* and were very easy to add, the pile of TCP-AO quickly grew out of one-binary + shell-script testing. The design of the TCP-AO testing is a bit different than one-big selftest binary as I did previously in net/ipsec.c. I found it beneficial to avoid implementing a tests runner/scheduler and delegate it to the user or Makefile. The approach is very influenced by CRIU/ZDTM testing[1]: it provides a static library with helper functions and selftest binaries that create specific scenarios. I also tried to utilize kselftest.h. test_init() function does all needed preparations. To not leave any traces after a selftest exists, it creates a network namespace and if the test wants to establish a TCP connection, a child netns. The parent and child netns have veth pair with proper ip addresses and routes set up. Both peers, the client and server are different pthreads. The treading model was chosen over forking mostly by easiness of cleanup on a failure: no need to search for children, handle SIGCHLD, make sure not to wait for a dead peer to perform anything, etc. Any thread that does exit() naturally kills the tests, sweet! The selftests are compiled currently in two variants: ipv4 and ipv6. Ipv4-mapped-ipv6 addresses might be a third variant to add, but it's not there in this version. As pretty much all tests are shared between two address families, most of the code can be shared, too. To differ in code what kind of test is running, Makefile supplies -DIPV6_TEST to compiler and ifdeffery in tests can do things that have to be different between address families. This is similar to TARGETS_C_BOTHBITS in x86 selftests and also to tests code sharing in CRIU/ZDTM. The total number of tests is 832. Tested-by: Hangbin Liu