patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: Yureka Lilian <yureka@cyberchaos.dev>
Cc: devel@spectrum-os.org
Subject: Re: [PATCH v2 7/7] checks/integration: Adapt networking test for ipv6
Date: Sat, 29 Nov 2025 14:26:02 +0100	[thread overview]
Message-ID: <87sedx3r85.fsf@alyssa.is> (raw)
In-Reply-To: <20251128223038.97536-8-yureka@cyberchaos.dev>

[-- Attachment #1: Type: text/plain, Size: 2659 bytes --]

Yureka Lilian <yureka@cyberchaos.dev> writes:

> Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
> ---
>  release/checks/integration/default.nix  |  2 +-
>  release/checks/integration/networking.c | 32 +++++++++++++++++++------
>  2 files changed, 26 insertions(+), 8 deletions(-)

Reviewed-by: Alyssa Ross <hi@alyssa.is>

Presumably the IPv4 networking test stopped working at some point in
this series though, so we should disable it there at re-enable it here
so that we don't have commits that don't build.

> diff --git a/release/checks/integration/networking.c b/release/checks/integration/networking.c
> index 97d7895..6600385 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,23 @@
>  #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 } },
>  	};

Just a thought: could we declare and fill in ifr6 here, rather than
filling it in later?

>  	sprintf(ifr.ifr_name, "lo");
>  
> -	if ((fd = socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0)) == -1) {
> +	if ((fd = socket(AF_INET6, SOCK_STREAM|SOCK_CLOEXEC, 0)) == -1) {
>  		perror("socket");
>  		exit(EXIT_FAILURE);
>  	}
> @@ -42,11 +45,26 @@ static int setup_server(void)
>  		exit(EXIT_FAILURE);
>  	}
>  
> -	if (bind(fd, &addr, sizeof addr) == -1) {
> -		perror("bind");
> +	ifr6.ifr6_ifindex = 1;
> +	ifr6.ifr6_addr = addr.sin6_addr;
> +	ifr6.ifr6_prefixlen = 128;
> +	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);
> +	}
> +

I really want to figure out why this happens, but not a blocker.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

      reply	other threads:[~2025-11-29 13:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28 22:30 [PATCH v2 0/7] spectrum-router Yureka Lilian
2025-11-28 22:30 ` [PATCH v2 1/7] vm/sys/net: remove connman Yureka Lilian
2025-11-29 13:06   ` Alyssa Ross
2025-11-28 22:30 ` [PATCH v2 2/7] vm/sys/net: integrate xdp-forwarder Yureka Lilian
2025-11-29 13:08   ` Alyssa Ross
2025-11-29 13:15     ` Yureka
2025-11-29 13:17       ` Alyssa Ross
2025-11-28 22:30 ` [PATCH v2 3/7] vm/sys/net: add iwd Yureka Lilian
2025-11-29 13:09   ` Alyssa Ross
2025-11-28 22:30 ` [PATCH v2 4/7] tools: add spectrum-router Yureka Lilian
2025-11-29 13:18   ` Alyssa Ross
2025-11-28 22:30 ` [PATCH v2 5/7] host: integrate router Yureka Lilian
2025-11-29 13:46   ` Alyssa Ross
2025-11-29 14:28     ` Yureka
2025-11-29 14:44       ` Alyssa Ross
2025-11-28 22:30 ` [PATCH v2 6/7] img/app: change to ipv6 nameserver Yureka Lilian
2025-11-29 13:20   ` Alyssa Ross
2025-11-28 22:30 ` [PATCH v2 7/7] checks/integration: Adapt networking test for ipv6 Yureka Lilian
2025-11-29 13:26   ` Alyssa Ross [this message]

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=87sedx3r85.fsf@alyssa.is \
    --to=hi@alyssa.is \
    --cc=devel@spectrum-os.org \
    --cc=yureka@cyberchaos.dev \
    /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).