From: Hangbin Liu <liuhangbin@gmail.com>
To: Martin KaFai Lau <kafai@fb.com>
Cc: netdev@vger.kernel.org, William Tu <u9012063@gmail.com>,
Daniel Borkmann <daniel@iogearbox.net>,
bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 2/2] selftest/bpf: remove unused bpf tunnel testing code
Date: Fri, 6 Nov 2020 15:55:36 +0800 [thread overview]
Message-ID: <20201106075536.GT2531@dhcp-12-153.nay.redhat.com> (raw)
In-Reply-To: <20201106073035.w2x4szk7m6nkx5yj@kafai-mbp.dhcp.thefacebook.com>
On Thu, Nov 05, 2020 at 11:30:35PM -0800, Martin KaFai Lau wrote:
> [ ... ]
>
> > @@ -585,12 +571,11 @@ int _ipip6_set_tunnel(struct __sk_buff *skb)
> > struct bpf_tunnel_key key = {};
> > void *data = (void *)(long)skb->data;
> > struct iphdr *iph = data;
> v4 hdr here.
Ah, right, I didn't notice this. I will fix it, maybe by checking
skb->family and use different IPv4,v6 hdr.
> > -SEC("ip6ip6_set_tunnel")
> > -int _ip6ip6_set_tunnel(struct __sk_buff *skb)
> > -{
> > - struct bpf_tunnel_key key = {};
> > - void *data = (void *)(long)skb->data;
> > - struct ipv6hdr *iph = data;
> IIUC, the patch is to replace _ip6ip6_set_tunnel with _ipip6_set_tunnel.
>
> Are they testing the same thing? At least, _ip6ip6_set_tunnel()
> is expecting a v6 hdr here.
Yes, the v4/v6 hdr here is just to check the data length.
>
> > - struct tcphdr *tcp = data + sizeof(*iph);
> > - void *data_end = (void *)(long)skb->data_end;
> > - int ret;
> > -
> > - /* single length check */
> > - if (data + sizeof(*iph) + sizeof(*tcp) > data_end) {
> > - ERROR(1);
> > - return TC_ACT_SHOT;
> > - }
^^ here
> > -
> > - key.remote_ipv6[0] = bpf_htonl(0x2401db00);
> > - key.tunnel_ttl = 64;
The code logic is same. It set tunnel remote addr to dst IPv6 address, as
they are both testing IP(v4 or v6) over IPv6 tunnel.
Thanks
Hangbin
next prev parent reply other threads:[~2020-11-06 7:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-03 4:29 [PATCH bpf-next 0/2] selftest/bpf: improve bpf tunnel test Hangbin Liu
2020-11-03 4:29 ` [PATCH bpf-next 1/2] selftest/bpf: add missed ip6ip6 test back Hangbin Liu
2020-11-04 18:40 ` Martin KaFai Lau
2020-11-05 3:20 ` Hangbin Liu
2020-11-03 4:29 ` [PATCH bpf-next 2/2] selftest/bpf: remove unused bpf tunnel testing code Hangbin Liu
2020-11-06 7:30 ` Martin KaFai Lau
2020-11-06 7:55 ` Hangbin Liu [this message]
2020-11-06 8:04 ` Hangbin Liu
2020-11-06 9:01 ` [PATCHv2 net 0/2] Remove unused test_ipip.sh test and add missed ip6ip6 test Hangbin Liu
2020-11-06 9:01 ` [PATCHv2 net 1/2] selftest/bpf: add missed ip6ip6 test back Hangbin Liu
2020-11-07 2:15 ` Martin KaFai Lau
2020-11-09 3:00 ` Hangbin Liu
2020-11-09 22:25 ` Martin KaFai Lau
2020-11-06 9:01 ` [PATCHv2 net 2/2] samples/bpf: remove unused test_ipip.sh Hangbin Liu
2020-11-07 2:16 ` Martin KaFai Lau
2020-11-06 18:56 ` [PATCHv2 net 0/2] Remove unused test_ipip.sh test and add missed ip6ip6 test Jakub Kicinski
2020-11-06 18:58 ` Alexei Starovoitov
2020-11-07 1:20 ` Hangbin Liu
2020-11-10 1:50 ` [PATCHv3 bpf " Hangbin Liu
2020-11-10 1:50 ` [PATCHv3 bpf 1/2] selftest/bpf: add missed ip6ip6 test back Hangbin Liu
2020-11-10 1:50 ` [PATCHv3 bpf 2/2] samples/bpf: remove unused test_ipip.sh Hangbin Liu
2020-11-10 17:35 ` [PATCHv3 bpf 0/2] Remove unused test_ipip.sh test and add missed ip6ip6 test Martin KaFai Lau
2020-11-11 0:56 ` Alexei Starovoitov
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=20201106075536.GT2531@dhcp-12-153.nay.redhat.com \
--to=liuhangbin@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kafai@fb.com \
--cc=netdev@vger.kernel.org \
--cc=u9012063@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).