All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Antonio Quartulli <antonio@openvpn.net>
Cc: netdev@vger.kernel.org, Ralf Lici <ralf@mandelbit.com>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-kselftest@vger.kernel.org, Shuah Khan <shuah@kernel.org>
Subject: Re: [RFC net-next 13/13] selftests: ovpn: add test for bound address
Date: Thu, 27 Nov 2025 15:34:29 +0100	[thread overview]
Message-ID: <aShhdULYMt58e2_B@krikkit> (raw)
In-Reply-To: <20251121002044.16071-14-antonio@openvpn.net>

2025-11-21, 01:20:44 +0100, Antonio Quartulli wrote:
> From: Ralf Lici <ralf@mandelbit.com>
> 
> Add a selftest to verify that when a socket is bound to a local address,
> UDP traffic from ovpn is correctly routed through that address.
> 
> This test extends test-bind.sh by binding to the addresses on each veth
> pair and uses tcpdump to confirm that traffic flows as expected.

Same as the other bind scenario, the test works even if we don't bind
to that address.


A few small comments on the implementation:

> @@ -547,45 +518,83 @@ static int ovpn_socket(struct ovpn_ctx *ctx, sa_family_t family, int proto)
>  		if (setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, ctx->bind_dev,
>  			       strlen(ctx->bind_dev) + 1) != 0) {
>  			perror("setsockopt for SO_BINDTODEVICE");
> -			return -1;
> +			goto close;

ret isn't reset here, ovpn_socket will return a stale value.

>  		}
>  	}
>  
> -	ret = bind(s, (struct sockaddr *)&local_sock, sock_len);
> -	if (ret < 0) {
> -		perror("cannot bind socket");
> -		goto err_socket;
> +	return s;
> +close:
> +	close(s);
> +	return ret;
> +}
> +
[...]
> @@ -2221,6 +2228,9 @@ static int ovpn_parse_cmd_args(struct ovpn_ctx *ovpn, int argc, char *argv[])
>  
>  		ovpn->sa_family = AF_INET;
>  
> +		ovpn->laddr = NULL;
> +		ovpn->lport = "1";

Why do we want lport=1 on the CONNECT side now?

> +
>  		ret = ovpn_parse_new_peer(ovpn, argv[3], argv[4], argv[5], argv[6],
>  					  NULL);
>  		if (ret < 0) {

-- 
Sabrina

  reply	other threads:[~2025-11-27 14:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21  0:20 [RFC net-next 00/13] ovpn: new features + kselftests Antonio Quartulli
2025-11-21  0:20 ` [RFC net-next 01/13] selftests: ovpn: allow compiling ovpn-cli.c with mbedtls3 Antonio Quartulli
2025-11-21  0:20 ` [RFC net-next 02/13] selftests: ovpn: add notification parsing and matching Antonio Quartulli
2025-11-21 10:56   ` Antonio Quartulli
2025-11-24 15:51   ` Sabrina Dubroca
2025-11-25 10:21     ` Ralf Lici
2025-11-21  0:20 ` [RFC net-next 03/13] ovpn: use correct array size to parse nested attributes in ovpn_nl_key_swap_doit Antonio Quartulli
2025-11-21  0:20 ` [RFC net-next 04/13] ovpn: pktid: use bitops.h API Antonio Quartulli
2025-11-21  0:20 ` [RFC net-next 05/13] ovpn: notify userspace on client float event Antonio Quartulli
2025-11-21  0:20 ` [RFC net-next 06/13] ovpn: add support for asymmetric peer IDs Antonio Quartulli
2025-11-21  0:20 ` [RFC net-next 07/13] selftests: ovpn: check asymmetric peer-id Antonio Quartulli
2025-11-27  0:13   ` Sabrina Dubroca
2025-12-02 16:11     ` Ralf Lici
2025-11-21  0:20 ` [RFC net-next 08/13] selftests: ovpn: add test for the FW mark feature Antonio Quartulli
2025-11-27 11:09   ` Sabrina Dubroca
2025-12-02 16:22     ` Ralf Lici
2025-11-21  0:20 ` [RFC net-next 09/13] ovpn: consolidate crypto allocations in one chunk Antonio Quartulli
2025-11-21  0:20 ` [RFC net-next 10/13] ovpn: use bound device in UDP when available Antonio Quartulli
2025-11-21  0:20 ` [RFC net-next 11/13] selftests: ovpn: add test for bound device Antonio Quartulli
2025-11-27 11:29   ` Sabrina Dubroca
2025-12-02 16:28     ` Ralf Lici
2025-11-21  0:20 ` [RFC net-next 12/13] ovpn: use bound address in UDP when available Antonio Quartulli
2025-11-21  0:20 ` [RFC net-next 13/13] selftests: ovpn: add test for bound address Antonio Quartulli
2025-11-27 14:34   ` Sabrina Dubroca [this message]
2025-12-02 16:34     ` Ralf Lici

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=aShhdULYMt58e2_B@krikkit \
    --to=sd@queasysnail.net \
    --cc=antonio@openvpn.net \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ralf@mandelbit.com \
    --cc=shuah@kernel.org \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.