From: Yureka Lilian <yureka@cyberchaos.dev>
To: devel@spectrum-os.org
Cc: Yureka Lilian <yureka@cyberchaos.dev>, Alyssa Ross <hi@alyssa.is>
Subject: [PATCH v3 09/10] release/checks/integration: Adapt networking test for ipv6
Date: Sat, 29 Nov 2025 19:15:08 +0100 [thread overview]
Message-ID: <20251129181514.20296-10-yureka@cyberchaos.dev> (raw)
In-Reply-To: <20251129181514.20296-1-yureka@cyberchaos.dev>
Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
Reviewed-by: Alyssa Ross <hi@alyssa.is>
---
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 <hi@alyssa.is>
+// SPDX-FileCopyrightText: 2025 Yureka Lilian <yureka@cyberchaos.dev>
#include "lib.h"
@@ -12,21 +13,27 @@
#include <net/if.h>
#include <sys/ioctl.h>
+#include <linux/ipv6.h>
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
next prev parent reply other threads:[~2025-11-29 18:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-29 18:14 [PATCH v3 00/10] spectrum-router Yureka Lilian
2025-11-29 18:15 ` [PATCH v3 01/10] release/checks/integration: temporarily disable networking tests Yureka Lilian
2025-11-29 18:15 ` [PATCH v3 02/10] vm/sys/net: remove connman Yureka Lilian
2025-11-29 18:15 ` [PATCH v3 03/10] pkgs: temporarily disable mailutils tests Yureka Lilian
2025-11-29 18:15 ` [PATCH v3 04/10] vm/sys/net: integrate xdp-forwarder Yureka Lilian
2025-11-29 18:15 ` [PATCH v3 05/10] vm/sys/net: add iwd Yureka Lilian
2025-11-29 18:15 ` [PATCH v3 06/10] tools: add spectrum-router Yureka Lilian
2025-11-29 18:15 ` [PATCH v3 07/10] host: integrate router Yureka Lilian
2025-11-29 18:15 ` [PATCH v3 08/10] img/app: change to ipv6 nameserver Yureka Lilian
2025-11-29 18:15 ` Yureka Lilian [this message]
2025-11-29 18:15 ` [PATCH v3 10/10] release/checks/integration: reenable networking tests Yureka Lilian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251129181514.20296-10-yureka@cyberchaos.dev \
--to=yureka@cyberchaos.dev \
--cc=devel@spectrum-os.org \
--cc=hi@alyssa.is \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).