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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230407014737.sqnq4a3g7ye2novk@dhcp-172-26-102-232.dhcp.thefacebook.com>
Date:   Thu, 6 Apr 2023 18:47:37 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Christian Ehrig <cehrig@...udflare.com>
Cc:     bpf@...r.kernel.org, kernel-team@...udflare.com,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <martin.lau@...ux.dev>,
        Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Stanislav Fomichev <sdf@...gle.com>,
        Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
        Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
        Kaixi Fan <fankaixi.li@...edance.com>,
        Paul Chaignon <paul@...valent.com>,
        Dave Marchevsky <davemarchevsky@...com>,
        linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next v2 3/3] selftests/bpf: Test FOU kfuncs for
 externally controlled ipip devices

On Mon, Apr 03, 2023 at 02:12:09PM +0200, Christian Ehrig wrote:
> +
> +SEC("tc")
> +int ipip_encap_get_tunnel(struct __sk_buff *skb)
> +{
> +	int ret;
> +	struct bpf_tunnel_key key = {};
> +	struct bpf_fou_encap encap = {};
> +
> +	ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0);
> +	if (ret < 0) {
> +		log_err(ret);
> +		return TC_ACT_SHOT;
> +	}
> +
> +	ret = bpf_skb_get_fou_encap(skb, &encap);
> +	if (ret < 0) {
> +		log_err(ret);
> +		return TC_ACT_SHOT;
> +	}
> +
> +	if (bpf_ntohs(encap.dport) != 5555)
> +		return TC_ACT_SHOT;
> +
> +	bpf_printk("%d remote ip 0x%x, sport %d, dport %d\n", ret,
> +		   key.remote_ipv4, bpf_ntohs(encap.sport),
> +		   bpf_ntohs(encap.dport));
> +	return TC_ACT_OK;
> +}
> +
>  SEC("tc")
>  int ipip6_set_tunnel(struct __sk_buff *skb)
>  {
> diff --git a/tools/testing/selftests/bpf/test_tunnel.sh b/tools/testing/selftests/bpf/test_tunnel.sh
> index 2dec7dbf29a2..f2379414a887 100755
> --- a/tools/testing/selftests/bpf/test_tunnel.sh
> +++ b/tools/testing/selftests/bpf/test_tunnel.sh

All looks good to me, but please integrate the selftest into test_progs.
test_tunnel is obsolete. BPF CI doesn't run it and maintainers don't do either.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ