Message ID | 1519863101-112083-3-git-send-email-u9012063@gmail.com |
---|---|
State | Superseded, archived |
Delegated to: | David Miller |
Headers | show |
Series | gre: add sequence number for collect md mode. | expand |
On 03/01/2018 01:11 AM, William Tu wrote: > The patch adds tests for GRE sequence number > support for metadata mode tunnel. > > Signed-off-by: William Tu <u9012063@gmail.com> > --- > samples/bpf/tcbpf2_kern.c | 6 ++++-- > samples/bpf/test_tunnel_bpf.sh | 4 ++-- > 2 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/samples/bpf/tcbpf2_kern.c b/samples/bpf/tcbpf2_kern.c > index efdc16d195ff..f9d0db2be21b 100644 > --- a/samples/bpf/tcbpf2_kern.c > +++ b/samples/bpf/tcbpf2_kern.c > @@ -52,7 +52,8 @@ int _gre_set_tunnel(struct __sk_buff *skb) > key.tunnel_tos = 0; > key.tunnel_ttl = 64; > > - ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), BPF_F_ZERO_CSUM_TX); > + ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), > + BPF_F_ZERO_CSUM_TX | BPF_F_GRE_SEQ); > if (ret < 0) { > ERROR(ret); > return TC_ACT_SHOT; > @@ -92,7 +93,8 @@ int _ip6gretap_set_tunnel(struct __sk_buff *skb) > key.tunnel_label = 0xabcde; > > ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), > - BPF_F_TUNINFO_IPV6 | BPF_F_ZERO_CSUM_TX); > + BPF_F_TUNINFO_IPV6 | BPF_F_ZERO_CSUM_TX | > + BPF_F_GRE_SEQ); > if (ret < 0) { > ERROR(ret); > return TC_ACT_SHOT; > diff --git a/samples/bpf/test_tunnel_bpf.sh b/samples/bpf/test_tunnel_bpf.sh > index 43ce049996ee..01a07fb9efa9 100755 > --- a/samples/bpf/test_tunnel_bpf.sh > +++ b/samples/bpf/test_tunnel_bpf.sh Can be as follow-up, but if you have a chance of moving this into BPF kselftests, this would be really great. Otherwise this will get little actual test coverage. Thanks, Daniel > @@ -23,7 +23,7 @@ function config_device { > function add_gre_tunnel { > # in namespace > ip netns exec at_ns0 \ > - ip link add dev $DEV_NS type $TYPE key 2 local 172.16.1.100 remote 172.16.1.200 > + ip link add dev $DEV_NS type $TYPE seq key 2 local 172.16.1.100 remote 172.16.1.200 > ip netns exec at_ns0 ip link set dev $DEV_NS up > ip netns exec at_ns0 ip addr add dev $DEV_NS 10.1.1.100/24 > > @@ -43,7 +43,7 @@ function add_ip6gretap_tunnel { > > # in namespace > ip netns exec at_ns0 \ > - ip link add dev $DEV_NS type $TYPE flowlabel 0xbcdef key 2 \ > + ip link add dev $DEV_NS type $TYPE seq flowlabel 0xbcdef key 2 \ > local ::11 remote ::22 > > ip netns exec at_ns0 ip addr add dev $DEV_NS 10.1.1.100/24 >
On Thu, Mar 1, 2018 at 2:30 AM, Daniel Borkmann <daniel@iogearbox.net> wrote: > On 03/01/2018 01:11 AM, William Tu wrote: >> The patch adds tests for GRE sequence number >> support for metadata mode tunnel. >> >> Signed-off-by: William Tu <u9012063@gmail.com> >> --- >> samples/bpf/tcbpf2_kern.c | 6 ++++-- >> samples/bpf/test_tunnel_bpf.sh | 4 ++-- >> 2 files changed, 6 insertions(+), 4 deletions(-) >> >> diff --git a/samples/bpf/tcbpf2_kern.c b/samples/bpf/tcbpf2_kern.c >> index efdc16d195ff..f9d0db2be21b 100644 >> --- a/samples/bpf/tcbpf2_kern.c >> +++ b/samples/bpf/tcbpf2_kern.c >> @@ -52,7 +52,8 @@ int _gre_set_tunnel(struct __sk_buff *skb) >> key.tunnel_tos = 0; >> key.tunnel_ttl = 64; >> >> - ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), BPF_F_ZERO_CSUM_TX); >> + ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), >> + BPF_F_ZERO_CSUM_TX | BPF_F_GRE_SEQ); >> if (ret < 0) { >> ERROR(ret); >> return TC_ACT_SHOT; >> @@ -92,7 +93,8 @@ int _ip6gretap_set_tunnel(struct __sk_buff *skb) >> key.tunnel_label = 0xabcde; >> >> ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), >> - BPF_F_TUNINFO_IPV6 | BPF_F_ZERO_CSUM_TX); >> + BPF_F_TUNINFO_IPV6 | BPF_F_ZERO_CSUM_TX | >> + BPF_F_GRE_SEQ); >> if (ret < 0) { >> ERROR(ret); >> return TC_ACT_SHOT; >> diff --git a/samples/bpf/test_tunnel_bpf.sh b/samples/bpf/test_tunnel_bpf.sh >> index 43ce049996ee..01a07fb9efa9 100755 >> --- a/samples/bpf/test_tunnel_bpf.sh >> +++ b/samples/bpf/test_tunnel_bpf.sh > > Can be as follow-up, but if you have a chance of moving this into BPF kselftests, > this would be really great. Otherwise this will get little actual test coverage. > > Thanks, > Daniel > Yes, this tunnel test is getting bigger and bigger, and it's better to move to ksefltests. I will work on it this month. Thanks! William
On 03/01/2018 06:19 PM, William Tu wrote: > On Thu, Mar 1, 2018 at 2:30 AM, Daniel Borkmann <daniel@iogearbox.net> wrote: >> On 03/01/2018 01:11 AM, William Tu wrote: [...] >>> diff --git a/samples/bpf/test_tunnel_bpf.sh b/samples/bpf/test_tunnel_bpf.sh >>> index 43ce049996ee..01a07fb9efa9 100755 >>> --- a/samples/bpf/test_tunnel_bpf.sh >>> +++ b/samples/bpf/test_tunnel_bpf.sh >> >> Can be as follow-up, but if you have a chance of moving this into BPF kselftests, >> this would be really great. Otherwise this will get little actual test coverage. >> > Yes, this tunnel test is getting bigger and bigger, and it's better to > move to ksefltests. > I will work on it this month. Great, thanks William!
diff --git a/samples/bpf/tcbpf2_kern.c b/samples/bpf/tcbpf2_kern.c index efdc16d195ff..f9d0db2be21b 100644 --- a/samples/bpf/tcbpf2_kern.c +++ b/samples/bpf/tcbpf2_kern.c @@ -52,7 +52,8 @@ int _gre_set_tunnel(struct __sk_buff *skb) key.tunnel_tos = 0; key.tunnel_ttl = 64; - ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), BPF_F_ZERO_CSUM_TX); + ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), + BPF_F_ZERO_CSUM_TX | BPF_F_GRE_SEQ); if (ret < 0) { ERROR(ret); return TC_ACT_SHOT; @@ -92,7 +93,8 @@ int _ip6gretap_set_tunnel(struct __sk_buff *skb) key.tunnel_label = 0xabcde; ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), - BPF_F_TUNINFO_IPV6 | BPF_F_ZERO_CSUM_TX); + BPF_F_TUNINFO_IPV6 | BPF_F_ZERO_CSUM_TX | + BPF_F_GRE_SEQ); if (ret < 0) { ERROR(ret); return TC_ACT_SHOT; diff --git a/samples/bpf/test_tunnel_bpf.sh b/samples/bpf/test_tunnel_bpf.sh index 43ce049996ee..01a07fb9efa9 100755 --- a/samples/bpf/test_tunnel_bpf.sh +++ b/samples/bpf/test_tunnel_bpf.sh @@ -23,7 +23,7 @@ function config_device { function add_gre_tunnel { # in namespace ip netns exec at_ns0 \ - ip link add dev $DEV_NS type $TYPE key 2 local 172.16.1.100 remote 172.16.1.200 + ip link add dev $DEV_NS type $TYPE seq key 2 local 172.16.1.100 remote 172.16.1.200 ip netns exec at_ns0 ip link set dev $DEV_NS up ip netns exec at_ns0 ip addr add dev $DEV_NS 10.1.1.100/24 @@ -43,7 +43,7 @@ function add_ip6gretap_tunnel { # in namespace ip netns exec at_ns0 \ - ip link add dev $DEV_NS type $TYPE flowlabel 0xbcdef key 2 \ + ip link add dev $DEV_NS type $TYPE seq flowlabel 0xbcdef key 2 \ local ::11 remote ::22 ip netns exec at_ns0 ip addr add dev $DEV_NS 10.1.1.100/24
The patch adds tests for GRE sequence number support for metadata mode tunnel. Signed-off-by: William Tu <u9012063@gmail.com> --- samples/bpf/tcbpf2_kern.c | 6 ++++-- samples/bpf/test_tunnel_bpf.sh | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)