From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 04DFD1F5B2; Sat, 29 Nov 2025 18:15:54 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 588A51F48E; Sat, 29 Nov 2025 18:15:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_PASS,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 Received: from mail.cyberchaos.dev (mail.cyberchaos.dev [IPv6:2a0f:4ac0::3a11]) by atuin.qyliss.net (Postfix) with ESMTPS id A1AD01F430 for ; Sat, 29 Nov 2025 18:15:34 +0000 (UTC) From: Yureka Lilian DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cyberchaos.dev; s=mail; t=1764440133; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sJMI578XQiegewfVzMHU6qqca/CNa2wCYd/E5wBXGIA=; b=rV+DluQmLSxHzQlbUxc2fxqGZOGPMz1m8N+FzWlqkQMex6HX7AAbmCMpCE8+LyqlSta4tg 2yZjSx8z65JQgxOnb2VtEAfT3vDJw6VScuAZnwzXIkgEot8b0YS6ikwBETSyX5uM2vBVel hknIxcvihG1L4yfH/xbyYoxdS+0MaJQ= To: devel@spectrum-os.org Subject: [PATCH v3 09/10] release/checks/integration: Adapt networking test for ipv6 Date: Sat, 29 Nov 2025 19:15:08 +0100 Message-ID: <20251129181514.20296-10-yureka@cyberchaos.dev> In-Reply-To: <20251129181514.20296-1-yureka@cyberchaos.dev> References: <20251129181514.20296-1-yureka@cyberchaos.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 6O63QJEHEGKW34RXM66BDM73FBJ4RUOA X-Message-ID-Hash: 6O63QJEHEGKW34RXM66BDM73FBJ4RUOA X-MailFrom: yureka@cyberchaos.dev X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; header-match-devel.spectrum-os.org-3; header-match-devel.spectrum-os.org-4; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Yureka Lilian , Alyssa Ross X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Yureka Lilian Reviewed-by: Alyssa Ross --- release/checks/integration/default.nix | 2 +- release/checks/integration/networking.c | 33 +++++++++++++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/release/checks/integration/default.nix b/release/checks/integration/default.nix index 842b707..f8aab8a 100644 --- a/release/checks/integration/default.nix +++ b/release/checks/integration/default.nix @@ -19,7 +19,7 @@ let type = "nix"; run = writeShellScript "run" '' set -x - while :; do echo hello | ${libressl.nc}/bin/nc -Nw 2 10.0.2.2 1234; done + while :; do echo hello | ${libressl.nc}/bin/nc -Nw 2 -6 fd00::2 1234; done ''; }; diff --git a/release/checks/integration/networking.c b/release/checks/integration/networking.c index 97d7895..bc75ece 100644 --- a/release/checks/integration/networking.c +++ b/release/checks/integration/networking.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: EUPL-1.2+ // SPDX-FileCopyrightText: 2025 Alyssa Ross +// SPDX-FileCopyrightText: 2025 Yureka Lilian #include "lib.h" @@ -12,21 +13,27 @@ #include #include +#include static int setup_server(void) { int fd; struct ifreq ifr; + struct in6_ifreq ifr6; - struct sockaddr_in addr = { - .sin_family = AF_INET, - .sin_port = htons(1234), - .sin_addr = { .s_addr = htonl(INADDR_LOOPBACK) }, + struct sockaddr_in6 addr = { + .sin6_family = AF_INET6, + .sin6_port = htons(1234), + .sin6_addr = { .s6_addr = { 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 } }, }; sprintf(ifr.ifr_name, "lo"); - if ((fd = socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0)) == -1) { + ifr6.ifr6_ifindex = 1; + ifr6.ifr6_addr = addr.sin6_addr; + ifr6.ifr6_prefixlen = 128; + + if ((fd = socket(AF_INET6, SOCK_STREAM|SOCK_CLOEXEC, 0)) == -1) { perror("socket"); exit(EXIT_FAILURE); } @@ -42,11 +49,23 @@ static int setup_server(void) exit(EXIT_FAILURE); } - if (bind(fd, &addr, sizeof addr) == -1) { - perror("bind"); + if (ioctl(fd, SIOCSIFADDR, &ifr6) == -1) { + perror("SIOCSIFADDR"); + exit(EXIT_FAILURE); + } + + if ((fd = socket(AF_INET6, SOCK_STREAM|SOCK_CLOEXEC, 0)) == -1) { + perror("socket"); exit(EXIT_FAILURE); } + int tries = 0; + while (bind(fd, &addr, sizeof addr) == -1) { + perror("bind"); + if (tries++ >= 5) + exit(EXIT_FAILURE); + } + if (listen(fd, 1) == -1) { perror("listen"); exit(EXIT_FAILURE); -- 2.51.2