lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 16 May 2022 18:18:27 -0700
From:   Martin KaFai Lau <kafai@...com>
To:     Mat Martineau <mathew.j.martineau@...ux.intel.com>
Cc:     netdev@...r.kernel.org, bpf@...r.kernel.org,
        Nicolas Rybowski <nicolas.rybowski@...sares.net>,
        ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
        mptcp@...ts.linux.dev,
        Matthieu Baerts <matthieu.baerts@...sares.net>,
        Geliang Tang <geliang.tang@...e.com>
Subject: Re: [PATCH bpf-next v4 3/7] selftests/bpf: add MPTCP test base

On Fri, May 13, 2022 at 03:48:23PM -0700, Mat Martineau wrote:
[ ... ]

> @@ -265,7 +282,7 @@ int connect_to_fd_opts(int server_fd, const struct network_helper_opts *opts)
>  	}
>  
>  	addr_in = (struct sockaddr_in *)&addr;
> -	fd = socket(addr_in->sin_family, type, 0);
> +	fd = socket(addr_in->sin_family, type, opts->protocol);
ops->protocol is the same as the server_fd's protocol ?

Can that be learned from getsockopt(server_fd, SOL_SOCKET, SO_PROTOCOL, ....) ?
Then the ops->protocol additions and related changes are not needed.

connect_to_fd_opts() has already obtained the SO_TYPE in similar way.

>  	if (fd < 0) {
>  		log_err("Failed to create client socket");
>  		return -1;
> @@ -298,6 +315,16 @@ int connect_to_fd(int server_fd, int timeout_ms)
>  	return connect_to_fd_opts(server_fd, &opts);
>  }
>  
> +int connect_to_mptcp_fd(int server_fd, int timeout_ms)
> +{
> +	struct network_helper_opts opts = {
> +		.timeout_ms = timeout_ms,
> +		.protocol = IPPROTO_MPTCP,
> +	};
> +
> +	return connect_to_fd_opts(server_fd, &opts);
> +}
> +
>  int connect_fd_to_fd(int client_fd, int server_fd, int timeout_ms)
>  {
>  	struct sockaddr_storage addr;
> diff --git a/tools/testing/selftests/bpf/network_helpers.h b/tools/testing/selftests/bpf/network_helpers.h
> index a4b3b2f9877b..e0feb115b2ae 100644
> --- a/tools/testing/selftests/bpf/network_helpers.h
> +++ b/tools/testing/selftests/bpf/network_helpers.h
> @@ -21,6 +21,7 @@ struct network_helper_opts {
>  	const char *cc;
>  	int timeout_ms;
>  	bool must_fail;
> +	int protocol;
>  };
>  
>  /* ipv4 test vector */
> @@ -42,11 +43,14 @@ extern struct ipv6_packet pkt_v6;
>  int settimeo(int fd, int timeout_ms);
>  int start_server(int family, int type, const char *addr, __u16 port,
>  		 int timeout_ms);
> +int start_mptcp_server(int family, const char *addr, __u16 port,
> +		       int timeout_ms);
>  int *start_reuseport_server(int family, int type, const char *addr_str,
>  			    __u16 port, int timeout_ms,
>  			    unsigned int nr_listens);
>  void free_fds(int *fds, unsigned int nr_close_fds);
>  int connect_to_fd(int server_fd, int timeout_ms);
> +int connect_to_mptcp_fd(int server_fd, int timeout_ms);
>  int connect_to_fd_opts(int server_fd, const struct network_helper_opts *opts);
>  int connect_fd_to_fd(int client_fd, int server_fd, int timeout_ms);
>  int fastopen_connect(int server_fd, const char *data, unsigned int data_len,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ