提交 26bf8a89 编写于 作者: W William Tu 提交者: Daniel Borkmann

bpf, selftests: delete xfrm tunnel when test exits.

Make the printting of bpf xfrm tunnel better and
cleanup xfrm state and policy when xfrm test finishes.
Signed-off-by: NWilliam Tu <u9012063@gmail.com>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
上级 36ffdbc0
...@@ -608,20 +608,18 @@ setup_xfrm_tunnel() ...@@ -608,20 +608,18 @@ setup_xfrm_tunnel()
test_xfrm_tunnel() test_xfrm_tunnel()
{ {
config_device config_device
#tcpdump -nei veth1 ip & > /sys/kernel/debug/tracing/trace
output=$(mktemp)
cat /sys/kernel/debug/tracing/trace_pipe | tee $output &
setup_xfrm_tunnel setup_xfrm_tunnel
tc qdisc add dev veth1 clsact tc qdisc add dev veth1 clsact
tc filter add dev veth1 proto ip ingress bpf da obj test_tunnel_kern.o \ tc filter add dev veth1 proto ip ingress bpf da obj test_tunnel_kern.o \
sec xfrm_get_state sec xfrm_get_state
ip netns exec at_ns0 ping $PING_ARG 10.1.1.200 ip netns exec at_ns0 ping $PING_ARG 10.1.1.200
sleep 1 sleep 1
grep "reqid 1" $output grep "reqid 1" /sys/kernel/debug/tracing/trace
check_err $? check_err $?
grep "spi 0x1" $output grep "spi 0x1" /sys/kernel/debug/tracing/trace
check_err $? check_err $?
grep "remote ip 0xac100164" $output grep "remote ip 0xac100164" /sys/kernel/debug/tracing/trace
check_err $? check_err $?
cleanup cleanup
...@@ -657,6 +655,10 @@ cleanup() ...@@ -657,6 +655,10 @@ cleanup()
ip link del ip6geneve11 2> /dev/null ip link del ip6geneve11 2> /dev/null
ip link del erspan11 2> /dev/null ip link del erspan11 2> /dev/null
ip link del ip6erspan11 2> /dev/null ip link del ip6erspan11 2> /dev/null
ip xfrm policy delete dir out src 10.1.1.200/32 dst 10.1.1.100/32 2> /dev/null
ip xfrm policy delete dir in src 10.1.1.100/32 dst 10.1.1.200/32 2> /dev/null
ip xfrm state delete src 172.16.1.100 dst 172.16.1.200 proto esp spi 0x1 2> /dev/null
ip xfrm state delete src 172.16.1.200 dst 172.16.1.100 proto esp spi 0x2 2> /dev/null
} }
cleanup_exit() cleanup_exit()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册