[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220308023052.f7x5oxrcbdxnq7vu@kafai-mbp.dhcp.thefacebook.com>
Date: Mon, 7 Mar 2022 18:30:52 -0800
From: Martin KaFai Lau <kafai@...com>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Jesper Dangaard Brouer <hawk@...nel.org>,
Shuah Khan <shuah@...nel.org>, netdev@...r.kernel.org,
bpf@...r.kernel.org
Subject: Re: [PATCH bpf-next v9 4/5] selftests/bpf: Move open_netns() and
close_netns() into network_helpers.c
On Sun, Mar 06, 2022 at 11:34:03PM +0100, Toke Høiland-Jørgensen wrote:
> diff --git a/tools/testing/selftests/bpf/network_helpers.c b/tools/testing/selftests/bpf/network_helpers.c
> index 6db1af8fdee7..2bb1f9b3841d 100644
> --- a/tools/testing/selftests/bpf/network_helpers.c
> +++ b/tools/testing/selftests/bpf/network_helpers.c
> @@ -1,18 +1,25 @@
> // SPDX-License-Identifier: GPL-2.0-only
> +#define _GNU_SOURCE
> +
> #include <errno.h>
> #include <stdbool.h>
> #include <stdio.h>
> #include <string.h>
> #include <unistd.h>
> +#include <sched.h>
sched.h is added.
[ ... ]
> diff --git a/tools/testing/selftests/bpf/network_helpers.h b/tools/testing/selftests/bpf/network_helpers.h
> index d198181a5648..a4b3b2f9877b 100644
> --- a/tools/testing/selftests/bpf/network_helpers.h
> +++ b/tools/testing/selftests/bpf/network_helpers.h
> @@ -55,4 +55,13 @@ int make_sockaddr(int family, const char *addr_str, __u16 port,
> struct sockaddr_storage *addr, socklen_t *len);
> char *ping_command(int family);
>
> +struct nstoken;
> +/**
> + * open_netns() - Switch to specified network namespace by name.
> + *
> + * Returns token with which to restore the original namespace
> + * using close_netns().
> + */
> +struct nstoken *open_netns(const char *name);
> +void close_netns(struct nstoken *token);
> #endif
> diff --git a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c b/tools/testing/selftests/bpf/prog_tests/tc_redirect.c
> index 2b255e28ed26..d9e48b3ac9a6 100644
> --- a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c
> +++ b/tools/testing/selftests/bpf/prog_tests/tc_redirect.c
> @@ -22,7 +22,6 @@
> #include <sched.h>
sched.h can be removed?
and the _GNU_SOURCE above.
> #include <stdbool.h>
> #include <stdio.h>
> -#include <sys/mount.h>
> #include <sys/stat.h>
> #include <unistd.h>
Others lgtm.
Acked-by: Martin KaFai Lau <kafai@...com>
Powered by blists - more mailing lists