Re: [PATCH bpf-next 5/6] selftests/bpf: Use connect_to_fd in sk_lookup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2024-06-21 at 18:35 +0800, Geliang Tang wrote:

[...]

> @@ -883,12 +881,10 @@ static void drop_on_lookup(const struct test *t)
>  	if (server_fd < 0)
>  		goto detach;
>  
> -	client_fd = make_socket(t->sotype, t->connect_to.ip,
> -				t->connect_to.port, &dst, &len);
> +	client_fd = connect_to_fd(server_fd, 0);

Nit: make_socket() used timeout { .tv_sec = IO_TIMEOUT_SEC },
     while here commect_to_fd is called with timeout disabled.
     Same applies to other replacements below.

>  	if (client_fd < 0)
>  		goto close_srv;
>  
> -	err = connect(client_fd, (void *)&dst, len);
>  	if (t->sotype == SOCK_DGRAM) {
>  		err = send_byte(client_fd);
>  		if (err)

[...]

> @@ -1257,17 +1247,13 @@ static void run_multi_prog_lookup(const struct test_multi_prog *t)
>  	if (err)
>  		goto out_close_server;
>  
> -	client_fd = make_socket(SOCK_STREAM, EXT_IP4, EXT_PORT, &dst, &len);
> -	if (client_fd < 0)
> -		goto out_close_server;
> -
> -	err = connect(client_fd, (void *)&dst, len);
> -	if (CHECK(err && !t->expect_errno, "connect",
> +	client_fd = connect_to_fd(server_fd, 0);

I'm not sure this is correct.
The original test uses EXT_IP4, EXT_PORT here,
while t->listen_at could be both { EXT_IP4, EXT_PORT } and { INT_IP4, INT_PORT }.
See test_multi_prog_lookup().

> +	if (CHECK(client_fd < 0 && !t->expect_errno, "connect",
>  		  "unexpected error %d\n", errno))
> -		goto out_close_client;
> -	if (CHECK(err && t->expect_errno && errno != t->expect_errno,
> +		goto out_close_server;
> +	if (CHECK(client_fd < 0 && t->expect_errno && errno != t->expect_errno,
>  		  "connect", "unexpected error %d\n", errno))
> -		goto out_close_client;
> +		goto out_close_server;
>  
>  	done = 0;
>  	prog_idx = PROG1;

[...]






[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux